Merge pull request #3745 from kevaundray/kw/pad-column-indices

chore: Pad column indices when calling `verify_cell_kzg_proof_batch`
This commit is contained in:
George Kadianakis 2024-05-03 19:36:12 +03:00 committed by GitHub
commit 2abf4ce4d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -71,13 +71,15 @@ def verify_data_column_sidecar_kzg_proofs(sidecar: DataColumnSidecar) -> bool:
"""
assert sidecar.index < NUMBER_OF_COLUMNS
assert len(sidecar.column) == len(sidecar.kzg_commitments) == len(sidecar.kzg_proofs)
row_ids = [RowIndex(i) for i in range(len(sidecar.column))]
row_indices = [RowIndex(i) for i in range(len(sidecar.column))]
column_indices = [sidecar.index] * len(sidecar.column)
# KZG batch verifies that the cells match the corresponding commitments and proofs
return verify_cell_kzg_proof_batch(
row_commitments_bytes=sidecar.kzg_commitments,
row_indices=row_ids, # all rows
column_indices=[sidecar.index],
row_indices=row_indices, # all rows
column_indices=column_indices, # specific column
cells=sidecar.column,
proofs_bytes=sidecar.kzg_proofs,
)

View File

@ -56,6 +56,7 @@ def _run_blob_kzg_commitments_merkle_proof_test(spec, state, rng=None):
index=spec.get_subtree_index(gindex),
root=column_sidcar.signed_block_header.message.body_root,
)
assert spec.verify_data_column_sidecar_kzg_proofs(column_sidcar)
assert spec.verify_data_column_sidecar_inclusion_proof(column_sidcar)