Update to current (deprecated, but) version of produceBlindedBlock (#5639)
This commit is contained in:
parent
2fc43c9ba7
commit
144d453f4a
|
@ -423,7 +423,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
|||
raiseAssert "preferredContentType() returns invalid content type"
|
||||
|
||||
# https://ethereum.github.io/beacon-APIs/#/Validator/produceBlindedBlock
|
||||
# https://github.com/ethereum/beacon-APIs/blob/v2.4.0/apis/validator/blinded_block.yaml
|
||||
# https://github.com/ethereum/beacon-APIs/blob/c097f1a62c9a12c30e8175a39f205f92d3b931a9/apis/validator/blinded_block.yaml
|
||||
router.api(MethodGet, "/eth/v1/validator/blinded_blocks/{slot}") do (
|
||||
slot: Slot, randao_reveal: Option[ValidatorSig],
|
||||
graffiti: Option[GraffitiBytes],
|
||||
|
|
|
@ -661,9 +661,12 @@ proc constructSignableBlindedBlock[T: deneb_mev.SignedBlindedBeaconBlock](
|
|||
|
||||
blindedBlock
|
||||
|
||||
func constructPlainBlindedBlock[
|
||||
T: capella_mev.BlindedBeaconBlock, EPH: capella.ExecutionPayloadHeader](
|
||||
blck: ForkyBeaconBlock, executionPayloadHeader: EPH): T =
|
||||
func constructPlainBlindedBlock[T: capella_mev.BlindedBeaconBlock](
|
||||
blck: ForkyBeaconBlock,
|
||||
executionPayloadHeader: capella.ExecutionPayloadHeader): T =
|
||||
# https://github.com/nim-lang/Nim/issues/23020 workaround
|
||||
static: doAssert T is capella_mev.BlindedBeaconBlock
|
||||
|
||||
const
|
||||
blckFields = getFieldNames(typeof(blck))
|
||||
blckBodyFields = getFieldNames(typeof(blck.body))
|
||||
|
@ -677,6 +680,25 @@ func constructPlainBlindedBlock[
|
|||
|
||||
blindedBlock
|
||||
|
||||
func constructPlainBlindedBlock[T: deneb_mev.BlindedBeaconBlock](
|
||||
blck: ForkyBeaconBlock,
|
||||
executionPayloadHeader: deneb_mev.BlindedExecutionPayloadAndBlobsBundle): T =
|
||||
# https://github.com/nim-lang/Nim/issues/23020 workaround
|
||||
static: doAssert T is deneb_mev.BlindedBeaconBlock
|
||||
|
||||
const
|
||||
blckFields = getFieldNames(typeof(blck))
|
||||
blckBodyFields = getFieldNames(typeof(blck.body))
|
||||
|
||||
var blindedBlock: T
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#block-proposal
|
||||
copyFields(blindedBlock, blck, blckFields)
|
||||
copyFields(blindedBlock.body, blck.body, blckBodyFields)
|
||||
assign(blindedBlock.body.execution_payload_header, executionPayloadHeader.execution_payload_header)
|
||||
|
||||
blindedBlock
|
||||
|
||||
proc blindedBlockCheckSlashingAndSign[
|
||||
T:
|
||||
capella_mev.SignedBlindedBeaconBlock |
|
||||
|
@ -938,10 +960,10 @@ proc makeBlindedBeaconBlockForHeadAndSlot*[BBB: ForkyBlindedBeaconBlock](
|
|||
withBlck(forkedBlck):
|
||||
when consensusFork >= ConsensusFork.Capella:
|
||||
when ((consensusFork == ConsensusFork.Deneb and
|
||||
EPH is deneb.ExecutionPayloadHeader) or
|
||||
EPH is deneb_mev.BlindedExecutionPayloadAndBlobsBundle) or
|
||||
(consensusFork == ConsensusFork.Capella and
|
||||
EPH is capella.ExecutionPayloadHeader)):
|
||||
return ok (constructPlainBlindedBlock[BBB, EPH](
|
||||
return ok (constructPlainBlindedBlock[BBB](
|
||||
forkyBlck, executionPayloadHeader), bidValue)
|
||||
else:
|
||||
return err("makeBlindedBeaconBlockForHeadAndSlot: mismatched block/payload types")
|
||||
|
|
Loading…
Reference in New Issue