Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/common/fr.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,6 @@ bool fr_is_one(const fr_t *p) {
return a[0] == 1 && a[1] == 0 && a[2] == 0 && a[3] == 0;
}

/**
* Test whether the operand is null (all 0xff's).
*
* @param[in] p The field element to be checked
*
* @retval true The element is null
* @retval false The element is not null
*/
bool fr_is_null(const fr_t *p) {
return fr_equal(p, &FR_NULL);
}

/**
* Divide a field element by another.
*
Expand Down
6 changes: 0 additions & 6 deletions src/common/fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ static const fr_t FR_ONE = {
{0x00000001fffffffeL, 0x5884b7fa00034802L, 0x998c4fefecbc4ff5L, 0x1824b159acc5056fL}
};

/** This used to represent a missing element. It's an invalid value. */
static const fr_t FR_NULL = {
{0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL}
};

////////////////////////////////////////////////////////////////////////////////////////////////////
// Public Functions
////////////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -63,7 +58,6 @@ extern "C" {

bool fr_equal(const fr_t *a, const fr_t *b);
bool fr_is_one(const fr_t *p);
bool fr_is_null(const fr_t *p);
void fr_div(fr_t *out, const fr_t *a, const fr_t *b);
void fr_pow(fr_t *out, const fr_t *a, uint64_t n);
void fr_from_uint64(fr_t *out, uint64_t n);
Expand Down
4 changes: 2 additions & 2 deletions src/eip7594/eip7594.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ C_KZG_RET recover_cells_and_kzg_proofs(
ret = new_g1_array(&recovered_proofs_g1, CELLS_PER_EXT_BLOB);
if (ret != C_KZG_OK) goto out;

/* Initialize all cells as missing */
/* Initialize all cells to zero */
for (size_t i = 0; i < FIELD_ELEMENTS_PER_EXT_BLOB; i++) {
recovered_cells_fr[i] = FR_NULL;
recovered_cells_fr[i] = FR_ZERO;
}

/* Populate recovered_cells_fr with available cells at the right places */
Expand Down
13 changes: 1 addition & 12 deletions src/eip7594/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ static bool is_in_array(const uint64_t *arr, size_t arr_size, uint64_t value) {
*
* @remark `reconstructed_data_out` and `cells` can point to the same memory.
* @remark The array `cells` must be in the correct order (according to cell_indices).
* @remark Missing cells in `cells` should be equal to FR_NULL.
*/
C_KZG_RET recover_cells(
fr_t *reconstructed_data_out,
Expand Down Expand Up @@ -280,17 +279,7 @@ C_KZG_RET recover_cells(
* P(x) is the polynomial we want to reconstruct (degree FIELD_ELEMENTS_PER_BLOB - 1).
*/
for (size_t i = 0; i < FIELD_ELEMENTS_PER_EXT_BLOB; i++) {
if (fr_is_null(&cells_brp[i])) {
/*
* We handle this situation differently because FR_NULL is an invalid value. The right
* hand side, vanishing_poly_eval[i], will always be zero when cells_brp[i] is null, so
* the multiplication would still be result in zero, but we shouldn't depend on blst
* handling invalid values like this.
*/
extended_evaluation_times_zero[i] = FR_ZERO;
} else {
blst_fr_mul(&extended_evaluation_times_zero[i], &cells_brp[i], &vanishing_poly_eval[i]);
}
blst_fr_mul(&extended_evaluation_times_zero[i], &cells_brp[i], &vanishing_poly_eval[i]);
}

/*
Expand Down
Loading