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

@ -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

View File

@ -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()