fill blindedblockbody KZG commitments from deneb blinded header (#5550)

This commit is contained in:
tersec 2023-11-01 14:00:21 +01:00 committed by GitHub
parent ed446b1d5a
commit 657de2721a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -107,7 +107,7 @@ type
executionPayload*: ExecutionPayload
blockValue*: Wei
kzgs*: KzgCommitments
proofs*:seq[KZGProof]
proofs*: seq[KZGProof]
blobs*: Blobs
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/beacon-chain.md#executionpayloadheader

View File

@ -619,6 +619,7 @@ from ./message_router_mev import
func constructSignableBlindedBlock[T: capella_mev.SignedBlindedBeaconBlock](
blck: capella.BeaconBlock,
executionPayloadHeader: capella.ExecutionPayloadHeader): T =
# Leaves signature field default, to be filled in by caller
const
blckFields = getFieldNames(typeof(blck))
blckBodyFields = getFieldNames(typeof(blck.body))
@ -659,12 +660,16 @@ proc constructSignableBlindedBlock[T: deneb_mev.SignedBlindedBeaconBlockContents
doAssert bbb.proofs.len == bbb.blob_roots.len
doAssert bbb.proofs.len == bbb.commitments.len
assign(blindedBlock.message.body.blob_kzg_commitments, bbb.commitments)
let blockRoot = hash_tree_root(blindedBlock.message)
if blindedBlockContents.signed_blinded_blob_sidecars.setLen(bbb.proofs.len):
for i in 0 ..< blindedBlockContents.signed_blinded_blob_sidecars.lenu64:
assign(
blindedBlockContents.signed_blinded_blob_sidecars[i],
deneb_mev.SignedBlindedBlobSidecar(message: deneb_mev.BlindedBlobSidecar(
block_root: hash_tree_root(blck),
block_root: blockRoot,
index: i,
slot: distinctBase(blck.slot),
block_parent_root: blck.parent_root,