Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion beacon_chain/gossip_processing/block_processor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import
chronicles, chronos, metrics,
kzg4844/kzg,
../spec/[forks, helpers_el, signatures, signatures_batch, peerdas_helpers],
../sszdump

Expand Down Expand Up @@ -207,7 +208,7 @@ proc verifySidecars(
let kzgCommits = signedBlock.message.body.blob_kzg_commitments.asSeq
if blobs.len > 0 or kzgCommits.len > 0:
let r = validate_blobs(
kzgCommits, blobs.mapIt(KzgBlob(bytes: it.blob)), blobs.mapIt(it.kzg_proof)
kzgCommits, blobs.mapIt(kzg.KzgBlob(bytes: it.blob)), blobs.mapIt(it.kzg_proof)
)
if r.isErr():
debug "blob validation failed",
Expand Down
10 changes: 4 additions & 6 deletions beacon_chain/rpc/rest_beacon_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1053,20 +1053,19 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
await node.router.routeSignedBeaconBlock(
forkyBlck, Opt.some(
forkyBlck.create_blob_sidecars(kzg_proofs, blobs)),
Opt.none(seq[fulu.DataColumnSidecar]),
checkValidator = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not overload routeSignedBeaconBlock too?

elif consensusFork >= ConsensusFork.Fulu:
let data_columns = assemble_data_column_sidecars(
forkyBlck, blobs.mapIt(kzg.KzgBlob(bytes: it)),
@(kzg_proofs.mapIt(kzg.KzgProof(it))))
await node.router.routeSignedBeaconBlock(
forkyBlck, Opt.none(seq[BlobSidecar]),
forkyBlck,
Opt.some(data_columns),
checkValidator = true)
else:
await node.router.routeSignedBeaconBlock(
forkyBlck, Opt.none(seq[BlobSidecar]),
Opt.none(seq[fulu.DataColumnSidecar]),
forkyBlck,
noSidecarsAtFork,
checkValidator = true)

if res.isErr():
Expand Down Expand Up @@ -1200,8 +1199,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
let res = withBlck(forked):
forkyBlck.root = hash_tree_root(forkyBlck.message)
await node.router.routeSignedBeaconBlock(
forkyBlck, Opt.none(seq[BlobSidecar]),
Opt.none(seq[fulu.DataColumnSidecar]), checkValidator = true)
forkyBlck, noSidecarsAtFork, checkValidator = true)

if res.isErr():
return RestApiResponse.jsonError(
Expand Down
33 changes: 16 additions & 17 deletions beacon_chain/validators/beacon_validators.nim
Original file line number Diff line number Diff line change
Expand Up @@ -574,25 +574,24 @@ proc proposeBlockAux(
message: engineBlock.blck, signature: signature, root: blockRoot
)

blobsOpt =
when consensusFork in [ConsensusFork.Deneb, ConsensusFork.Electra]:
Opt.some(
signedBlock.create_blob_sidecars(
engineBlock.blobsBundle.proofs,
engineBlock.blobsBundle.blobs))
else:
Opt.none(seq[BlobSidecar])
when consensusFork in [ConsensusFork.Deneb, ConsensusFork.Electra]:
let sidecarsOpt =
Opt.some(
signedBlock.create_blob_sidecars(
engineBlock.blobsBundle.proofs,
engineBlock.blobsBundle.blobs))
elif consensusFork >= ConsensusFork.Fulu:
let sidecarsOpt =
Opt.some(signedBlock.assemble_data_column_sidecars(
engineBlock.blobsBundle.blobs.mapIt(kzg.KzgBlob(bytes: it)),
@(engineBlock.blobsBundle.proofs.mapIt(kzg.KzgProof(it)))))
else:
const sidecarsOpt = noSidecarsAtFork

columnsOpt =
when consensusFork >= ConsensusFork.Fulu:
Opt.some(signedBlock.assemble_data_column_sidecars(
engineBlock.blobsBundle.blobs.mapIt(kzg.KzgBlob(bytes: it)),
@(engineBlock.blobsBundle.proofs.mapIt(kzg.KzgProof(it)))))
else:
Opt.none(seq[fulu.DataColumnSidecar])
let
newBlockRef = await(
node.router.routeSignedBeaconBlock(signedBlock, blobsOpt,
columnsOpt, checkValidator = false)
node.router.routeSignedBeaconBlock(signedBlock, sidecarsOpt,
checkValidator = false)
).valueOr:
# TODO Is this an error?
beacon_block_production_errors.inc()
Expand Down
Loading
Loading