diff --git a/specs/_features/eip7594/polynomial-commitments-sampling.md b/specs/_features/eip7594/polynomial-commitments-sampling.md index 1353bafa3e..cf3b2c7593 100644 --- a/specs/_features/eip7594/polynomial-commitments-sampling.md +++ b/specs/_features/eip7594/polynomial-commitments-sampling.md @@ -426,6 +426,8 @@ def compute_cells_and_proofs(blob: Blob) -> Tuple[ Public method. """ + assert len(blob) == BYTES_PER_BLOB + polynomial = blob_to_polynomial(blob) polynomial_coeff = polynomial_eval_to_coeff(polynomial) @@ -450,6 +452,8 @@ def compute_cells(blob: Blob) -> Vector[Cell, CELLS_PER_EXT_BLOB]: Public method. """ + assert len(blob) == BYTES_PER_BLOB + polynomial = blob_to_polynomial(blob) polynomial_coeff = polynomial_eval_to_coeff(polynomial) @@ -478,6 +482,11 @@ def verify_cell_proof(commitment_bytes: Bytes48, Public method. """ + assert len(commitment_bytes) == BYTES_PER_COMMITMENT + assert cell_id < CELLS_PER_EXT_BLOB + assert len(cell) == BYTES_PER_CELL + assert len(proof_bytes) == BYTES_PER_PROOF + coset = coset_for_cell(cell_id) return verify_kzg_proof_multi_impl( @@ -510,6 +519,16 @@ def verify_cell_proof_batch(row_commitments_bytes: Sequence[Bytes48], Public method. """ assert len(cells) == len(proofs_bytes) == len(row_indices) == len(column_indices) + for commitment_bytes in row_commitments_bytes: + assert len(commitment_bytes) == BYTES_PER_COMMITMENT + for row_index in row_indices: + assert row_index < len(row_commitments_bytes) + for column_index in column_indices: + assert column_index < CELLS_PER_EXT_BLOB + for cell in cells: + assert len(cell) == BYTES_PER_CELL + for proof_bytes in proofs_bytes: + assert len(proof_bytes) == BYTES_PER_PROOF # Get commitments via row IDs commitments_bytes = [row_commitments_bytes[row_index] for row_index in row_indices] @@ -655,6 +674,9 @@ def recover_all_cells(cell_ids: Sequence[CellID], cells: Sequence[Cell]) -> Sequ assert CELLS_PER_EXT_BLOB / 2 <= len(cell_ids) <= CELLS_PER_EXT_BLOB # Check for duplicates assert len(cell_ids) == len(set(cell_ids)) + # Check that each cell is the correct length + for cell in cells: + assert len(cell) == BYTES_PER_CELL # Get the extended domain roots_of_unity_extended = compute_roots_of_unity(FIELD_ELEMENTS_PER_EXT_BLOB)