@@ -195,27 +195,31 @@ def recover_matrix(partial_matrix: Sequence[MatrixEntry],
195195
196196``` python
197197def get_data_column_sidecars (signed_block : SignedBeaconBlock,
198- blobs : Sequence[Blob]) -> Sequence[DataColumnSidecar]:
198+ cells_and_kzg_proofs : Sequence[Tuple[
199+ Vector[Cell, CELLS_PER_EXT_BLOB ],
200+ Vector[KZGProof, CELLS_PER_EXT_BLOB ]]]) -> Sequence[DataColumnSidecar]:
201+ """
202+ Given a signed block and the cells/proofs associated with each blob in the
203+ block, assemble the sidecars which can be distributed to peers.
204+ """
205+ blob_kzg_commitments = signed_block.message.body.blob_kzg_commitments
206+ assert len (cells_and_kzg_proofs) == len (blob_kzg_commitments)
199207 signed_block_header = compute_signed_block_header(signed_block)
200- block = signed_block.message
201208 kzg_commitments_inclusion_proof = compute_merkle_proof(
202- block .body,
209+ signed_block.message .body,
203210 get_generalized_index(BeaconBlockBody, ' blob_kzg_commitments' ),
204211 )
205- cells_and_proofs = [compute_cells_and_kzg_proofs(blob) for blob in blobs]
206- blob_count = len (blobs)
207- cells = [cells_and_proofs[i][0 ] for i in range (blob_count)]
208- proofs = [cells_and_proofs[i][1 ] for i in range (blob_count)]
212+
209213 sidecars = []
210214 for column_index in range (NUMBER_OF_COLUMNS ):
211- column_cells = [cells[row_index][column_index ]
212- for row_index in range (blob_count)]
213- column_proofs = [proofs[row_index][ column_index]
214- for row_index in range (blob_count)]
215+ column_cells, column_proofs = [], [ ]
216+ for cells, proofs in cells_and_kzg_proofs:
217+ column_cells.append(cells[ column_index])
218+ column_proofs.append(proofs[column_index])
215219 sidecars.append(DataColumnSidecar(
216220 index = column_index,
217221 column = column_cells,
218- kzg_commitments = block.body. blob_kzg_commitments,
222+ kzg_commitments = blob_kzg_commitments,
219223 kzg_proofs = column_proofs,
220224 signed_block_header = signed_block_header,
221225 kzg_commitments_inclusion_proof = kzg_commitments_inclusion_proof,
0 commit comments