not to milestone 1 spec, but what mev-boost code actually does

This commit is contained in:
Dustin Brody 2022-02-23 05:30:02 +00:00
parent 63d586bd9d
commit 94a3c2bd95
No known key found for this signature in database
GPG Key ID: 3D7A11A0156519DC
2 changed files with 45 additions and 31 deletions

View File

@ -1,6 +1,10 @@
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#api-docs
import ethtypes, builder_api_types, engine_api_types
proc builder_getPayloadHeaderV1(payloadId: PayloadID): ExecutionPayloadHeaderV1
proc builder_proposeBlindedBlockV1(blck: SignedBlindedBeaconBlock): ExecutionPayloadV1
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#api-docs
# but not what's in the actual code
# proc builder_getPayloadHeaderV1(payloadId: PayloadID): ExecutionPayloadHeaderV1
# proc builder_proposeBlindedBlockV1(blck: SignedBlindedBeaconBlock): ExecutionPayloadV1
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/service.go
proc builder_getPayloadHeaderV1(payloadId: PayloadID): ExecutionPayloadWithTxRootV1
proc builder_proposeBlindedBlockV1(blck: SignedBlindedBeaconBlock): ExecutionPayloadWithTxRootV1

View File

@ -1,47 +1,57 @@
import
stint,
ethtypes
export
ethtypes
type
# https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#executionpayloadheader
ExecutionPayloadHeaderV1* = object
parent_hash*: FixedBytes[32]
fee_recipient*: Address
state_root*: FixedBytes[32]
receipts_root*: FixedBytes[32]
logs_bloom*: FixedBytes[256]
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/types.go#L34
ExecutionPayloadWithTxRootV1* = object
parentHash*: FixedBytes[32]
feeRecipient*: Address
stateRoot*: FixedBytes[32]
receiptsRoot*: FixedBytes[32]
logsBloom*: string # FixedBytes[256]
random*: FixedBytes[32]
block_number*: Quantity
gas_limit*: Quantity
gas_used*: Quantity
blockNumber*: Quantity
gasLimit*: Quantity
gasUsed*: Quantity
timestamp*: Quantity
extra_data*: string # List[byte, MAX_EXTRA_DATA_BYTES]
base_fee_per_gas*: FixedBytes[32] # base fee introduced in EIP-1559, little-endian serialized
extraData*: string # List[byte, MAX_EXTRA_DATA_BYTES]
baseFeePerGas*: Uint256 # base fee introduced in EIP-1559, little-endian serialized
blockHash*: FixedBytes[32]
#transactions: seq[string]
transactionsRoot*: FixedBytes[32]
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#blindedbeaconblockbody
BlindedBeaconBlockBody* = object
randao_reveal*: FixedBytes[96]
eth1_data*: string # Eth1Data
graffiti*: FixedBytes[32]
proposer_slashings*: string # List[ProposerSlashing, MAX_PROPOSER_SLASHINGS]
attester_slashings*: string # List[AttesterSlashing, MAX_ATTESTER_SLASHINGS]
attestations*: string # List[Attestation, MAX_ATTESTATIONS]
voluntary_exits*: string # List[SignedVoluntaryExit, MAX_VOLUNTARY_EXITS]
sync_aggregate*: string # SyncAggregate
execution_payload_header*: ExecutionPayloadHeaderV1
ExecutionPayloadHeaderOnlyBlockHash* = object
# Another of these either-snake-or-camel definitions
# also why use common.Hash elsewhere but string here as block type? Either
# works, but.
blockHash*: string
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/types.go#L26
BlindedBeaconBlockBodyPartial* = object
execution_payload_header*: ExecutionPayloadHeaderOnlyBlockHash
# Either snake_case or camelCase is allowed, or both:
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/service.go#L157
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#blindedbeaconblock
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/types.go#L17
BlindedBeaconBlock* = object
slot*: Quantity
# These are snake case, while, e.g. ExecutionPayloadWithTxRootV1 is
# camelCase. And others, such as BlindedBeaconBlockBodyPartial, can be either
# proposer_index, parent_root, and state_root are all strings for MEV
slot*: Quantity # MEV builder service uses string here
proposer_index*: Quantity
parent_root*: FixedBytes[32]
state_root*: FixedBytes[32]
body*: BlindedBeaconBlockBody
# The MEV sevice only decodes BlindedBeaconBlockBodyPartial
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/service.go#L149
body*: BlindedBeaconBlockBodyPartial
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#signedblindedbeaconblock
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/types.go#L11
SignedBlindedBeaconBlock* = object
message*: BlindedBeaconBlock
signature*: FixedBytes[96]
signature*: FixedBytes[96] # the MEV builder API service uses string here