changed data column extraction logic during block proposals

This commit is contained in:
Agnish Ghosh 2024-08-27 01:06:54 +05:30
parent e9c7a758a0
commit 93b043f88a
2 changed files with 13 additions and 7 deletions

View File

@ -241,7 +241,9 @@ 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 # 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 | proc get_data_column_sidecars*(signed_block: deneb.TrustedSignedBeaconBlock |
electra.TrustedSignedBeaconBlock, deneb.SignedBeaconBlock |
electra.TrustedSignedBeaconBlock |
electra.SignedBeaconBlock,
cellsAndProofs: seq[CellsAndProofs]): cellsAndProofs: seq[CellsAndProofs]):
Result[seq[DataColumnSidecar], string] = Result[seq[DataColumnSidecar], string] =
# Given a signed block and the cells/proofs associated with each blob # Given a signed block and the cells/proofs associated with each blob

View File

@ -10,6 +10,7 @@
import import
stew/results, stew/results,
std/sequtils, std/sequtils,
kzg4844/[kzg_ex],
chronicles, chronicles,
metrics, metrics,
../spec/network, ../spec/network,
@ -20,7 +21,7 @@ import
block_processor], block_processor],
../networking/eth2_network, ../networking/eth2_network,
./activity_metrics, ./activity_metrics,
../spec/datatypes/deneb ../spec/datatypes/[deneb, eip7594]
from ../spec/state_transition_block import validate_blobs from ../spec/state_transition_block import validate_blobs
export eth2_processor, eth2_network export eth2_processor, eth2_network
@ -172,10 +173,13 @@ proc routeSignedBeaconBlock*(
debugEcho blobs.len debugEcho blobs.len
debugEcho blobs.len debugEcho blobs.len
if blobs.len != 0: if blobs.len != 0:
let cells_and_proofs = computeCellsAndProofs(blobs.mapIt(KzgBlob(bytes: it.blob))) 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: if not cells_and_proofs.isOk:
debug "Issue computing cells and proofs from blob payload" debug "Issue computing cells and proofs from blob payload"
let dataColumnsOpt = newClone get_data_column_sidecars(blck, cells_and_proofs) cp.add(cells_and_proofs.get)
let dataColumnsOpt = newClone get_data_column_sidecars(blck, cp)
if not dataColumnsOpt[].isOk: if not dataColumnsOpt[].isOk:
debug "Issue with computing data column from blob bundle" debug "Issue with computing data column from blob bundle"
let data_columns = dataColumnsOpt[].get() let data_columns = dataColumnsOpt[].get()