Skip to content

Commit fdeff74

Browse files
authored
EIP-7594: Add a missing check and a missing test vector (#3765)
1 parent e5813bd commit fdeff74

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

specs/_features/eip7594/polynomial-commitments-sampling.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,9 @@ def recover_all_cells(cell_ids: Sequence[CellID], cells: Sequence[Cell]) -> Sequ
683683
# Check that each cell is the correct length
684684
for cell in cells:
685685
assert len(cell) == BYTES_PER_CELL
686+
# Check that the cell ids are within bounds
687+
for cell_id in cell_ids:
688+
assert cell_id < CELLS_PER_EXT_BLOB
686689

687690
# Get the extended domain
688691
roots_of_unity_extended = compute_roots_of_unity(FIELD_ELEMENTS_PER_EXT_BLOB)

tests/generators/kzg_7594/main.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,21 @@ def case05_recover_all_cells():
710710
'output': None
711711
}
712712

713+
# Edge case: More cells provided than CELLS_PER_EXT_BLOB
714+
blob = BLOB_RANDOM_VALID2
715+
cells = spec.compute_cells(blob)
716+
cell_ids = list(range(spec.CELLS_PER_EXT_BLOB)) + [0]
717+
partial_cells = [cells[cell_id] for cell_id in cell_ids]
718+
expect_exception(spec.recover_all_cells, cell_ids, partial_cells)
719+
identifier = make_id(cell_ids, partial_cells)
720+
yield f'recover_all_cells_case_invalid_more_cells_than_cells_per_ext_blob_{identifier}', {
721+
'input': {
722+
'cell_ids': cell_ids,
723+
'cells': encode_hex_list(partial_cells),
724+
},
725+
'output': None
726+
}
727+
713728
# Edge case: Invalid cell_id
714729
blob = BLOB_RANDOM_VALID1
715730
cells = spec.compute_cells(blob)

0 commit comments

Comments
 (0)