Skip to content

Commit 973f9cd

Browse files
authored
Merge pull request #3796 from jtraglia/remove-compute-cells
Remove `compute_cells` method
2 parents 7b7ada7 + 93dfcda commit 973f9cd

File tree

2 files changed

+8
-64
lines changed

2 files changed

+8
-64
lines changed

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
- [Cells](#cells-1)
4040
- [Cell computation](#cell-computation)
4141
- [`compute_cells_and_kzg_proofs`](#compute_cells_and_kzg_proofs)
42-
- [`compute_cells`](#compute_cells)
4342
- [Cell verification](#cell-verification)
4443
- [`verify_cell_kzg_proof`](#verify_cell_kzg_proof)
4544
- [`verify_cell_kzg_proof_batch`](#verify_cell_kzg_proof_batch)
@@ -65,7 +64,6 @@ Public functions MUST accept raw bytes as input and perform the required cryptog
6564
The following is a list of the public methods:
6665

6766
* [`compute_cells_and_kzg_proofs`](#compute_cells_and_kzg_proofs)
68-
* [`compute_cells`](#compute_cells)
6967
* [`verify_cell_kzg_proof`](#verify_cell_kzg_proof)
7068
* [`verify_cell_kzg_proof_batch`](#verify_cell_kzg_proof_batch)
7169
* [`recover_cells_and_kzg_proofs`](#recover_cells_and_kzg_proofs)
@@ -459,31 +457,6 @@ def compute_cells_and_kzg_proofs(blob: Blob) -> Tuple[
459457
return cells, proofs
460458
```
461459

462-
#### `compute_cells`
463-
464-
```python
465-
def compute_cells(blob: Blob) -> Vector[Cell, CELLS_PER_EXT_BLOB]:
466-
"""
467-
Compute the cell data for an extended blob (without computing the proofs).
468-
469-
Public method.
470-
"""
471-
assert len(blob) == BYTES_PER_BLOB
472-
473-
polynomial = blob_to_polynomial(blob)
474-
polynomial_coeff = polynomial_eval_to_coeff(polynomial)
475-
476-
extended_data = fft_field(polynomial_coeff + [0] * FIELD_ELEMENTS_PER_BLOB,
477-
compute_roots_of_unity(FIELD_ELEMENTS_PER_EXT_BLOB))
478-
extended_data_rbo = bit_reversal_permutation(extended_data)
479-
cells = []
480-
for cell_index in range(CELLS_PER_EXT_BLOB):
481-
start = cell_index * FIELD_ELEMENTS_PER_CELL
482-
end = (cell_index + 1) * FIELD_ELEMENTS_PER_CELL
483-
cells.append(coset_evals_to_cell(CosetEvals(extended_data_rbo[start:end])))
484-
return cells
485-
```
486-
487460
### Cell verification
488461

489462
#### `verify_cell_kzg_proof`

tests/generators/kzg_7594/main.py

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,11 @@
2929
from eth2spec.utils import bls
3030

3131

32-
###############################################################################
33-
# Test cases for compute_cells
34-
###############################################################################
35-
36-
def case01_compute_cells():
37-
# Valid cases
38-
for blob in VALID_BLOBS:
39-
cells = spec.compute_cells(blob)
40-
identifier = make_id(blob)
41-
yield f'compute_cells_case_valid_{identifier}', {
42-
'input': {
43-
'blob': encode_hex(blob),
44-
},
45-
'output': encode_hex_list(cells)
46-
}
47-
48-
# Edge case: Invalid blobs
49-
for blob in INVALID_BLOBS:
50-
expect_exception(spec.compute_cells, blob)
51-
identifier = make_id(blob)
52-
yield f'compute_cells_case_invalid_blob_{identifier}', {
53-
'input': {
54-
'blob': encode_hex(blob)
55-
},
56-
'output': None
57-
}
58-
59-
6032
###############################################################################
6133
# Test cases for compute_cells_and_kzg_proofs
6234
###############################################################################
6335

64-
def case02_compute_cells_and_kzg_proofs():
36+
def case_compute_cells_and_kzg_proofs():
6537
# Valid cases
6638
for blob in VALID_BLOBS:
6739
cells, proofs = spec.compute_cells_and_kzg_proofs(blob)
@@ -91,7 +63,7 @@ def case02_compute_cells_and_kzg_proofs():
9163
# Test cases for verify_cell_kzg_proof
9264
###############################################################################
9365

94-
def case03_verify_cell_kzg_proof():
66+
def case_verify_cell_kzg_proof():
9567
# Valid cases
9668
for i in range(len(VALID_BLOBS)):
9769
cells, proofs = VALID_CELLS_AND_PROOFS[i]
@@ -245,7 +217,7 @@ def case03_verify_cell_kzg_proof():
245217
# Test cases for verify_cell_kzg_proof_batch
246218
###############################################################################
247219

248-
def case04_verify_cell_kzg_proof_batch():
220+
def case_verify_cell_kzg_proof_batch():
249221
# Valid cases
250222
for i in range(len(VALID_BLOBS)):
251223
cells, proofs = VALID_CELLS_AND_PROOFS[i]
@@ -617,7 +589,7 @@ def case04_verify_cell_kzg_proof_batch():
617589
# Test cases for recover_cells_and_kzg_proofs
618590
###############################################################################
619591

620-
def case05_recover_cells_and_kzg_proofs():
592+
def case_recover_cells_and_kzg_proofs():
621593
# Valid: No missing cells
622594
cells, proofs = VALID_CELLS_AND_PROOFS[0]
623595
cell_indices = list(range(spec.CELLS_PER_EXT_BLOB))
@@ -899,9 +871,8 @@ def cases_fn() -> Iterable[gen_typing.TestCase]:
899871
bls.use_arkworks()
900872
gen_runner.run_generator("kzg_7594", [
901873
# EIP-7594
902-
create_provider(EIP7594, 'compute_cells', case01_compute_cells),
903-
create_provider(EIP7594, 'compute_cells_and_kzg_proofs', case02_compute_cells_and_kzg_proofs),
904-
create_provider(EIP7594, 'verify_cell_kzg_proof', case03_verify_cell_kzg_proof),
905-
create_provider(EIP7594, 'verify_cell_kzg_proof_batch', case04_verify_cell_kzg_proof_batch),
906-
create_provider(EIP7594, 'recover_cells_and_kzg_proofs', case05_recover_cells_and_kzg_proofs),
874+
create_provider(EIP7594, 'compute_cells_and_kzg_proofs', case_compute_cells_and_kzg_proofs),
875+
create_provider(EIP7594, 'verify_cell_kzg_proof', case_verify_cell_kzg_proof),
876+
create_provider(EIP7594, 'verify_cell_kzg_proof_batch', case_verify_cell_kzg_proof_batch),
877+
create_provider(EIP7594, 'recover_cells_and_kzg_proofs', case_recover_cells_and_kzg_proofs),
907878
])

0 commit comments

Comments
 (0)