remove more Bellatrix-only Builder API support infrastructure (#5251)
This commit is contained in:
parent
4cf1a7e791
commit
d542410a17
|
@ -559,12 +559,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
return RestApiResponse.jsonError(Http400, res.error())
|
return RestApiResponse.jsonError(Http400, res.error())
|
||||||
return responseVersioned(res.get().blindedBlckPart, contextFork)
|
return responseVersioned(res.get().blindedBlckPart, contextFork)
|
||||||
of ConsensusFork.Bellatrix:
|
of ConsensusFork.Bellatrix:
|
||||||
let res = await makeBlindedBeaconBlockForHeadAndSlot[
|
return RestApiResponse.jsonError(Http400, "Pre-Capella builder API unsupported")
|
||||||
bellatrix_mev.BlindedBeaconBlock](
|
|
||||||
node, payloadBuilderClient, qrandao, proposer, qgraffiti, qhead, qslot)
|
|
||||||
if res.isErr():
|
|
||||||
return RestApiResponse.jsonError(Http400, res.error())
|
|
||||||
return responseVersioned(res.get().blindedBlckPart, contextFork)
|
|
||||||
of ConsensusFork.Altair, ConsensusFork.Phase0:
|
of ConsensusFork.Altair, ConsensusFork.Phase0:
|
||||||
# Pre-Bellatrix, this endpoint will return a BeaconBlock
|
# Pre-Bellatrix, this endpoint will return a BeaconBlock
|
||||||
let res = await makeBeaconBlockForHeadAndSlot(
|
let res = await makeBeaconBlockForHeadAndSlot(
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
# Copyright (c) 2022-2023 Status Research & Development GmbH
|
|
||||||
# Licensed and distributed under either of
|
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
||||||
|
|
||||||
{.push raises: [].}
|
|
||||||
|
|
||||||
import
|
|
||||||
chronos, presto/client,
|
|
||||||
".."/eth2_apis/[rest_types, eth2_rest_serialization]
|
|
||||||
|
|
||||||
export chronos, client, rest_types, eth2_rest_serialization
|
|
||||||
|
|
||||||
proc registerValidator*(body: seq[SignedValidatorRegistrationV1]
|
|
||||||
): RestPlainResponse {.
|
|
||||||
rest, endpoint: "/eth/v1/builder/validators",
|
|
||||||
meth: MethodPost, connection: {Dedicated, Close}.}
|
|
||||||
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/validators.yaml
|
|
||||||
## https://github.com/ethereum/beacon-APIs/blob/v2.3.0/apis/validator/register_validator.yaml
|
|
||||||
|
|
||||||
proc getHeaderBellatrix*(slot: Slot,
|
|
||||||
parent_hash: Eth2Digest,
|
|
||||||
pubkey: ValidatorPubKey
|
|
||||||
): RestResponse[GetHeaderResponseBellatrix] {.
|
|
||||||
rest, endpoint: "/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}",
|
|
||||||
meth: MethodGet, connection: {Dedicated, Close}.}
|
|
||||||
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/header.yaml
|
|
||||||
|
|
||||||
proc submitBlindedBlock*(body: bellatrix_mev.SignedBlindedBeaconBlock
|
|
||||||
): RestResponse[SubmitBlindedBlockResponseBellatrix] {.
|
|
||||||
rest, endpoint: "/eth/v1/builder/blinded_blocks",
|
|
||||||
meth: MethodPost, connection: {Dedicated, Close}.}
|
|
||||||
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/blinded_blocks.yaml
|
|
||||||
|
|
||||||
proc checkBuilderStatus*(): RestPlainResponse {.
|
|
||||||
rest, endpoint: "/eth/v1/builder/status",
|
|
||||||
meth: MethodGet, connection: {Dedicated, Close}.}
|
|
||||||
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/status.yaml
|
|
|
@ -12,6 +12,18 @@ import
|
||||||
|
|
||||||
export chronos, client, rest_types, eth2_rest_serialization
|
export chronos, client, rest_types, eth2_rest_serialization
|
||||||
|
|
||||||
|
proc registerValidator*(body: seq[SignedValidatorRegistrationV1]
|
||||||
|
): RestPlainResponse {.
|
||||||
|
rest, endpoint: "/eth/v1/builder/validators",
|
||||||
|
meth: MethodPost, connection: {Dedicated, Close}.}
|
||||||
|
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/validators.yaml
|
||||||
|
## https://github.com/ethereum/beacon-APIs/blob/v2.3.0/apis/validator/register_validator.yaml
|
||||||
|
|
||||||
|
proc checkBuilderStatus*(): RestPlainResponse {.
|
||||||
|
rest, endpoint: "/eth/v1/builder/status",
|
||||||
|
meth: MethodGet, connection: {Dedicated, Close}.}
|
||||||
|
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/status.yaml
|
||||||
|
|
||||||
proc getHeaderCapella*(slot: Slot,
|
proc getHeaderCapella*(slot: Slot,
|
||||||
parent_hash: Eth2Digest,
|
parent_hash: Eth2Digest,
|
||||||
pubkey: ValidatorPubKey
|
pubkey: ValidatorPubKey
|
||||||
|
|
|
@ -13,7 +13,6 @@ import ../beacon_node
|
||||||
|
|
||||||
from eth/async_utils import awaitWithTimeout
|
from eth/async_utils import awaitWithTimeout
|
||||||
from ../spec/datatypes/bellatrix import SignedBeaconBlock
|
from ../spec/datatypes/bellatrix import SignedBeaconBlock
|
||||||
from ../spec/mev/rest_bellatrix_mev_calls import submitBlindedBlock
|
|
||||||
from ../spec/mev/rest_capella_mev_calls import submitBlindedBlock
|
from ../spec/mev/rest_capella_mev_calls import submitBlindedBlock
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
|
@ -39,7 +39,7 @@ import
|
||||||
../gossip_processing/block_processor,
|
../gossip_processing/block_processor,
|
||||||
".."/[conf, beacon_clock, beacon_node],
|
".."/[conf, beacon_clock, beacon_node],
|
||||||
"."/[slashing_protection, validator_pool, keystore_management],
|
"."/[slashing_protection, validator_pool, keystore_management],
|
||||||
".."/spec/mev/[rest_bellatrix_mev_calls, rest_capella_mev_calls]
|
".."/spec/mev/rest_capella_mev_calls
|
||||||
|
|
||||||
from eth/async_utils import awaitWithTimeout
|
from eth/async_utils import awaitWithTimeout
|
||||||
|
|
||||||
|
@ -522,8 +522,7 @@ func constructSignableBlindedBlock[T](
|
||||||
blindedBlock
|
blindedBlock
|
||||||
|
|
||||||
func constructPlainBlindedBlock[
|
func constructPlainBlindedBlock[
|
||||||
T: bellatrix_mev.BlindedBeaconBlock | capella_mev.BlindedBeaconBlock,
|
T: capella_mev.BlindedBeaconBlock, EPH: capella.ExecutionPayloadHeader](
|
||||||
EPH: bellatrix.ExecutionPayloadHeader | capella.ExecutionPayloadHeader](
|
|
||||||
blck: ForkyBeaconBlock, executionPayloadHeader: EPH): T =
|
blck: ForkyBeaconBlock, executionPayloadHeader: EPH): T =
|
||||||
const
|
const
|
||||||
blckFields = getFieldNames(typeof(blck))
|
blckFields = getFieldNames(typeof(blck))
|
||||||
|
@ -574,8 +573,7 @@ proc blindedBlockCheckSlashingAndSign[T](
|
||||||
return ok blindedBlock
|
return ok blindedBlock
|
||||||
|
|
||||||
proc getUnsignedBlindedBeaconBlock[
|
proc getUnsignedBlindedBeaconBlock[
|
||||||
T: bellatrix_mev.SignedBlindedBeaconBlock |
|
T: capella_mev.SignedBlindedBeaconBlock |
|
||||||
capella_mev.SignedBlindedBeaconBlock |
|
|
||||||
deneb_mev.SignedBlindedBeaconBlock](
|
deneb_mev.SignedBlindedBeaconBlock](
|
||||||
node: BeaconNode, slot: Slot, validator: AttachedValidator,
|
node: BeaconNode, slot: Slot, validator: AttachedValidator,
|
||||||
validator_index: ValidatorIndex, forkedBlock: ForkedBeaconBlock,
|
validator_index: ValidatorIndex, forkedBlock: ForkedBeaconBlock,
|
||||||
|
@ -588,8 +586,6 @@ proc getUnsignedBlindedBeaconBlock[
|
||||||
return err("getUnsignedBlindedBeaconBlock: Deneb blinded block creation not implemented")
|
return err("getUnsignedBlindedBeaconBlock: Deneb blinded block creation not implemented")
|
||||||
elif consensusFork >= ConsensusFork.Bellatrix:
|
elif consensusFork >= ConsensusFork.Bellatrix:
|
||||||
when not (
|
when not (
|
||||||
(T is bellatrix_mev.SignedBlindedBeaconBlock and
|
|
||||||
consensusFork == ConsensusFork.Bellatrix) or
|
|
||||||
(T is capella_mev.SignedBlindedBeaconBlock and
|
(T is capella_mev.SignedBlindedBeaconBlock and
|
||||||
consensusFork == ConsensusFork.Capella)):
|
consensusFork == ConsensusFork.Capella)):
|
||||||
return err("getUnsignedBlindedBeaconBlock: mismatched block/payload types")
|
return err("getUnsignedBlindedBeaconBlock: mismatched block/payload types")
|
||||||
|
@ -675,8 +671,7 @@ proc getBlindedBlockParts[EPH: ForkyExecutionPayloadHeader](
|
||||||
forkedBlck.blck))
|
forkedBlck.blck))
|
||||||
|
|
||||||
proc getBuilderBid[
|
proc getBuilderBid[
|
||||||
SBBB: bellatrix_mev.SignedBlindedBeaconBlock |
|
SBBB: capella_mev.SignedBlindedBeaconBlock |
|
||||||
capella_mev.SignedBlindedBeaconBlock |
|
|
||||||
deneb_mev.SignedBlindedBeaconBlock](
|
deneb_mev.SignedBlindedBeaconBlock](
|
||||||
node: BeaconNode, payloadBuilderClient: RestClientRef, head: BlockRef,
|
node: BeaconNode, payloadBuilderClient: RestClientRef, head: BlockRef,
|
||||||
validator: AttachedValidator, slot: Slot, randao: ValidatorSig,
|
validator: AttachedValidator, slot: Slot, randao: ValidatorSig,
|
||||||
|
@ -684,9 +679,7 @@ proc getBuilderBid[
|
||||||
Future[BlindedBlockResult[SBBB]] {.async.} =
|
Future[BlindedBlockResult[SBBB]] {.async.} =
|
||||||
## Returns the unsigned blinded block obtained from the Builder API.
|
## Returns the unsigned blinded block obtained from the Builder API.
|
||||||
## Used by the BN's own validators, but not the REST server
|
## Used by the BN's own validators, but not the REST server
|
||||||
when SBBB is bellatrix_mev.SignedBlindedBeaconBlock:
|
when SBBB is capella_mev.SignedBlindedBeaconBlock:
|
||||||
type EPH = bellatrix.ExecutionPayloadHeader
|
|
||||||
elif SBBB is capella_mev.SignedBlindedBeaconBlock:
|
|
||||||
type EPH = capella.ExecutionPayloadHeader
|
type EPH = capella.ExecutionPayloadHeader
|
||||||
elif SBBB is deneb_mev.SignedBlindedBeaconBlock:
|
elif SBBB is deneb_mev.SignedBlindedBeaconBlock:
|
||||||
type EPH = deneb.ExecutionPayloadHeader
|
type EPH = deneb.ExecutionPayloadHeader
|
||||||
|
@ -748,7 +741,7 @@ func isEFMainnet(cfg: RuntimeConfig): bool =
|
||||||
cfg.DEPOSIT_CHAIN_ID == 1 and cfg.DEPOSIT_NETWORK_ID == 1
|
cfg.DEPOSIT_CHAIN_ID == 1 and cfg.DEPOSIT_NETWORK_ID == 1
|
||||||
|
|
||||||
proc makeBlindedBeaconBlockForHeadAndSlot*[
|
proc makeBlindedBeaconBlockForHeadAndSlot*[
|
||||||
BBB: bellatrix_mev.BlindedBeaconBlock | capella_mev.BlindedBeaconBlock](
|
BBB: capella_mev.BlindedBeaconBlock](
|
||||||
node: BeaconNode, payloadBuilderClient: RestClientRef,
|
node: BeaconNode, payloadBuilderClient: RestClientRef,
|
||||||
randao_reveal: ValidatorSig, validator_index: ValidatorIndex,
|
randao_reveal: ValidatorSig, validator_index: ValidatorIndex,
|
||||||
graffiti: GraffitiBytes, head: BlockRef, slot: Slot):
|
graffiti: GraffitiBytes, head: BlockRef, slot: Slot):
|
||||||
|
@ -759,9 +752,7 @@ proc makeBlindedBeaconBlockForHeadAndSlot*[
|
||||||
##
|
##
|
||||||
## This function is used by the validator client, but not the beacon node for
|
## This function is used by the validator client, but not the beacon node for
|
||||||
## its own validators.
|
## its own validators.
|
||||||
when BBB is bellatrix_mev.BlindedBeaconBlock:
|
when BBB is capella_mev.BlindedBeaconBlock:
|
||||||
type EPH = bellatrix.ExecutionPayloadHeader
|
|
||||||
elif BBB is capella_mev.BlindedBeaconBlock:
|
|
||||||
type EPH = capella.ExecutionPayloadHeader
|
type EPH = capella.ExecutionPayloadHeader
|
||||||
else:
|
else:
|
||||||
static: doAssert false
|
static: doAssert false
|
||||||
|
|
Loading…
Reference in New Issue