Skip to content

Commit

Permalink
Remove EXPANSION_FACTOR constant
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraglia committed Sep 19, 2024
1 parent 021730e commit 4e4ce18
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/eip7594/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
/** The number of bytes in a single cell. */
#define BYTES_PER_CELL (FIELD_ELEMENTS_PER_CELL * BYTES_PER_FIELD_ELEMENT)

/** The Reed-Solomon erasure coding expansion factor. */
#define EXPANSION_FACTOR 2

/** The number of field elements in an extended blob. */
#define FIELD_ELEMENTS_PER_EXT_BLOB (FIELD_ELEMENTS_PER_BLOB * EXPANSION_FACTOR)
#define FIELD_ELEMENTS_PER_EXT_BLOB (FIELD_ELEMENTS_PER_BLOB * 2)

/** The number of cells in a blob. */
#define CELLS_PER_BLOB (FIELD_ELEMENTS_PER_BLOB / FIELD_ELEMENTS_PER_CELL)
Expand Down
4 changes: 2 additions & 2 deletions src/eip7594/eip7594.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ C_KZG_RET compute_cells_and_kzg_proofs(
* @param[in] num_cells The number of available cells provided
* @param[in] s The trusted setup
*
* @remark At least CELLS_PER_EXT_BLOB/EXPANSION_FACTOR cells must be provided.
* @remark At least 50% of CELLS_PER_EXT_BLOB cells must be provided.
* @remark Recovery is faster if there are fewer missing cells.
* @remark If recovered_proofs is NULL, they will not be recomputed.
*/
Expand All @@ -199,7 +199,7 @@ C_KZG_RET recover_cells_and_kzg_proofs(
}

/* Check if it's possible to recover */
if (num_cells < CELLS_PER_EXT_BLOB / EXPANSION_FACTOR) {
if (num_cells < CELLS_PER_EXT_BLOB / 2) {
ret = C_KZG_BADARGS;
goto out;
}
Expand Down
2 changes: 1 addition & 1 deletion src/eip7594/fk20.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ C_KZG_RET compute_fk20_cell_proofs(g1_t *out, const fr_t *p, const KZGSettings *

/* Initialize length variables */
k = FIELD_ELEMENTS_PER_BLOB / FIELD_ELEMENTS_PER_CELL;
k2 = k * EXPANSION_FACTOR;
k2 = k * 2;

/* Do allocations */
ret = new_fr_array(&toeplitz_coeffs, k2);
Expand Down

0 comments on commit 4e4ce18

Please sign in to comment.