add/update Deneb Builder API types and RPC signatures (#5492)

This commit is contained in:
tersec 2023-10-11 04:25:59 +00:00 committed by GitHub
parent 447786518f
commit 48197e4d55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 9 deletions

View File

@ -134,6 +134,12 @@ type
blob_gas_used*: uint64 # [New in Deneb:EIP4844]
excess_blob_gas*: uint64 # [New in Deneb:EIP4844]
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/validator.md#blobsbundle
BlobsBundle* = object
commitments*: seq[KZGCommitment]
proofs*: seq[KZGProof]
blobs*: seq[Blob]
ExecutePayload* = proc(
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [].}

View File

@ -97,6 +97,7 @@ type
SetGasLimitRequest |
bellatrix_mev.SignedBlindedBeaconBlock |
capella_mev.SignedBlindedBeaconBlock |
deneb_mev.SignedBlindedBeaconBlockContents |
SignedValidatorRegistrationV1 |
SignedVoluntaryExit |
Web3SignerRequest |

View File

@ -21,6 +21,7 @@ import
".."/mev/[capella_mev, deneb_mev]
from ".."/datatypes/capella import BeaconBlockBody
from ".."/mev/deneb_mev import ExecutionPayloadAndBlobsBundle
export forks, phase0, altair, bellatrix, capella, capella_mev, deneb_mev,
tables, httputils
@ -545,7 +546,7 @@ type
ProduceBlindedBlockResponse* = ForkedBlindedBeaconBlock
ProduceSyncCommitteeContributionResponse* = DataEnclosedObject[SyncCommitteeContribution]
SubmitBlindedBlockResponseCapella* = DataEnclosedObject[capella.ExecutionPayload]
SubmitBlindedBlockResponseDeneb* = DataEnclosedObject[deneb.ExecutionPayload]
SubmitBlindedBlockResponseDeneb* = DataEnclosedObject[deneb_mev.ExecutionPayloadAndBlobsBundle]
GetValidatorsActivityResponse* = DataEnclosedObject[seq[RestActivityItem]]
GetValidatorsLivenessResponse* = DataEnclosedObject[seq[RestLivenessItem]]

View File

@ -5,21 +5,28 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.push raises: [].}
import ".."/datatypes/[altair, capella, deneb]
from stew/byteutils import to0xHex
{.push raises: [].}
type
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#builderbid
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/capella/builder.md#executionpayloadheader
# https://github.com/ethereum/builder-specs/blob/534e4f81276b8346d785ed9aba12c4c74b927ec6/specs/deneb/builder.md#blindedblobsbundle
BlindedBlobsBundle* = object
commitments*: List[KZGCommitment, Limit MAX_BLOB_COMMITMENTS_PER_BLOCK]
proofs*: List[KZGProof, Limit MAX_BLOB_COMMITMENTS_PER_BLOCK]
blob_roots*: List[Eth2Digest, Limit MAX_BLOB_COMMITMENTS_PER_BLOCK]
# https://github.com/ethereum/builder-specs/blob/534e4f81276b8346d785ed9aba12c4c74b927ec6/specs/deneb/builder.md#builderbid
BuilderBid* = object
header*: deneb.ExecutionPayloadHeader
header*: deneb.ExecutionPayloadHeader # [Modified in Deneb]
blinded_blobs_bundle*: BlindedBlobsBundle # [New in Deneb]
value*: UInt256
pubkey*: ValidatorPubKey
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signedbuilderbid
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/capella/builder.md#executionpayloadheader
# https://github.com/ethereum/builder-specs/blob/534e4f81276b8346d785ed9aba12c4c74b927ec6/specs/deneb/builder.md#executionpayloadheader
SignedBuilderBid* = object
message*: BuilderBid
signature*: ValidatorSig
@ -59,6 +66,33 @@ type
message*: BlindedBeaconBlock
signature*: ValidatorSig
# https://github.com/ethereum/builder-specs/blob/534e4f81276b8346d785ed9aba12c4c74b927ec6/specs/deneb/builder.md#blindedblobsidecar
BlindedBlobSidecar* = object
block_root*: Eth2Digest
index*: uint64
slot*: uint64
block_parent_root*: Eth2Digest
proposer_index*: uint64
blob_root*: Eth2Digest
kzg_commitment*: KZGCommitment
kzg_proof*: KZGProof
# https://github.com/ethereum/builder-specs/blob/534e4f81276b8346d785ed9aba12c4c74b927ec6/specs/deneb/builder.md#signedblindedblobsidecar
SignedBlindedBlobSidecar* = object
message*: BlindedBlobSidecar
signature*: ValidatorSig
# https://github.com/ethereum/builder-specs/blob/534e4f81276b8346d785ed9aba12c4c74b927ec6/specs/deneb/builder.md#signedblindedblockcontents
SignedBlindedBeaconBlockContents* = object
signed_blinded_block*: SignedBlindedBeaconBlock
signed_blinded_blob_sidecars*:
List[SignedBlindedBlobSidecar, Limit MAX_BLOBS_PER_BLOCK]
# https://github.com/ethereum/builder-specs/blob/534e4f81276b8346d785ed9aba12c4c74b927ec6/specs/deneb/builder.md#executionpayloadandblobsbundle
ExecutionPayloadAndBlobsBundle* = object
execution_payload*: deneb.ExecutionPayload
blobs_bundle*: BlobsBundle
func shortLog*(v: BlindedBeaconBlock): auto =
(
slot: shortLog(v.slot),

View File

@ -18,10 +18,10 @@ proc getHeaderDeneb*(slot: Slot,
): RestResponse[GetHeaderResponseDeneb] {.
rest, endpoint: "/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}",
meth: MethodGet, connection: {Dedicated, Close}.}
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/header.yaml
## https://github.com/ethereum/builder-specs/blob/34509da74237942aa15a4c0ca828f67acdf77652/apis/builder/header.yaml
proc submitBlindedBlock*(body: deneb_mev.SignedBlindedBeaconBlock
proc submitBlindedBlock*(body: deneb_mev.SignedBlindedBeaconBlockContents
): RestResponse[SubmitBlindedBlockResponseDeneb] {.
rest, endpoint: "/eth/v1/builder/blinded_blocks",
meth: MethodPost, connection: {Dedicated, Close}.}
## https://github.com/ethereum/builder-specs/blob/v0.3.0/apis/builder/blinded_blocks.yaml
## https://github.com/ethereum/builder-specs/blob/34509da74237942aa15a4c0ca828f67acdf77652/apis/builder/blinded_blocks.yaml