mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-28 08:37:59 -05:00
feat: _V3 engine api skeletons (#3931)
This commit is contained in:
@@ -21,6 +21,17 @@ pub trait EngineApi {
|
||||
#[method(name = "newPayloadV2")]
|
||||
async fn new_payload_v2(&self, payload: ExecutionPayload) -> RpcResult<PayloadStatus>;
|
||||
|
||||
/// Post Cancun payload handler
|
||||
///
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#engine_newpayloadv3>
|
||||
#[method(name = "newPayloadV3")]
|
||||
async fn new_payload_v3(
|
||||
&self,
|
||||
payload: ExecutionPayload,
|
||||
versioned_hashes: Vec<H256>,
|
||||
parent_beacon_block_root: H256,
|
||||
) -> RpcResult<PayloadStatus>;
|
||||
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/6709c2a795b707202e93c4f2867fa0bf2640a84f/src/engine/paris.md#engine_forkchoiceupdatedv1>
|
||||
///
|
||||
/// Caution: This should not accept the `withdrawals` field
|
||||
@@ -59,6 +70,14 @@ pub trait EngineApi {
|
||||
#[method(name = "getPayloadV2")]
|
||||
async fn get_payload_v2(&self, payload_id: PayloadId) -> RpcResult<ExecutionPayloadEnvelope>;
|
||||
|
||||
/// Post Cancun payload handler which also returns a blobs bundle.
|
||||
///
|
||||
/// Returns the most recent version of the payload that is available in the corresponding
|
||||
/// payload build process at the time of receiving this call. Note:
|
||||
/// > Provider software MAY stop the corresponding build process after serving this call.
|
||||
#[method(name = "getPayloadV3")]
|
||||
async fn get_payload_v3(&self, payload_id: PayloadId) -> RpcResult<ExecutionPayloadEnvelope>;
|
||||
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/6452a6b194d7db269bf1dbd087a267251d3cc7f8/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1>
|
||||
#[method(name = "getPayloadBodiesByHashV1")]
|
||||
async fn get_payload_bodies_by_hash_v1(
|
||||
|
||||
@@ -4,7 +4,7 @@ use jsonrpsee_core::RpcResult;
|
||||
use reth_beacon_consensus::BeaconConsensusEngineHandle;
|
||||
use reth_interfaces::consensus::ForkchoiceState;
|
||||
use reth_payload_builder::PayloadStore;
|
||||
use reth_primitives::{BlockHash, BlockHashOrNumber, BlockNumber, ChainSpec, Hardfork, U64};
|
||||
use reth_primitives::{BlockHash, BlockHashOrNumber, BlockNumber, ChainSpec, Hardfork, H256, U64};
|
||||
use reth_provider::{BlockReader, EvmEnvProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_rpc_api::EngineApiServer;
|
||||
use reth_rpc_types::engine::{
|
||||
@@ -355,6 +355,15 @@ where
|
||||
Ok(EngineApi::new_payload_v2(self, payload).await?)
|
||||
}
|
||||
|
||||
async fn new_payload_v3(
|
||||
&self,
|
||||
_payload: ExecutionPayload,
|
||||
_versioned_hashes: Vec<H256>,
|
||||
_parent_beacon_block_root: H256,
|
||||
) -> RpcResult<PayloadStatus> {
|
||||
Err(jsonrpsee_types::error::ErrorCode::MethodNotFound.into())
|
||||
}
|
||||
|
||||
/// Handler for `engine_forkchoiceUpdatedV1`
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/3d627c95a4d3510a8187dd02e0250ecb4331d27e/src/engine/paris.md#engine_forkchoiceupdatedv1>
|
||||
///
|
||||
@@ -409,6 +418,10 @@ where
|
||||
Ok(EngineApi::get_payload_v2(self, payload_id).await?)
|
||||
}
|
||||
|
||||
async fn get_payload_v3(&self, _payload_id: PayloadId) -> RpcResult<ExecutionPayloadEnvelope> {
|
||||
Err(jsonrpsee_types::error::ErrorCode::MethodNotFound.into())
|
||||
}
|
||||
|
||||
/// Handler for `engine_getPayloadBodiesByHashV1`
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/6452a6b194d7db269bf1dbd087a267251d3cc7f8/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1>
|
||||
async fn get_payload_bodies_by_hash_v1(
|
||||
|
||||
@@ -46,6 +46,10 @@ pub struct ExecutionPayloadEnvelope {
|
||||
/// The expected value to be received by the feeRecipient in wei
|
||||
#[serde(rename = "blockValue")]
|
||||
pub block_value: U256,
|
||||
//
|
||||
// // TODO(mattsse): for V3
|
||||
// #[serde(rename = "blobsBundle", skip_serializing_if = "Option::is_none")]
|
||||
// pub blobs_bundle: Option<BlobsBundleV1>,
|
||||
}
|
||||
|
||||
impl ExecutionPayloadEnvelope {
|
||||
@@ -187,6 +191,14 @@ impl TryFrom<ExecutionPayload> for SealedBlock {
|
||||
}
|
||||
}
|
||||
|
||||
/// This includes all bundled blob related data of an executed payload.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct BlobsBundleV1 {
|
||||
pub commitments: Vec<Bytes>,
|
||||
pub proofs: Vec<Bytes>,
|
||||
pub blobs: Vec<Bytes>,
|
||||
}
|
||||
|
||||
/// Error that can occur when handling payloads.
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum PayloadError {
|
||||
|
||||
Reference in New Issue
Block a user