Skip to content

Commit 1642610

Browse files
authored
Merge pull request #3835 from jtraglia/early-exit-zero-cells
In batch cell verification, check if there are zero cells
2 parents 9be0529 + b9e7b03 commit 1642610

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ def verify_cell_kzg_proof_batch_impl(row_commitments: Sequence[KZGCommitment],
540540

541541
# Step 4.2: Compute RLI = [sum_k r^k interpolation_poly_k(s)]
542542
# Note: an efficient implementation would use the IDFT based method explained in the blog post
543-
sum_interp_polys_coeff = [0]
543+
sum_interp_polys_coeff = [0] * n
544544
for k in range(num_cells):
545545
interp_poly_coeff = interpolate_polynomialcoeff(coset_for_cell(column_indices[k]), cosets_evals[k])
546546
interp_poly_scaled_coeff = multiply_polynomialcoeff([r_powers[k]], interp_poly_coeff)
@@ -567,7 +567,6 @@ def verify_cell_kzg_proof_batch_impl(row_commitments: Sequence[KZGCommitment],
567567
]))
568568
```
569569

570-
571570
### Cell cosets
572571

573572
#### `coset_shift_for_cell`

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)