Rename compute_cells_and_proofs to compute_cells_and_kzg_proofs

This commit is contained in:
Justin Traglia 2024-04-25 21:57:22 -05:00
parent 4f66521208
commit b4188829b3
7 changed files with 17 additions and 17 deletions

View File

@ -175,7 +175,7 @@ def get_data_column_sidecars(signed_block: SignedBeaconBlock,
block.body,
get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments'),
)
cells_and_proofs = [compute_cells_and_proofs(blob) for blob in blobs]
cells_and_proofs = [compute_cells_and_kzg_proofs(blob) for blob in blobs]
blob_count = len(blobs)
cells = [cells_and_proofs[i][0] for i in range(blob_count)]
proofs = [cells_and_proofs[i][1] for i in range(blob_count)]

View File

@ -37,7 +37,7 @@
- [`coset_for_cell`](#coset_for_cell)
- [Cells](#cells-1)
- [Cell computation](#cell-computation)
- [`compute_cells_and_proofs`](#compute_cells_and_proofs)
- [`compute_cells_and_kzg_proofs`](#compute_cells_and_kzg_proofs)
- [`compute_cells`](#compute_cells)
- [Cell verification](#cell-verification)
- [`verify_cell_kzg_proof`](#verify_cell_kzg_proof)
@ -419,10 +419,10 @@ def coset_for_cell(cell_id: CellID) -> Coset:
### Cell computation
#### `compute_cells_and_proofs`
#### `compute_cells_and_kzg_proofs`
```python
def compute_cells_and_proofs(blob: Blob) -> Tuple[
def compute_cells_and_kzg_proofs(blob: Blob) -> Tuple[
Vector[Cell, CELLS_PER_EXT_BLOB],
Vector[KZGProof, CELLS_PER_EXT_BLOB]]:
"""

View File

@ -34,7 +34,7 @@ def test_fft(spec):
def test_verify_cell_kzg_proof(spec):
blob = get_sample_blob(spec)
commitment = spec.blob_to_kzg_commitment(blob)
cells, proofs = spec.compute_cells_and_proofs(blob)
cells, proofs = spec.compute_cells_and_kzg_proofs(blob)
cell_id = 0
assert spec.verify_cell_kzg_proof(commitment, cell_id, cells[cell_id], proofs[cell_id])
@ -48,7 +48,7 @@ def test_verify_cell_kzg_proof(spec):
def test_verify_cell_kzg_proof_batch(spec):
blob = get_sample_blob(spec)
commitment = spec.blob_to_kzg_commitment(blob)
cells, proofs = spec.compute_cells_and_proofs(blob)
cells, proofs = spec.compute_cells_and_kzg_proofs(blob)
assert len(cells) == len(proofs)

View File

@ -152,4 +152,4 @@ INVALID_INDIVIDUAL_CELL_BYTES = [CELL_ALL_MAX_VALUE, CELL_ONE_INVALID_FIELD, CEL
# Cells & Proofs
VALID_CELLS_AND_PROOFS = [] # Saved in case02_compute_cells_and_proofs
VALID_CELLS_AND_PROOFS = [] # Saved in case02_compute_cells_and_kzg_proofs

View File

@ -7,7 +7,7 @@ We do not recommend rolling your own crypto or using an untested KZG library.
The KZG test suite runner has the following handlers:
- [`compute_cells`](./compute_cells.md)
- [`compute_cells_and_proofs`](./compute_cells_and_proofs.md)
- [`compute_cells_and_kzg_proofs`](./compute_cells_and_kzg_proofs.md)
- [`verify_cell_kzg_proof`](./verify_cell_kzg_proof.md)
- [`verify_cell_kzg_proof_batch`](./verify_cell_kzg_proof_batch.md)
- [`recover_all_cells`](./recover_all_cells.md)

View File

@ -1,4 +1,4 @@
# Test format: Compute cells and proofs
# Test format: Compute cells and KZG proofs
Compute the cells and cell KZG proofs for a given `blob`.
@ -20,4 +20,4 @@ All byte(s) fields are encoded as strings, hexadecimal encoding, prefixed with `
## Condition
The `compute_cells_and_proofs` handler should compute the cells (chunks of an extended blob) and cell KZG proofs for `blob`, and the result should match the expected `output`. If the blob is invalid (e.g. incorrect length or one of the 32-byte blocks does not represent a BLS field element) it should error, i.e. the output should be `null`.
The `compute_cells_and_kzg_proofs` handler should compute the cells (chunks of an extended blob) and cell KZG proofs for `blob`, and the result should match the expected `output`. If the blob is invalid (e.g. incorrect length or one of the 32-byte blocks does not represent a BLS field element) it should error, i.e. the output should be `null`.

View File

@ -60,17 +60,17 @@ def case01_compute_cells():
###############################################################################
# Test cases for compute_cells_and_proofs
# Test cases for compute_cells_and_kzg_proofs
###############################################################################
def case02_compute_cells_and_proofs():
def case02_compute_cells_and_kzg_proofs():
# Valid cases
for blob in VALID_BLOBS:
cells, proofs = spec.compute_cells_and_proofs(blob)
cells, proofs = spec.compute_cells_and_kzg_proofs(blob)
# Save cells & proofs here to save on time.
VALID_CELLS_AND_PROOFS.append((cells, proofs))
identifier = make_id(blob)
yield f'compute_cells_and_proofs_case_valid_{identifier}', {
yield f'compute_cells_and_kzg_proofs_case_valid_{identifier}', {
'input': {
'blob': encode_hex(blob),
},
@ -79,9 +79,9 @@ def case02_compute_cells_and_proofs():
# Edge case: Invalid blobs
for blob in INVALID_BLOBS:
expect_exception(spec.compute_cells_and_proofs, blob)
expect_exception(spec.compute_cells_and_kzg_proofs, blob)
identifier = make_id(blob)
yield f'compute_cells_and_proofs_case_invalid_blob_{identifier}', {
yield f'compute_cells_and_kzg_proofs_case_invalid_blob_{identifier}', {
'input': {
'blob': encode_hex(blob)
},
@ -830,7 +830,7 @@ if __name__ == "__main__":
gen_runner.run_generator("kzg_7594", [
# EIP-7594
create_provider(EIP7594, 'compute_cells', case01_compute_cells),
create_provider(EIP7594, 'compute_cells_and_proofs', case02_compute_cells_and_proofs),
create_provider(EIP7594, 'compute_cells_and_kzg_proofs', case02_compute_cells_and_kzg_proofs),
create_provider(EIP7594, 'verify_cell_kzg_proof', case03_verify_cell_kzg_proof),
create_provider(EIP7594, 'verify_cell_kzg_proof_batch', case04_verify_cell_kzg_proof_batch),
create_provider(EIP7594, 'recover_all_cells', case05_recover_all_cells),