MEV boost builder_* API support

This commit is contained in:
Dustin Brody 2022-02-10 07:20:57 +00:00
parent a8a464c5fe
commit 649b0bf42f
No known key found for this signature in database
GPG Key ID: 3D7A11A0156519DC
3 changed files with 67 additions and 0 deletions

14
web3/builder_api.nim Normal file
View File

@ -0,0 +1,14 @@
import
strutils,
json_serialization/std/[sets, net], serialization/errors,
json_rpc/[client, jsonmarshal],
conversions, builder_api_types, engine_api_types
export
builder_api_types, conversions
from os import DirSep, AltSep
template sourceDir: string = currentSourcePath.rsplit({DirSep, AltSep}, 1)[0]
createRpcSigs(RpcClient, sourceDir & "/builder_api_callsigs.nim")

View File

@ -0,0 +1,6 @@
# 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

View File

@ -0,0 +1,47 @@
import
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]
random*: FixedBytes[32]
block_number*: Quantity
gas_limit*: Quantity
gas_used*: 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
# 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
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#blindedbeaconblock
BlindedBeaconBlock* = object
slot*: Quantity
proposer_index*: Quantity
parent_root*: FixedBytes[32]
state_root*: FixedBytes[32]
body*: BlindedBeaconBlockBody
# https://github.com/flashbots/mev-boost/blob/thegostep/docs/docs/milestone-1.md#signedblindedbeaconblock
SignedBlindedBeaconBlock* = object
message*: BlindedBeaconBlock
signature*: FixedBytes[96]