Skip to content

Commit 94a3c2b

Browse files
committed
not to milestone 1 spec, but what mev-boost code actually does
1 parent 63d586b commit 94a3c2b

File tree

2 files changed

+45
-31
lines changed

2 files changed

+45
-31
lines changed

web3/builder_api_callsigs.nim

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#api-docs
2-
31
import ethtypes, builder_api_types, engine_api_types
42

5-
proc builder_getPayloadHeaderV1(payloadId: PayloadID): ExecutionPayloadHeaderV1
6-
proc builder_proposeBlindedBlockV1(blck: SignedBlindedBeaconBlock): ExecutionPayloadV1
3+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#api-docs
4+
# but not what's in the actual code
5+
# proc builder_getPayloadHeaderV1(payloadId: PayloadID): ExecutionPayloadHeaderV1
6+
# proc builder_proposeBlindedBlockV1(blck: SignedBlindedBeaconBlock): ExecutionPayloadV1
7+
8+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/service.go
9+
proc builder_getPayloadHeaderV1(payloadId: PayloadID): ExecutionPayloadWithTxRootV1
10+
proc builder_proposeBlindedBlockV1(blck: SignedBlindedBeaconBlock): ExecutionPayloadWithTxRootV1

web3/builder_api_types.nim

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,57 @@
11
import
2+
stint,
23
ethtypes
34

45
export
56
ethtypes
67

78
type
8-
# https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#executionpayloadheader
9-
ExecutionPayloadHeaderV1* = object
10-
parent_hash*: FixedBytes[32]
11-
fee_recipient*: Address
12-
state_root*: FixedBytes[32]
13-
receipts_root*: FixedBytes[32]
14-
logs_bloom*: FixedBytes[256]
9+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/types.go#L34
10+
ExecutionPayloadWithTxRootV1* = object
11+
parentHash*: FixedBytes[32]
12+
feeRecipient*: Address
13+
stateRoot*: FixedBytes[32]
14+
receiptsRoot*: FixedBytes[32]
15+
logsBloom*: string # FixedBytes[256]
1516
random*: FixedBytes[32]
16-
block_number*: Quantity
17-
gas_limit*: Quantity
18-
gas_used*: Quantity
17+
blockNumber*: Quantity
18+
gasLimit*: Quantity
19+
gasUsed*: Quantity
1920
timestamp*: Quantity
20-
extra_data*: string # List[byte, MAX_EXTRA_DATA_BYTES]
21-
base_fee_per_gas*: FixedBytes[32] # base fee introduced in EIP-1559, little-endian serialized
21+
extraData*: string # List[byte, MAX_EXTRA_DATA_BYTES]
22+
baseFeePerGas*: Uint256 # base fee introduced in EIP-1559, little-endian serialized
23+
blockHash*: FixedBytes[32]
24+
#transactions: seq[string]
25+
transactionsRoot*: FixedBytes[32]
26+
27+
ExecutionPayloadHeaderOnlyBlockHash* = object
28+
# Another of these either-snake-or-camel definitions
29+
# also why use common.Hash elsewhere but string here as block type? Either
30+
# works, but.
31+
blockHash*: string
2232

23-
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#blindedbeaconblockbody
24-
BlindedBeaconBlockBody* = object
25-
randao_reveal*: FixedBytes[96]
26-
eth1_data*: string # Eth1Data
27-
graffiti*: FixedBytes[32]
28-
proposer_slashings*: string # List[ProposerSlashing, MAX_PROPOSER_SLASHINGS]
29-
attester_slashings*: string # List[AttesterSlashing, MAX_ATTESTER_SLASHINGS]
30-
attestations*: string # List[Attestation, MAX_ATTESTATIONS]
31-
voluntary_exits*: string # List[SignedVoluntaryExit, MAX_VOLUNTARY_EXITS]
32-
sync_aggregate*: string # SyncAggregate
33-
execution_payload_header*: ExecutionPayloadHeaderV1
33+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/types.go#L26
34+
BlindedBeaconBlockBodyPartial* = object
35+
execution_payload_header*: ExecutionPayloadHeaderOnlyBlockHash
36+
# Either snake_case or camelCase is allowed, or both:
37+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/service.go#L157
3438

3539
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#blindedbeaconblock
40+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/types.go#L17
3641
BlindedBeaconBlock* = object
37-
slot*: Quantity
42+
# These are snake case, while, e.g. ExecutionPayloadWithTxRootV1 is
43+
# camelCase. And others, such as BlindedBeaconBlockBodyPartial, can be either
44+
# proposer_index, parent_root, and state_root are all strings for MEV
45+
slot*: Quantity # MEV builder service uses string here
3846
proposer_index*: Quantity
3947
parent_root*: FixedBytes[32]
4048
state_root*: FixedBytes[32]
41-
body*: BlindedBeaconBlockBody
49+
# The MEV sevice only decodes BlindedBeaconBlockBodyPartial
50+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/service.go#L149
51+
body*: BlindedBeaconBlockBodyPartial
4252

4353
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#signedblindedbeaconblock
54+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/lib/types.go#L11
4455
SignedBlindedBeaconBlock* = object
4556
message*: BlindedBeaconBlock
46-
signature*: FixedBytes[96]
47-
57+
signature*: FixedBytes[96] # the MEV builder API service uses string here

0 commit comments

Comments
 (0)