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"
|
raiseAssert "preferredContentType() returns invalid content type"
|
||||||
|
|
||||||
# https://ethereum.github.io/beacon-APIs/#/Validator/produceBlindedBlock
|
# 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 (
|
router.api(MethodGet, "/eth/v1/validator/blinded_blocks/{slot}") do (
|
||||||
slot: Slot, randao_reveal: Option[ValidatorSig],
|
slot: Slot, randao_reveal: Option[ValidatorSig],
|
||||||
graffiti: Option[GraffitiBytes],
|
graffiti: Option[GraffitiBytes],
|
||||||
|
|
|
@ -661,9 +661,12 @@ proc constructSignableBlindedBlock[T: deneb_mev.SignedBlindedBeaconBlock](
|
||||||
|
|
||||||
blindedBlock
|
blindedBlock
|
||||||
|
|
||||||
func constructPlainBlindedBlock[
|
func constructPlainBlindedBlock[T: capella_mev.BlindedBeaconBlock](
|
||||||
T: capella_mev.BlindedBeaconBlock, EPH: capella.ExecutionPayloadHeader](
|
blck: ForkyBeaconBlock,
|
||||||
blck: ForkyBeaconBlock, executionPayloadHeader: EPH): T =
|
executionPayloadHeader: capella.ExecutionPayloadHeader): T =
|
||||||
|
# https://github.com/nim-lang/Nim/issues/23020 workaround
|
||||||
|
static: doAssert T is capella_mev.BlindedBeaconBlock
|
||||||
|
|
||||||
const
|
const
|
||||||
blckFields = getFieldNames(typeof(blck))
|
blckFields = getFieldNames(typeof(blck))
|
||||||
blckBodyFields = getFieldNames(typeof(blck.body))
|
blckBodyFields = getFieldNames(typeof(blck.body))
|
||||||
|
@ -677,6 +680,25 @@ func constructPlainBlindedBlock[
|
||||||
|
|
||||||
blindedBlock
|
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[
|
proc blindedBlockCheckSlashingAndSign[
|
||||||
T:
|
T:
|
||||||
capella_mev.SignedBlindedBeaconBlock |
|
capella_mev.SignedBlindedBeaconBlock |
|
||||||
|
@ -938,10 +960,10 @@ proc makeBlindedBeaconBlockForHeadAndSlot*[BBB: ForkyBlindedBeaconBlock](
|
||||||
withBlck(forkedBlck):
|
withBlck(forkedBlck):
|
||||||
when consensusFork >= ConsensusFork.Capella:
|
when consensusFork >= ConsensusFork.Capella:
|
||||||
when ((consensusFork == ConsensusFork.Deneb and
|
when ((consensusFork == ConsensusFork.Deneb and
|
||||||
EPH is deneb.ExecutionPayloadHeader) or
|
EPH is deneb_mev.BlindedExecutionPayloadAndBlobsBundle) or
|
||||||
(consensusFork == ConsensusFork.Capella and
|
(consensusFork == ConsensusFork.Capella and
|
||||||
EPH is capella.ExecutionPayloadHeader)):
|
EPH is capella.ExecutionPayloadHeader)):
|
||||||
return ok (constructPlainBlindedBlock[BBB, EPH](
|
return ok (constructPlainBlindedBlock[BBB](
|
||||||
forkyBlck, executionPayloadHeader), bidValue)
|
forkyBlck, executionPayloadHeader), bidValue)
|
||||||
else:
|
else:
|
||||||
return err("makeBlindedBeaconBlockForHeadAndSlot: mismatched block/payload types")
|
return err("makeBlindedBeaconBlockForHeadAndSlot: mismatched block/payload types")
|
||||||
|
|
Loading…
Reference in New Issue