diff --git a/beacon_chain/gossip_processing/block_processor.nim b/beacon_chain/gossip_processing/block_processor.nim index a03d8cc84..8fdd7460e 100644 --- a/beacon_chain/gossip_processing/block_processor.nim +++ b/beacon_chain/gossip_processing/block_processor.nim @@ -879,7 +879,8 @@ proc addBlock*( # - RequestManager (missing ancestor blocks) # - API let resfut = newFuture[Result[void, VerifierError]]("BlockProcessor.addBlock") - enqueueBlock(self, src, blck, blobs, data_columns, resfut, maybeFinalized, validationDur) + enqueueBlock(self, src, blck, blobs, data_columns, + resfut, maybeFinalized, validationDur) resfut # Event Loop @@ -900,8 +901,9 @@ proc processBlock( let res = withBlck(entry.blck): await self.storeBlock( - entry.src, wallTime, forkyBlck, entry.blobs, entry.data_columns, entry.maybeFinalized, - entry.queueTick, entry.validationDur) + entry.src, wallTime, forkyBlck, + entry.blobs, entry.data_columns, + entry.maybeFinalized, entry.queueTick, entry.validationDur) if res.isErr and res.error[1] == ProcessingStatus.notCompleted: # When an execution engine returns an error or fails to respond to a @@ -912,8 +914,9 @@ proc processBlock( # https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/sync/optimistic.md#execution-engine-errors await sleepAsync(chronos.seconds(1)) self[].enqueueBlock( - entry.src, entry.blck, entry.blobs, entry.data_columns, entry.resfut, entry.maybeFinalized, - entry.validationDur) + entry.src, entry.blck, entry.blobs, + entry.data_columns, entry.resfut, + entry.maybeFinalized, entry.validationDur) # To ensure backpressure on the sync manager, do not complete these futures. return diff --git a/beacon_chain/spec/eip7594_helpers.nim b/beacon_chain/spec/eip7594_helpers.nim index 4fd691541..be4738840 100644 --- a/beacon_chain/spec/eip7594_helpers.nim +++ b/beacon_chain/spec/eip7594_helpers.nim @@ -36,7 +36,9 @@ proc sortedColumnIndices*(columnsPerSubnet: ColumnIndex, subnetIds: HashSet[uint res.sort() res -proc get_custody_column_subnet*(node_id: NodeId, custody_subnet_count: uint64): Result[HashSet[uint64], cstring] = +proc get_custody_column_subnet*(node_id: NodeId, + custody_subnet_count: uint64): + Result[HashSet[uint64], cstring] = # fetches the subnets for custody column for the current node # assert custody_subnet_count <= DATA_COLUMN_SIDECAR_SUBNET_COUNT if not (custody_subnet_count <= DATA_COLUMN_SIDECAR_SUBNET_COUNT): @@ -69,7 +71,9 @@ proc get_custody_column_subnet*(node_id: NodeId, custody_subnet_count: uint64): ok(subnet_ids) # https://github.com/ethereum/consensus-specs/blob/5f48840f4d768bf0e0a8156a3ed06ec333589007/specs/_features/eip7594/das-core.md#get_custody_columns -proc get_custody_columns*(node_id: NodeId, custody_subnet_count: uint64): Result[seq[ColumnIndex], cstring] = +proc get_custody_columns*(node_id: NodeId, + custody_subnet_count: uint64): + Result[seq[ColumnIndex], cstring] = let subnet_ids = get_custody_column_subnet(node_id, custody_subnet_count).get @@ -94,7 +98,9 @@ proc compute_extended_matrix* (blobs: seq[KzgBlob]): Result[ExtendedMatrix, cstr ok(extended_matrix) # https://github.com/ethereum/consensus-specs/blob/5f48840f4d768bf0e0a8156a3ed06ec333589007/specs/_features/eip7594/das-core.md#recover_matrix -proc recover_matrix*(cells_dict: Table[(BlobIndex, CellID), Cell], blobCount: uint64): Result[ExtendedMatrix, cstring] = +proc recover_matrix*(cells_dict: Table[(BlobIndex, CellID), Cell], + blobCount: uint64): + Result[ExtendedMatrix, cstring] = # This helper demonstrates how to apply recover_all_cells # The data structure for storing cells is implementation-dependent @@ -128,7 +134,9 @@ proc recover_matrix*(cells_dict: Table[(BlobIndex, CellID), Cell], blobCount: ui ok(extended_matrix) -proc recover_matrix*(partial_matrix: seq[MatrixEntry], blobCount: int): Result[seq[MatrixEntry], cstring] = +proc recover_matrix*(partial_matrix: seq[MatrixEntry], + blobCount: int): + Result[seq[MatrixEntry], cstring] = # This helper demonstrates how to apply recover_cells_and_kzg_proofs # The data structure for storing cells is implementation-dependent @@ -222,7 +230,6 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock | var blck = signed_block.message signed_beacon_block_header = compute_signed_block_header(signed_block) - cellsAndProofs: seq[KzgCellsAndKzgProofs] kzg_incl_proof: array[4, Eth2Digest] var sidecars = newSeqOfCap[DataColumnSidecar](CELLS_PER_EXT_BLOB) @@ -231,27 +238,46 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock | debugEcho "Checkpoint 3" return ok(sidecars) - for blob in blobs: - let - cell_and_proof = computeCellsAndProofs(blob) - debugEcho "Checkpoint 4" - if cell_and_proof.isErr(): - return err("EIP7549: Could not compute cells") - - - cellsAndProofs.add(cell_and_proof.get()) - debugEcho "Checkpoint 5" - let blobCount = blobs.len var cells = newSeqOfCap[CellBytes](blobs.len) proofs = newSeqOfCap[ProofBytes](blobs.len) - for i in 0..