diff --git a/beacon_chain/spec/datatypes/deneb.nim b/beacon_chain/spec/datatypes/deneb.nim index d679bfb58..7f528f1af 100644 --- a/beacon_chain/spec/datatypes/deneb.nim +++ b/beacon_chain/spec/datatypes/deneb.nim @@ -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: [].} diff --git a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim index 08b24ff75..9c0ffe6df 100644 --- a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim +++ b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim @@ -97,6 +97,7 @@ type SetGasLimitRequest | bellatrix_mev.SignedBlindedBeaconBlock | capella_mev.SignedBlindedBeaconBlock | + deneb_mev.SignedBlindedBeaconBlockContents | SignedValidatorRegistrationV1 | SignedVoluntaryExit | Web3SignerRequest | diff --git a/beacon_chain/spec/eth2_apis/rest_types.nim b/beacon_chain/spec/eth2_apis/rest_types.nim index 9b0773cd8..db9dea68a 100644 --- a/beacon_chain/spec/eth2_apis/rest_types.nim +++ b/beacon_chain/spec/eth2_apis/rest_types.nim @@ -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]] diff --git a/beacon_chain/spec/mev/deneb_mev.nim b/beacon_chain/spec/mev/deneb_mev.nim index 22e6d2f3b..9c8633338 100644 --- a/beacon_chain/spec/mev/deneb_mev.nim +++ b/beacon_chain/spec/mev/deneb_mev.nim @@ -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), diff --git a/beacon_chain/spec/mev/rest_deneb_mev_calls.nim b/beacon_chain/spec/mev/rest_deneb_mev_calls.nim index 0414f8616..b1a20500c 100644 --- a/beacon_chain/spec/mev/rest_deneb_mev_calls.nim +++ b/beacon_chain/spec/mev/rest_deneb_mev_calls.nim @@ -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