Skip to content

Commit 2000a4f

Browse files
committed
Improve test_verify_cell_proof_batch()
1 parent 6679860 commit 2000a4f

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,10 @@ def verify_cell_proof_batch(row_commitments_bytes: Sequence[Bytes48],
438438
cells_bytes: Sequence[Vector[Bytes32, FIELD_ELEMENTS_PER_CELL]],
439439
proofs_bytes: Sequence[Bytes48]) -> bool:
440440
"""
441-
Check multiple cell proofs. This function implements the naive algorithm of checking every cell
441+
Verify a set of cells, given their corresponding proofs and their coordinates (row_id, column_id) in the blob
442+
matrix. The list of all commitments is also provided in row_commitments_bytes.
443+
444+
This function implements the naive algorithm of checking every cell
442445
individually; an efficient algorithm can be found here:
443446
https://ethresear.ch/t/a-universal-verification-equation-for-data-availability-sampling/13240
444447
@@ -448,6 +451,8 @@ def verify_cell_proof_batch(row_commitments_bytes: Sequence[Bytes48],
448451
449452
Public method.
450453
"""
454+
assert len(cells_bytes) == len(proofs_bytes) == len(row_ids) == len(column_ids)
455+
451456
# Get commitments via row IDs
452457
commitments_bytes = [row_commitments_bytes[row_id] for row_id in row_ids]
453458

tests/core/pyspec/eth2spec/test/eip7594/unittests/polynomial_commitments/test_polynomial_commitments.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ def test_verify_cell_proof_batch(spec):
5454
blob = get_sample_blob(spec)
5555
commitment = spec.blob_to_kzg_commitment(blob)
5656
cells, proofs = spec.compute_cells_and_proofs(blob)
57-
5857
cells_bytes = [[field_element_bytes(element) for element in cell] for cell in cells]
5958

59+
assert len(cells) == len(proofs)
60+
6061
assert spec.verify_cell_proof_batch(
6162
row_commitments_bytes=[commitment],
62-
row_ids=[0],
63-
column_ids=[0, 1],
64-
cells_bytes=cells_bytes[0:1],
65-
proofs_bytes=proofs,
63+
row_ids=[0, 0],
64+
column_ids=[0, 4],
65+
cells_bytes=[cells_bytes[0], cells_bytes[4]],
66+
proofs_bytes=[proofs[0], proofs[4]],
6667
)
6768

6869

0 commit comments

Comments
 (0)