sign blinded blob sidecars during builder API proposals (#5537)

This commit is contained in:
tersec 2023-10-28 05:10:23 +00:00 committed by GitHub
parent 48d7e62335
commit 34eade3a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -90,7 +90,7 @@ func compute_block_signing_root*(
func compute_blob_signing_root(
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
blob: BlobSidecar): Eth2Digest =
blob: BlindedBlobSidecar | BlobSidecar): Eth2Digest =
let
epoch = epoch(slot)
domain = get_domain(fork, DOMAIN_BLOB_SIDECAR, epoch,
@ -109,7 +109,8 @@ func get_block_signature*(
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/deneb/validator.md#constructing-the-signedblobsidecars
proc get_blob_sidecar_signature*(
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
blob: BlobSidecar, privkey: ValidatorPrivKey): CookedSig =
blob: BlindedBlobSidecar | BlobSidecar, privkey: ValidatorPrivKey):
CookedSig =
let signing_root = compute_blob_signing_root(
fork, genesis_validators_root, slot, blob)

View File

@ -761,9 +761,18 @@ proc blindedBlockCheckSlashingAndSign[
fork, genesis_validators_root, slot, blockRoot,
blindedBlockContents.signed_blinded_block.message)
if res.isErr():
return err("Unable to sign block: " & res.error())
return err("Unable to sign blinded block: " & res.error())
res.get()
for signedBlindedBlobSidecar in mitems(
blindedBlockContents.signed_blinded_blob_sidecars):
signedBlindedBlobSidecar.signature = validator.getBlobSignature(
fork, genesis_validators_root, slot,
signedBlindedBlobSidecar.message).valueOr:
warn "Unable to sign blinded blob",
reason = error()
return
return ok blindedBlockContents
proc getUnsignedBlindedBeaconBlock[

View File

@ -628,7 +628,8 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/deneb/validator.md#constructing-the-signedblobsidecars
proc getBlobSignature*(v: AttachedValidator, fork: Fork,
genesis_validators_root: Eth2Digest, slot: Slot,
blob: BlobSidecar): SignatureResult =
blob: BlindedBlobSidecar | BlobSidecar):
SignatureResult =
return
case v.kind
of ValidatorKind.Local: