builder spec v0.3.0 URL updates (#4641)
* builder spec v0.3.0 URL updates * remove stray non-URL/comment change
This commit is contained in:
parent
6b9381ef41
commit
0cc0c7e6b7
|
@ -1312,7 +1312,7 @@ proc onSlotStart(node: BeaconNode, wallTime: BeaconTime,
|
|||
|
||||
await onSlotEnd(node, wallSlot)
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/validator.md#registration-dissemination
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#registration-dissemination
|
||||
# This specification suggests validators re-submit to builder software every
|
||||
# `EPOCHS_PER_VALIDATOR_REGISTRATION_SUBMISSION` epochs.
|
||||
if wallSlot.is_epoch and
|
||||
|
|
|
@ -11,30 +11,30 @@ from stew/byteutils import to0xHex
|
|||
{.push raises: [].}
|
||||
|
||||
type
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#validatorregistrationv1
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#validatorregistrationv1
|
||||
ValidatorRegistrationV1* = object
|
||||
fee_recipient*: ExecutionAddress
|
||||
gas_limit*: uint64
|
||||
timestamp*: uint64
|
||||
pubkey*: ValidatorPubKey
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#signedvalidatorregistrationv1
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signedvalidatorregistrationv1
|
||||
SignedValidatorRegistrationV1* = object
|
||||
message*: ValidatorRegistrationV1
|
||||
signature*: ValidatorSig
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#builderbid
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#builderbid
|
||||
BuilderBid* = object
|
||||
header*: ExecutionPayloadHeader
|
||||
value*: UInt256
|
||||
pubkey*: ValidatorPubKey
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#signedbuilderbid
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signedbuilderbid
|
||||
SignedBuilderBid* = object
|
||||
message*: BuilderBid
|
||||
signature*: ValidatorSig
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#blindedbeaconblockbody
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#blindedbeaconblockbody
|
||||
BlindedBeaconBlockBody = object
|
||||
randao_reveal*: ValidatorSig
|
||||
eth1_data*: Eth1Data
|
||||
|
@ -47,7 +47,7 @@ type
|
|||
sync_aggregate*: SyncAggregate
|
||||
execution_payload_header*: ExecutionPayloadHeader
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#blindedbeaconblock
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#blindedbeaconblock
|
||||
BlindedBeaconBlock* = object
|
||||
slot*: Slot
|
||||
proposer_index*: uint64
|
||||
|
@ -55,16 +55,16 @@ type
|
|||
state_root*: Eth2Digest
|
||||
body*: BlindedBeaconBlockBody
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#signedblindedbeaconblock
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signedblindedbeaconblock
|
||||
SignedBlindedBeaconBlock* = object
|
||||
message*: BlindedBeaconBlock
|
||||
signature*: ValidatorSig
|
||||
|
||||
const
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#domain-types
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#domain-types
|
||||
DOMAIN_APPLICATION_BUILDER* = DomainType([byte 0x00, 0x00, 0x00, 0x01])
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/validator.md#constants
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#constants
|
||||
EPOCHS_PER_VALIDATOR_REGISTRATION_SUBMISSION* = 1
|
||||
BUILDER_PROPOSAL_DELAY_TOLERANCE* = 1.seconds
|
||||
|
||||
|
|
|
@ -11,18 +11,20 @@ from stew/byteutils import to0xHex
|
|||
{.push raises: [].}
|
||||
|
||||
type
|
||||
# https://github.com/jimmygchen/builder-specs/blob/0e15394bc239d3fee1ba9e42f4ce67ff6565537b/specs/builder.md#builderbid-1
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#builderbid
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/capella/builder.md#executionpayloadheader
|
||||
BuilderBid* = object
|
||||
header*: capella.ExecutionPayloadHeader # [Modified in Capella]
|
||||
value*: UInt256
|
||||
pubkey*: ValidatorPubKey
|
||||
|
||||
# https://github.com/jimmygchen/builder-specs/blob/0e15394bc239d3fee1ba9e42f4ce67ff6565537b/specs/builder.md#signedbuilderbid-1
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signedbuilderbid
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/capella/builder.md#executionpayloadheader
|
||||
SignedBuilderBid* = object
|
||||
message*: BuilderBid # [Modified in Capella]
|
||||
signature*: ValidatorSig
|
||||
|
||||
# https://github.com/jimmygchen/builder-specs/blob/0e15394bc239d3fee1ba9e42f4ce67ff6565537b/specs/builder.md#blindedbeaconblockbody-1
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/capella/builder.md#blindedbeaconblockbody
|
||||
BlindedBeaconBlockBody = object
|
||||
randao_reveal*: ValidatorSig
|
||||
eth1_data*: Eth1Data
|
||||
|
@ -39,7 +41,8 @@ type
|
|||
List[SignedBLSToExecutionChange,
|
||||
Limit MAX_BLS_TO_EXECUTION_CHANGES] # [New in Capella]
|
||||
|
||||
# https://github.com/jimmygchen/builder-specs/blob/0e15394bc239d3fee1ba9e42f4ce67ff6565537b/specs/builder.md#blindedbeaconblock-1
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#blindedbeaconblock
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/capella/builder.md#blindedbeaconblockbody
|
||||
BlindedBeaconBlock* = object
|
||||
slot*: Slot
|
||||
proposer_index*: uint64
|
||||
|
@ -47,7 +50,8 @@ type
|
|||
state_root*: Eth2Digest
|
||||
body*: BlindedBeaconBlockBody # [Modified in Capella]
|
||||
|
||||
# https://github.com/jimmygchen/builder-specs/blob/0e15394bc239d3fee1ba9e42f4ce67ff6565537b/specs/builder.md#signedblindedbeaconblock-1
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signedblindedbeaconblock
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/capella/builder.md#blindedbeaconblockbody
|
||||
SignedBlindedBeaconBlock* = object
|
||||
message*: BlindedBeaconBlock
|
||||
signature*: ValidatorSig
|
||||
|
|
|
@ -16,8 +16,8 @@ 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.2.0/apis/builder/validators.yaml
|
||||
## https://github.com/ethereum/beacon-APIs/blob/master/apis/validator/register_validator.yaml
|
||||
## 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 getHeader*(slot: Slot,
|
||||
parent_hash: Eth2Digest,
|
||||
|
@ -25,15 +25,15 @@ proc getHeader*(slot: Slot,
|
|||
): RestResponse[GetHeaderResponse] {.
|
||||
rest, endpoint: "/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}",
|
||||
meth: MethodGet, connection: {Dedicated, Close}.}
|
||||
## https://github.com/ethereum/builder-specs/blob/v0.2.0/apis/builder/header.yaml
|
||||
## 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.2.0/apis/builder/blinded_blocks.yaml
|
||||
## 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.2.0/apis/builder/status.yaml
|
||||
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/status.yaml
|
||||
|
|
|
@ -90,7 +90,7 @@ proc verify_epoch_signature*(
|
|||
func compute_block_signing_root*(
|
||||
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
||||
blck: Eth2Digest | SomeForkyBeaconBlock | BeaconBlockHeader |
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.1.0/specs/README.md#signing
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signing
|
||||
BlindedBeaconBlock): Eth2Digest =
|
||||
let
|
||||
epoch = epoch(slot)
|
||||
|
@ -345,7 +345,7 @@ proc verify_contribution_and_proof_signature*(
|
|||
|
||||
blsVerify(pubkey, signing_root.data, signature)
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#signing
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signing
|
||||
func compute_builder_signing_root*(
|
||||
fork: Fork, msg: BuilderBid | ValidatorRegistrationV1): Eth2Digest =
|
||||
# Uses genesis fork version regardless
|
||||
|
|
|
@ -76,7 +76,7 @@ proc unblindAndRouteBlockMEV*(
|
|||
else:
|
||||
# Signature provided is consistent with unblinded execution payload,
|
||||
# so construct full beacon block
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/validator.md#block-proposal
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#block-proposal
|
||||
var signedBlock = bellatrix.SignedBeaconBlock(
|
||||
signature: blindedBlock.signature)
|
||||
copyFields(
|
||||
|
@ -110,12 +110,12 @@ proc unblindAndRouteBlockMEV*(
|
|||
debug "unblindAndRouteBlockMEV: submitBlindedBlock failed",
|
||||
blindedBlock, payloadStatus = unblindedPayload.status
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/validator.md#proposer-slashing
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing
|
||||
# This means if a validator publishes a signature for a
|
||||
# `BlindedBeaconBlock` (via a dissemination of a
|
||||
# `SignedBlindedBeaconBlock`) then the validator **MUST** not use the
|
||||
# local build process as a fallback, even in the event of some failure
|
||||
# with the external buildernetwork.
|
||||
# with the external builder network.
|
||||
return err("unblindAndRouteBlockMEV error")
|
||||
|
||||
# TODO currently cannot be combined into one generic function
|
||||
|
|
|
@ -605,7 +605,7 @@ func constructSignableBlindedBlock[T](
|
|||
|
||||
var blindedBlock: T
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/validator.md#block-proposal
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#block-proposal
|
||||
copyFields(blindedBlock.message, forkedBlock.bellatrixData, blckFields)
|
||||
copyFields(
|
||||
blindedBlock.message.body, forkedBlock.bellatrixData.body, blckBodyFields)
|
||||
|
@ -622,7 +622,7 @@ func constructPlainBlindedBlock[T](
|
|||
|
||||
var blindedBlock: T
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/validator.md#block-proposal
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#block-proposal
|
||||
copyFields(blindedBlock, forkedBlock.bellatrixData, blckFields)
|
||||
copyFields(blindedBlock.body, forkedBlock.bellatrixData.body, blckBodyFields)
|
||||
blindedBlock.body.execution_payload_header = executionPayloadHeader
|
||||
|
@ -1356,7 +1356,7 @@ proc registerValidators*(node: BeaconNode, epoch: Epoch) {.async.} =
|
|||
toSeq(node.attachedValidators[].validators.keys)
|
||||
|
||||
const emptyNestedSeq = @[newSeq[SignedValidatorRegistrationV1](0)]
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/validator.md#validator-registration
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#validator-registration
|
||||
# Seed with single empty inner list to avoid special cases
|
||||
var validatorRegistrations = emptyNestedSeq
|
||||
|
||||
|
@ -1406,7 +1406,7 @@ proc registerValidators*(node: BeaconNode, epoch: Epoch) {.async.} =
|
|||
if validator.index.isNone:
|
||||
continue
|
||||
|
||||
# https://ethereum.github.io/builder-specs/#/Builder/registerValidator
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/validators.yaml
|
||||
# Builders should verify that `pubkey` corresponds to an active or
|
||||
# pending validator
|
||||
withState(node.dag.headState):
|
||||
|
|
|
@ -618,7 +618,7 @@ proc getSlotSignature*(v: AttachedValidator, fork: Fork,
|
|||
v.slotSignature = Opt.some((slot, signature.get))
|
||||
return signature
|
||||
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.2.0/specs/builder.md#signing
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signing
|
||||
proc getBuilderSignature*(v: AttachedValidator, fork: Fork,
|
||||
validatorRegistration: ValidatorRegistrationV1):
|
||||
Future[SignatureResult] {.async.} =
|
||||
|
|
Loading…
Reference in New Issue