Skip to content

Commit b9e7b03

Browse files
committed
Update algorithm & remove check
1 parent 228752c commit b9e7b03

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,6 @@ def verify_cell_kzg_proof_batch_impl(row_commitments: Sequence[KZGCommitment],
511511
n = FIELD_ELEMENTS_PER_CELL
512512
num_rows = len(row_commitments)
513513

514-
# Given zero cells, the result is true
515-
if num_cells == 0:
516-
return True
517-
518514
# Step 1: Compute a challenge r and its powers r^0, ..., r^{num_cells-1}
519515
r = compute_verify_cell_kzg_proof_batch_challenge(
520516
row_commitments,
@@ -544,7 +540,7 @@ def verify_cell_kzg_proof_batch_impl(row_commitments: Sequence[KZGCommitment],
544540

545541
# Step 4.2: Compute RLI = [sum_k r^k interpolation_poly_k(s)]
546542
# Note: an efficient implementation would use the IDFT based method explained in the blog post
547-
sum_interp_polys_coeff = [0]
543+
sum_interp_polys_coeff = [0] * n
548544
for k in range(num_cells):
549545
interp_poly_coeff = interpolate_polynomialcoeff(coset_for_cell(column_indices[k]), cosets_evals[k])
550546
interp_poly_scaled_coeff = multiply_polynomialcoeff([r_powers[k]], interp_poly_coeff)

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,20 @@ def test_verify_cell_kzg_proof(spec):
122122
assert spec.verify_cell_kzg_proof(commitment, cell_index, cells[cell_index], proofs[cell_index])
123123

124124

125+
@with_eip7594_and_later
126+
@spec_test
127+
@single_phase
128+
def test_verify_cell_kzg_proof_batch_zero_cells(spec):
129+
# Verify with zero cells should return true
130+
assert spec.verify_cell_kzg_proof_batch(
131+
row_commitments_bytes=[],
132+
row_indices=[],
133+
column_indices=[],
134+
cells=[],
135+
proofs_bytes=[],
136+
)
137+
138+
125139
@with_eip7594_and_later
126140
@spec_test
127141
@single_phase

0 commit comments

Comments
 (0)