Skip to content

Commit 649b0bf

Browse files
committed
MEV boost builder_* API support
1 parent a8a464c commit 649b0bf

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

web3/builder_api.nim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import
2+
strutils,
3+
json_serialization/std/[sets, net], serialization/errors,
4+
json_rpc/[client, jsonmarshal],
5+
conversions, builder_api_types, engine_api_types
6+
7+
export
8+
builder_api_types, conversions
9+
10+
from os import DirSep, AltSep
11+
template sourceDir: string = currentSourcePath.rsplit({DirSep, AltSep}, 1)[0]
12+
13+
createRpcSigs(RpcClient, sourceDir & "/builder_api_callsigs.nim")
14+

web3/builder_api_callsigs.nim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#api-docs
2+
3+
import ethtypes, builder_api_types, engine_api_types
4+
5+
proc builder_getPayloadHeaderV1(payloadId: PayloadID): ExecutionPayloadHeaderV1
6+
proc builder_proposeBlindedBlockV1(blck: SignedBlindedBeaconBlock): ExecutionPayloadV1

web3/builder_api_types.nim

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import
2+
ethtypes
3+
4+
export
5+
ethtypes
6+
7+
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]
15+
random*: FixedBytes[32]
16+
block_number*: Quantity
17+
gas_limit*: Quantity
18+
gas_used*: Quantity
19+
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
22+
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
34+
35+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#blindedbeaconblock
36+
BlindedBeaconBlock* = object
37+
slot*: Quantity
38+
proposer_index*: Quantity
39+
parent_root*: FixedBytes[32]
40+
state_root*: FixedBytes[32]
41+
body*: BlindedBeaconBlockBody
42+
43+
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#signedblindedbeaconblock
44+
SignedBlindedBeaconBlock* = object
45+
message*: BlindedBeaconBlock
46+
signature*: FixedBytes[96]
47+

0 commit comments

Comments
 (0)