1717 - [ Custody setting] ( #custody-setting )
1818 - [ Containers] ( #containers )
1919 - [ ` DataColumnSidecar ` ] ( #datacolumnsidecar )
20+ - [ ` MatrixEntry ` ] ( #matrixentry )
2021 - [ Helper functions] ( #helper-functions )
2122 - [ ` get_custody_columns ` ] ( #get_custody_columns )
2223 - [ ` compute_extended_matrix ` ] ( #compute_extended_matrix )
@@ -53,12 +54,10 @@ The following values are (non-configurable) constants used throughout the specif
5354
5455## Custom types
5556
56- We define the following Python custom types for type hinting and readability:
57-
5857| Name | SSZ equivalent | Description |
5958| - | - | - |
60- | ` DataColumn ` | ` List[Cell, MAX_BLOB_COMMITMENTS_PER_BLOCK] ` | The data of each column in EIP-7594 |
61- | ` ExtendedMatrix ` | ` List[Cell, MAX_CELLS_IN_EXTENDED_MATRIX] ` | The full data of one-dimensional erasure coding extended blobs ( in row major format). |
59+ | ` RowIndex ` | ` uint64 ` | Row identifier in the matrix of cells |
60+ | ` ColumnIndex ` | ` uint64 ` | Column identifier in the matrix of cells |
6261
6362## Configuration
6463
@@ -79,7 +78,7 @@ We define the following Python custom types for type hinting and readability:
7978
8079| Name | Value | Description |
8180| - | - | - |
82- | ` SAMPLES_PER_SLOT ` | ` 8 ` | Number of ` DataColumn ` random samples a node queries per slot |
81+ | ` SAMPLES_PER_SLOT ` | ` 8 ` | Number of ` DataColumnSidecar ` random samples a node queries per slot |
8382| ` CUSTODY_REQUIREMENT ` | ` 1 ` | Minimum number of subnets an honest node custodies and serves samples from |
8483| ` TARGET_NUMBER_OF_PEERS ` | ` 70 ` | Suggested minimum peer count |
8584
@@ -90,13 +89,23 @@ We define the following Python custom types for type hinting and readability:
9089``` python
9190class DataColumnSidecar (Container ):
9291 index: ColumnIndex # Index of column in extended matrix
93- column: DataColumn
92+ column: List[Cell, MAX_BLOB_COMMITMENTS_PER_BLOCK ]
9493 kzg_commitments: List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK ]
9594 kzg_proofs: List[KZGProof, MAX_BLOB_COMMITMENTS_PER_BLOCK ]
9695 signed_block_header: SignedBeaconBlockHeader
9796 kzg_commitments_inclusion_proof: Vector[Bytes32, KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH ]
9897```
9998
99+ #### ` MatrixEntry `
100+
101+ ``` python
102+ class MatrixEntry (Container ):
103+ cell: Cell
104+ kzg_proof: KZGProof
105+ column_index: ColumnIndex
106+ row_index: RowIndex
107+ ```
108+
100109### Helper functions
101110
102111#### ` get_custody_columns `
@@ -132,37 +141,52 @@ def get_custody_columns(node_id: NodeID, custody_subnet_count: uint64) -> Sequen
132141#### ` compute_extended_matrix `
133142
134143``` python
135- def compute_extended_matrix (blobs : Sequence[Blob]) -> ExtendedMatrix :
144+ def compute_extended_matrix (blobs : Sequence[Blob]) -> List[MatrixEntry, MAX_CELLS_IN_EXTENDED_MATRIX ] :
136145 """
137146 Return the full ``ExtendedMatrix``.
138147
139148 This helper demonstrates the relationship between blobs and ``ExtendedMatrix``.
140149 The data structure for storing cells is implementation-dependent.
141150 """
142151 extended_matrix = []
143- for blob in blobs:
144- extended_matrix.extend(compute_cells(blob))
145- return ExtendedMatrix(extended_matrix)
152+ for blob_index, blob in enumerate (blobs):
153+ cells, proofs = compute_cells_and_kzg_proofs(blob)
154+ for cell_id, (cell, proof) in enumerate (zip (cells, proofs)):
155+ extended_matrix.append(MatrixEntry(
156+ cell = cell,
157+ kzg_proof = proof,
158+ row_index = blob_index,
159+ column_index = cell_id,
160+ ))
161+ return extended_matrix
146162```
147163
148164#### ` recover_matrix `
149165
150166``` python
151- def recover_matrix (cells_dict : Dict[Tuple[BlobIndex, CellID], Cell], blob_count : uint64) -> ExtendedMatrix:
167+ def recover_matrix (partial_matrix : Sequence[MatrixEntry],
168+ blob_count : uint64) -> List[MatrixEntry, MAX_CELLS_IN_EXTENDED_MATRIX ]:
152169 """
153- Return the recovered ``ExtendedMatrix`` .
170+ Return the recovered extended matrix .
154171
155- This helper demonstrates how to apply ``recover_all_cells ``.
172+ This helper demonstrates how to apply ``recover_cells_and_kzg_proofs ``.
156173 The data structure for storing cells is implementation-dependent.
157174 """
158- extended_matrix: List[Cell] = []
175+ extended_matrix = []
159176 for blob_index in range (blob_count):
160- cell_ids = [cell_id for b_index, cell_id in cells_dict.keys() if b_index == blob_index]
161- cells = [cells_dict[(BlobIndex(blob_index), cell_id)] for cell_id in cell_ids]
162-
163- all_cells_for_row = recover_all_cells(cell_ids, cells)
164- extended_matrix.extend(all_cells_for_row)
165- return ExtendedMatrix(extended_matrix)
177+ cell_ids = [e.column_index for e in partial_matrix if e.row_index == blob_index]
178+ cells = [e.cell for e in partial_matrix if e.row_index == blob_index]
179+ proofs = [e.kzg_proof for e in partial_matrix if e.row_index == blob_index]
180+
181+ recovered_cells, recovered_proofs = recover_cells_and_kzg_proofs(cell_ids, cells, proofs)
182+ for cell_id, (cell, proof) in enumerate (zip (recovered_cells, recovered_proofs)):
183+ extended_matrix.append(MatrixEntry(
184+ cell = cell,
185+ kzg_proof = proof,
186+ row_index = blob_index,
187+ column_index = cell_id,
188+ ))
189+ return extended_matrix
166190```
167191
168192#### ` get_data_column_sidecars `
@@ -182,15 +206,15 @@ def get_data_column_sidecars(signed_block: SignedBeaconBlock,
182206 proofs = [cells_and_proofs[i][1 ] for i in range (blob_count)]
183207 sidecars = []
184208 for column_index in range (NUMBER_OF_COLUMNS ):
185- column = DataColumn( [cells[row_index][column_index]
186- for row_index in range (blob_count)])
187- kzg_proof_of_column = [proofs[row_index][column_index]
188- for row_index in range (blob_count)]
209+ column_cells = [cells[row_index][column_index]
210+ for row_index in range (blob_count)]
211+ column_proofs = [proofs[row_index][column_index]
212+ for row_index in range (blob_count)]
189213 sidecars.append(DataColumnSidecar(
190214 index = column_index,
191- column = column ,
215+ column = column_cells ,
192216 kzg_commitments = block.body.blob_kzg_commitments,
193- kzg_proofs = kzg_proof_of_column ,
217+ kzg_proofs = column_proofs ,
194218 signed_block_header = signed_block_header,
195219 kzg_commitments_inclusion_proof = kzg_commitments_inclusion_proof,
196220 ))
@@ -283,7 +307,7 @@ Such trailing techniques and their analysis will be valuable for any DAS constru
283307
284308### Row (blob) custody
285309
286- In the one-dimension construction, a node samples the peers by requesting the whole ` DataColumn ` . In reconstruction, a node can reconstruct all the blobs by 50% of the columns. Note that nodes can still download the row via ` blob_sidecar_{subnet_id} ` subnets.
310+ In the one-dimension construction, a node samples the peers by requesting the whole ` DataColumnSidecar ` . In reconstruction, a node can reconstruct all the blobs by 50% of the columns. Note that nodes can still download the row via ` blob_sidecar_{subnet_id} ` subnets.
287311
288312The potential benefits of having row custody could include:
289313
0 commit comments