Skip to content

Commit

Permalink
Introduce internal Coset type for coset_for_cell()
Browse files Browse the repository at this point in the history
  • Loading branch information
asn-d6 committed Apr 22, 2024
1 parent 169cc83 commit bc607ec
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions specs/_features/eip7594/polynomial-commitments-sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ Public functions MUST accept raw bytes as input and perform the required cryptog
| Name | SSZ equivalent | Description |
| - | - | - |
| `PolynomialCoeff` | `List[BLSFieldElement, FIELD_ELEMENTS_PER_EXT_BLOB]` | A polynomial in coefficient form |
| `CosetEvals` | `Vector[BLSFieldElement, FIELD_ELEMENTS_PER_CELL]` | The internal representation of a cell |
| `Coset` | `Vector[BLSFieldElement, FIELD_ELEMENTS_PER_CELL]` | The evaluation domain of a cell |
| `CosetEvals` | `Vector[BLSFieldElement, FIELD_ELEMENTS_PER_CELL]` | The internal representation of a cell (the evaluations over its Coset) |
| `Cell` | `ByteVector[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_CELL]` | The unit of blob data that can come with its own KZG proof |
| `CellID` | `uint64` | Cell identifier |
| `RowIndex` | `uint64` | Row identifier |
Expand Down Expand Up @@ -327,7 +328,7 @@ Extended KZG functions for multiproofs
```python
def compute_kzg_proof_multi_impl(
polynomial_coeff: PolynomialCoeff,
zs: Sequence[BLSFieldElement]) -> Tuple[KZGProof, Sequence[BLSFieldElement]]:
zs: Coset) -> Tuple[KZGProof, Sequence[BLSFieldElement]]:
"""
Compute a KZG multi-evaluation proof for a set of `k` points.
Expand Down Expand Up @@ -357,8 +358,8 @@ def compute_kzg_proof_multi_impl(

```python
def verify_kzg_proof_multi_impl(commitment: KZGCommitment,
zs: Sequence[BLSFieldElement],
ys: Sequence[BLSFieldElement],
zs: Coset,
ys: CosetEvals,
proof: KZGProof) -> bool:
"""
Helper function that verifies a KZG multiproof
Expand All @@ -383,15 +384,15 @@ def verify_kzg_proof_multi_impl(commitment: KZGCommitment,
#### `coset_for_cell`

```python
def coset_for_cell(cell_id: CellID) -> Cell:
def coset_for_cell(cell_id: CellID) -> Coset:
"""
Get the coset for a given ``cell_id``
"""
assert cell_id < CELLS_PER_EXT_BLOB
roots_of_unity_brp = bit_reversal_permutation(
compute_roots_of_unity(FIELD_ELEMENTS_PER_EXT_BLOB)
)
return CosetEvals(roots_of_unity_brp[FIELD_ELEMENTS_PER_CELL * cell_id:FIELD_ELEMENTS_PER_CELL * (cell_id + 1)])
return Coset(roots_of_unity_brp[FIELD_ELEMENTS_PER_CELL * cell_id:FIELD_ELEMENTS_PER_CELL * (cell_id + 1)])
```

## Cells
Expand Down

0 comments on commit bc607ec

Please sign in to comment.