diff --git a/specs/_features/eip7594/polynomial-commitments-sampling.md b/specs/_features/eip7594/polynomial-commitments-sampling.md index f369becf2..e22b6bf9f 100644 --- a/specs/_features/eip7594/polynomial-commitments-sampling.md +++ b/specs/_features/eip7594/polynomial-commitments-sampling.md @@ -438,7 +438,10 @@ def verify_cell_proof_batch(row_commitments_bytes: Sequence[Bytes48], cells_bytes: Sequence[Vector[Bytes32, FIELD_ELEMENTS_PER_CELL]], proofs_bytes: Sequence[Bytes48]) -> bool: """ - Check multiple cell proofs. This function implements the naive algorithm of checking every cell + Verify a set of cells, given their corresponding proofs and their coordinates (row_id, column_id) in the blob + matrix. The list of all commitments is also provided in row_commitments_bytes. + + This function implements the naive algorithm of checking every cell individually; an efficient algorithm can be found here: https://ethresear.ch/t/a-universal-verification-equation-for-data-availability-sampling/13240 @@ -448,6 +451,8 @@ def verify_cell_proof_batch(row_commitments_bytes: Sequence[Bytes48], Public method. """ + assert len(cells_bytes) == len(proofs_bytes) == len(row_ids) == len(column_ids) + # Get commitments via row IDs commitments_bytes = [row_commitments_bytes[row_id] for row_id in row_ids] diff --git a/tests/core/pyspec/eth2spec/test/eip7594/unittests/polynomial_commitments/test_polynomial_commitments.py b/tests/core/pyspec/eth2spec/test/eip7594/unittests/polynomial_commitments/test_polynomial_commitments.py index bea38d6e5..0b60cfd28 100644 --- a/tests/core/pyspec/eth2spec/test/eip7594/unittests/polynomial_commitments/test_polynomial_commitments.py +++ b/tests/core/pyspec/eth2spec/test/eip7594/unittests/polynomial_commitments/test_polynomial_commitments.py @@ -54,15 +54,16 @@ def test_verify_cell_proof_batch(spec): blob = get_sample_blob(spec) commitment = spec.blob_to_kzg_commitment(blob) cells, proofs = spec.compute_cells_and_proofs(blob) - cells_bytes = [[field_element_bytes(element) for element in cell] for cell in cells] + assert len(cells) == len(proofs) + assert spec.verify_cell_proof_batch( row_commitments_bytes=[commitment], - row_ids=[0], - column_ids=[0, 1], - cells_bytes=cells_bytes[0:1], - proofs_bytes=proofs, + row_ids=[0, 0], + column_ids=[0, 4], + cells_bytes=[cells_bytes[0], cells_bytes[4]], + proofs_bytes=[proofs[0], proofs[4]], )