From 93b043f88adb716fb2b1d523597f2f6e43d02b3d Mon Sep 17 00:00:00 2001 From: Agnish Ghosh Date: Tue, 27 Aug 2024 01:06:54 +0530 Subject: [PATCH] changed data column extraction logic during block proposals --- beacon_chain/spec/eip7594_helpers.nim | 6 ++++-- beacon_chain/validators/message_router.nim | 14 +++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/beacon_chain/spec/eip7594_helpers.nim b/beacon_chain/spec/eip7594_helpers.nim index a80837c3a..26c983274 100644 --- a/beacon_chain/spec/eip7594_helpers.nim +++ b/beacon_chain/spec/eip7594_helpers.nim @@ -240,8 +240,10 @@ proc compute_signed_block_header(signed_block: deneb.SignedBeaconBlock | ) # https://github.com/ethereum/consensus-specs/blob/bb8f3caafc92590cdcf2d14974adb602db9b5ca3/specs/_features/eip7594/das-core.md#get_data_column_sidecars -proc get_data_column_sidecars*(signed_block: deneb.TrustedSignedBeaconBlock | - electra.TrustedSignedBeaconBlock, +proc get_data_column_sidecars*(signed_block: deneb.TrustedSignedBeaconBlock | + deneb.SignedBeaconBlock | + electra.TrustedSignedBeaconBlock | + electra.SignedBeaconBlock, cellsAndProofs: seq[CellsAndProofs]): Result[seq[DataColumnSidecar], string] = # Given a signed block and the cells/proofs associated with each blob diff --git a/beacon_chain/validators/message_router.nim b/beacon_chain/validators/message_router.nim index 9add62d25..2424a7812 100644 --- a/beacon_chain/validators/message_router.nim +++ b/beacon_chain/validators/message_router.nim @@ -10,6 +10,7 @@ import stew/results, std/sequtils, + kzg4844/[kzg_ex], chronicles, metrics, ../spec/network, @@ -20,7 +21,7 @@ import block_processor], ../networking/eth2_network, ./activity_metrics, - ../spec/datatypes/deneb + ../spec/datatypes/[deneb, eip7594] from ../spec/state_transition_block import validate_blobs export eth2_processor, eth2_network @@ -172,10 +173,13 @@ proc routeSignedBeaconBlock*( debugEcho blobs.len debugEcho blobs.len if blobs.len != 0: - let cells_and_proofs = computeCellsAndProofs(blobs.mapIt(KzgBlob(bytes: it.blob))) - if not cells_and_proofs.isOk: - debug "Issue computing cells and proofs from blob payload" - let dataColumnsOpt = newClone get_data_column_sidecars(blck, cells_and_proofs) + var cp: seq[CellsAndProofs] + for i in 0 ..< blobs.len: + let cells_and_proofs = computeCellsAndKzgProofs(KzgBlob(bytes: blobs[i].blob)) + if not cells_and_proofs.isOk: + debug "Issue computing cells and proofs from blob payload" + cp.add(cells_and_proofs.get) + let dataColumnsOpt = newClone get_data_column_sidecars(blck, cp) if not dataColumnsOpt[].isOk: debug "Issue with computing data column from blob bundle" let data_columns = dataColumnsOpt[].get()