@@ -79,9 +79,10 @@ Cells are the smallest unit of blob data that can come with their own KZG proofs
7979
8080| Name | Value | Description |
8181| - | - | - |
82+ | ` FIELD_ELEMENTS_PER_EXT_BLOB ` | ` 2 * FIELD_ELEMENTS_PER_BLOB ` | Number of field elements in a Reed-Solomon extended blob |
8283| ` FIELD_ELEMENTS_PER_CELL ` | ` uint64(64) ` | Number of field elements in a cell |
8384| ` BYTES_PER_CELL ` | ` FIELD_ELEMENTS_PER_CELL * BYTES_PER_FIELD_ELEMENT ` | The number of bytes in a cell |
84- | ` CELLS_PER_BLOB ` | ` ((2 * FIELD_ELEMENTS_PER_BLOB) // FIELD_ELEMENTS_PER_CELL) ` | The number of cells in a blob |
85+ | ` CELLS_PER_BLOB ` | ` FIELD_ELEMENTS_PER_EXT_BLOB // FIELD_ELEMENTS_PER_CELL` | The number of cells in a blob |
8586| ` RANDOM_CHALLENGE_KZG_CELL_BATCH_DOMAIN ` | ` b'RCKZGCBATCH__V1_' ` |
8687
8788## Helper functions
@@ -355,7 +356,7 @@ def coset_for_cell(cell_id: CellID) -> Cell:
355356 """
356357 assert cell_id < CELLS_PER_BLOB
357358 roots_of_unity_brp = bit_reversal_permutation(
358- compute_roots_of_unity(2 * FIELD_ELEMENTS_PER_BLOB )
359+ compute_roots_of_unity(FIELD_ELEMENTS_PER_EXT_BLOB )
359360 )
360361 return Cell(roots_of_unity_brp[FIELD_ELEMENTS_PER_CELL * cell_id:FIELD_ELEMENTS_PER_CELL * (cell_id + 1 )])
361362```
@@ -405,7 +406,7 @@ def compute_cells(blob: Blob) -> Vector[Cell, CELLS_PER_BLOB]:
405406 polynomial_coeff = polynomial_eval_to_coeff(polynomial)
406407
407408 extended_data = fft_field(polynomial_coeff + [0 ] * FIELD_ELEMENTS_PER_BLOB ,
408- compute_roots_of_unity(2 * FIELD_ELEMENTS_PER_BLOB ))
409+ compute_roots_of_unity(FIELD_ELEMENTS_PER_EXT_BLOB ))
409410 extended_data_rbo = bit_reversal_permutation(extended_data)
410411 return [extended_data_rbo[i * FIELD_ELEMENTS_PER_CELL :(i + 1 ) * FIELD_ELEMENTS_PER_CELL ]
411412 for i in range (CELLS_PER_BLOB )]
@@ -494,13 +495,13 @@ def construct_vanishing_polynomial(missing_cell_ids: Sequence[CellID]) -> Tuple[
494495 ])
495496
496497 # Extend vanishing polynomial to full domain using the closed form of the vanishing polynomial over a coset
497- zero_poly_coeff = [0 ] * (FIELD_ELEMENTS_PER_BLOB * 2 )
498+ zero_poly_coeff = [0 ] * (FIELD_ELEMENTS_PER_EXT_BLOB )
498499 for i, coeff in enumerate (short_zero_poly):
499500 zero_poly_coeff[i * FIELD_ELEMENTS_PER_CELL ] = coeff
500501
501502 # Compute evaluations of the extended vanishing polynomial
502503 zero_poly_eval = fft_field(zero_poly_coeff,
503- compute_roots_of_unity(2 * FIELD_ELEMENTS_PER_BLOB ))
504+ compute_roots_of_unity(FIELD_ELEMENTS_PER_EXT_BLOB ))
504505 zero_poly_eval_brp = bit_reversal_permutation(zero_poly_eval)
505506
506507 # Sanity check
@@ -532,7 +533,7 @@ def recover_shifted_data(cell_ids: Sequence[CellID],
532533 shift_factor = BLSFieldElement(PRIMITIVE_ROOT_OF_UNITY )
533534 shift_inv = div(BLSFieldElement(1 ), shift_factor)
534535
535- extended_evaluation_rbo = [0 ] * (FIELD_ELEMENTS_PER_BLOB * 2 )
536+ extended_evaluation_rbo = [0 ] * (FIELD_ELEMENTS_PER_EXT_BLOB )
536537 for cell_id, cell in zip (cell_ids, cells):
537538 start = cell_id * FIELD_ELEMENTS_PER_CELL
538539 end = (cell_id + 1 ) * FIELD_ELEMENTS_PER_CELL
@@ -588,7 +589,7 @@ def recover_original_data(eval_shifted_extended_evaluation: Sequence[BLSFieldEle
588589def recover_polynomial (cell_ids : Sequence[CellID],
589590 cells_bytes : Sequence[Vector[Bytes32, FIELD_ELEMENTS_PER_CELL ]]) -> Polynomial:
590591 """
591- Recover original polynomial from 2 * FIELD_ELEMENTS_PER_CELL evaluations, half of which can be missing. This
592+ Recover original polynomial from FIELD_ELEMENTS_PER_EXT_BLOB evaluations, half of which can be missing. This
592593 algorithm uses FFTs to recover cells faster than using Lagrange implementation, as can be seen here:
593594 https://ethresear.ch/t/reed-solomon-erasure-code-recovery-in-n-log-2-n-time-with-ffts/3039
594595
@@ -604,7 +605,7 @@ def recover_polynomial(cell_ids: Sequence[CellID],
604605 assert len (cell_ids) == len (set (cell_ids))
605606
606607 # Get the extended domain
607- roots_of_unity_extended = compute_roots_of_unity(2 * FIELD_ELEMENTS_PER_BLOB )
608+ roots_of_unity_extended = compute_roots_of_unity(FIELD_ELEMENTS_PER_EXT_BLOB )
608609
609610 # Convert from bytes to cells
610611 cells = [bytes_to_cell(cell_bytes) for cell_bytes in cells_bytes]
0 commit comments