unplumbing Bellatrix builder API support (#5203)

This commit is contained in:
tersec 2023-08-05 05:13:08 +00:00 committed by GitHub
parent d542410a17
commit 1f5dd83fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 42 deletions

View File

@ -850,7 +850,7 @@ template withStateAndBlck*(
body
func toBeaconBlockHeader*(
blck: SomeForkyBeaconBlock | bellatrix_mev.BlindedBeaconBlock |
blck: SomeForkyBeaconBlock |
capella_mev.BlindedBeaconBlock | deneb_mev.BlindedBeaconBlock):
BeaconBlockHeader =
## Reduce a given `BeaconBlock` to its `BeaconBlockHeader`.

View File

@ -6,7 +6,6 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import ".."/datatypes/[altair, bellatrix]
from stew/byteutils import to0xHex
{.push raises: [].}
@ -34,26 +33,12 @@ type
message*: BuilderBid
signature*: ValidatorSig
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#blindedbeaconblockbody
BlindedBeaconBlockBody* = object
randao_reveal*: ValidatorSig
eth1_data*: Eth1Data
graffiti*: GraffitiBytes
proposer_slashings*: List[ProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
attester_slashings*: List[AttesterSlashing, Limit MAX_ATTESTER_SLASHINGS]
attestations*: List[Attestation, Limit MAX_ATTESTATIONS]
deposits*: List[Deposit, Limit MAX_DEPOSITS]
voluntary_exits*: List[SignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
sync_aggregate*: SyncAggregate
execution_payload_header*: ExecutionPayloadHeader
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#blindedbeaconblock
BlindedBeaconBlock* = object
slot*: Slot
proposer_index*: uint64
parent_root*: Eth2Digest
state_root*: Eth2Digest
body*: BlindedBeaconBlockBody
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signedblindedbeaconblock
SignedBlindedBeaconBlock* = object
@ -77,17 +62,16 @@ func shortLog*(v: BlindedBeaconBlock): auto =
proposer_index: v.proposer_index,
parent_root: shortLog(v.parent_root),
state_root: shortLog(v.state_root),
eth1data: v.body.eth1_data,
graffiti: $v.body.graffiti,
proposer_slashings_len: v.body.proposer_slashings.len(),
attester_slashings_len: v.body.attester_slashings.len(),
attestations_len: v.body.attestations.len(),
deposits_len: v.body.deposits.len(),
voluntary_exits_len: v.body.voluntary_exits.len(),
sync_committee_participants: v.body.sync_aggregate.num_active_participants,
block_number: v.body.execution_payload_header.block_number,
# TODO checksum hex? shortlog?
fee_recipient: to0xHex(v.body.execution_payload_header.fee_recipient.data),
eth1data: default(Eth1Data),
graffiti: $default(GraffitiBytes),
proposer_slashings_len: 0,
attester_slashings_len: 0,
attestations_len: 0,
deposits_len: 0,
voluntary_exits_len: 0,
sync_committee_participants: 0,
block_number: 0'u64,
fee_recipient: "",
bls_to_execution_changes_len: 0, # Capella compat
blob_kzg_commitments_len: 0, # Deneb compat
)

View File

@ -442,7 +442,6 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
bellatrix.BeaconBlockBody |
capella.BeaconBlockBody |
deneb.BeaconBlockBody |
bellatrix_mev.BlindedBeaconBlockBody |
capella_mev.BlindedBeaconBlockBody |
deneb_mev.BlindedBeaconBlockBody
@ -472,21 +471,8 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
let web3SignerRequest =
when blck is ForkedBlindedBeaconBlock:
case blck.kind
of ConsensusFork.Phase0, ConsensusFork.Altair:
of ConsensusFork.Phase0, ConsensusFork.Altair, ConsensusFork.Bellatrix:
return SignatureResult.err("Invalid beacon block fork version")
of ConsensusFork.Bellatrix:
case v.data.remoteType
of RemoteSignerType.Web3Signer:
Web3SignerRequest.init(fork, genesis_validators_root,
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Bellatrix,
data: blck.bellatrixData.toBeaconBlockHeader))
of RemoteSignerType.VerifyingWeb3Signer:
let proofs = blockPropertiesProofs(
blck.bellatrixData.body, bellatrixIndex)
Web3SignerRequest.init(fork, genesis_validators_root,
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Bellatrix,
data: blck.bellatrixData.toBeaconBlockHeader),
proofs)
of ConsensusFork.Capella:
case v.data.remoteType
of RemoteSignerType.Web3Signer: