Skip to content

Commit 6c12d0e

Browse files
committed
Add RowID, ColumnID custom types in crypto doc
1 parent 2cc7c87 commit 6c12d0e

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

specs/_features/eip7594/das-core.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ We define the following Python custom types for type hinting and readability:
4545
| `DataColumn` | `List[Cell, MAX_BLOBS_PER_BLOCK]` | The data of each column in EIP7594 |
4646
| `ExtendedMatrix` | `List[Cell, MAX_BLOBS_PER_BLOCK * NUMBER_OF_COLUMNS]` | The full data with blobs and one-dimensional erasure coding extension |
4747
| `FlatExtendedMatrix` | `List[BLSFieldElement, MAX_BLOBS_PER_BLOCK * FIELD_ELEMENTS_PER_BLOB * NUMBER_OF_COLUMNS]` | The flattened format of `ExtendedMatrix` |
48-
| `LineIndex` | `uint64` | The index of the rows or columns in `FlatExtendedMatrix` matrix |
4948

5049
## Configuration
5150

@@ -68,11 +67,10 @@ We define the following Python custom types for type hinting and readability:
6867
#### `get_custody_lines`
6968

7069
```python
71-
def get_custody_lines(node_id: NodeID, custody_size: uint64) -> Sequence[LineIndex]:
70+
def get_custody_lines(node_id: NodeID, custody_size: uint64) -> Sequence[ColumnIndex]:
7271
assert custody_size <= NUMBER_OF_COLUMNS
73-
all_items = list(range(NUMBER_OF_COLUMNS))
74-
line_index = node_id % NUMBER_OF_COLUMNS
75-
return [LineIndex(all_items[(line_index + i) % len(all_items)]) for i in range(custody_size)]
72+
column_index = node_id % NUMBER_OF_COLUMNS
73+
return [ColumnIndex((column_index + i) % NUMBER_OF_COLUMNS) for i in range(custody_size)]
7674
```
7775

7876
#### `compute_extended_data`

specs/_features/eip7594/p2p-interface.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- [Configuration](#configuration)
1414
- [Containers](#containers)
1515
- [`DataColumnSidecar`](#datacolumnsidecar)
16-
- [`DataColumnIdentifier`](#datacolumnidentifier)
16+
- [`DataColumnIndexentifier`](#dataColumnIndexentifier)
1717
- [Helpers](#helpers)
1818
- [`verify_data_column_sidecar_kzg_proof`](#verify_data_column_sidecar_kzg_proof)
1919
- [`verify_data_column_sidecar_inclusion_proof`](#verify_data_column_sidecar_inclusion_proof)
@@ -49,20 +49,20 @@
4949

5050
```python
5151
class DataColumnSidecar(Container):
52-
index: LineIndex # Index of column in extended matrix
52+
index: ColumnIndex # Index of column in extended matrix
5353
column: DataColumn
5454
kzg_commitments: List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK]
5555
kzg_proofs: List[KZGProof, MAX_BLOB_COMMITMENTS_PER_BLOCK]
5656
signed_block_header: SignedBeaconBlockHeader
5757
kzg_commitments_inclusion_proof: Vector[Bytes32, KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH]
5858
```
5959

60-
#### `DataColumnIdentifier`
60+
#### `DataColumnIndexentifier`
6161

6262
```python
63-
class DataColumnIdentifier(Container):
63+
class DataColumnIndexentifier(Container):
6464
block_root: Root
65-
index: LineIndex
65+
index: ColumnIndex
6666
```
6767

6868
### Helpers
@@ -74,14 +74,14 @@ def verify_data_column_sidecar_kzg_proof(sidecar: DataColumnSidecar) -> bool:
7474
"""
7575
Verify if the proofs are correct
7676
"""
77-
row_ids = [LineIndex(i) for i in range(len(sidecar.column))]
77+
row_ids = [RowIndex(i) for i in range(len(sidecar.column))]
7878
assert len(sidecar.column) == len(sidecar.kzg_commitments) == len(sidecar.kzg_proofs)
7979

8080
# KZG batch verifies that the cells match the corresponding commitments and proofs
8181
return verify_cell_proof_batch(
8282
row_commitments=sidecar.kzg_commitments,
83-
row_ids=row_ids, # all rows
84-
column_ids=[sidecar.index],
83+
row_indices=row_ids, # all rows
84+
column_indices=[sidecar.index],
8585
datas=sidecar.column,
8686
proofs=sidecar.kzg_proofs,
8787
)
@@ -107,7 +107,7 @@ def verify_data_column_sidecar_inclusion_proof(sidecar: DataColumnSidecar) -> bo
107107
##### `compute_subnet_for_data_column_sidecar`
108108

109109
```python
110-
def compute_subnet_for_data_column_sidecar(column_index: LineIndex) -> SubnetID:
110+
def compute_subnet_for_data_column_sidecar(column_index: ColumnIndex) -> SubnetID:
111111
return SubnetID(column_index % DATA_COLUMN_SIDECAR_SUBNET_COUNT)
112112
```
113113

@@ -167,7 +167,7 @@ Request Content:
167167

168168
```
169169
(
170-
DataColumnIdentifier
170+
DataColumnIndexentifier
171171
)
172172
```
173173

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Public functions MUST accept raw bytes as input and perform the required cryptog
6060
| `PolynomialCoeff` | `List[BLSFieldElement, 2 * FIELD_ELEMENTS_PER_BLOB]` | A polynomial in coefficient form |
6161
| `Cell` | `Vector[BLSFieldElement, FIELD_ELEMENTS_PER_CELL]` | The unit of blob data that can come with their own KZG proofs |
6262
| `CellID` | `uint64` | Cell identifier |
63+
| `RowIndex` | `uint64` | Row identifier |
64+
| `ColumnIndex` | `uint64` | Column identifier |
6365

6466
## Constants
6567

@@ -415,8 +417,8 @@ def verify_cell_proof(commitment: KZGCommitment,
415417

416418
```python
417419
def verify_cell_proof_batch(row_commitments: Sequence[KZGCommitment],
418-
row_ids: Sequence[int],
419-
column_ids: Sequence[int],
420+
row_indices: Sequence[RowIndex],
421+
column_indices: Sequence[ColumnIndex],
420422
cells: Sequence[Cell],
421423
proofs: Sequence[KZGProof]) -> bool:
422424
"""
@@ -432,11 +434,11 @@ def verify_cell_proof_batch(row_commitments: Sequence[KZGCommitment],
432434
"""
433435

434436
# Get commitments via row IDs
435-
commitments = [row_commitments[row_id] for row_id in row_ids]
437+
commitments = [row_commitments[row_index] for row_index in row_indices]
436438

437439
return all(
438-
verify_kzg_proof_multi_impl(commitment, coset_for_cell(column_id), cell, proof)
439-
for commitment, column_id, cell, proof in zip(commitments, column_ids, cells, proofs)
440+
verify_kzg_proof_multi_impl(commitment, coset_for_cell(column_index), cell, proof)
441+
for commitment, column_index, cell, proof in zip(commitments, column_indices, cells, proofs)
440442
)
441443
```
442444

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def test_verify_cell_proof_batch(spec):
5050

5151
assert spec.verify_cell_proof_batch(
5252
row_commitments=[commitment],
53-
row_ids=[0],
54-
column_ids=[0, 1],
53+
row_indices=[0],
54+
column_indices=[0, 1],
5555
cells=cells[0:1],
5656
proofs=proofs,
5757
)

0 commit comments

Comments
 (0)