diff --git a/crates/provider/src/ext/engine.rs b/crates/provider/src/ext/engine.rs index 803f1f1ccba..b5c00cf80f5 100644 --- a/crates/provider/src/ext/engine.rs +++ b/crates/provider/src/ext/engine.rs @@ -1,14 +1,14 @@ +use crate::Provider; use alloy_network::Network; use alloy_primitives::{BlockHash, B256}; use alloy_rpc_types_engine::{ ClientVersionV1, ExecutionPayloadBodiesV1, ExecutionPayloadEnvelopeV2, - ExecutionPayloadEnvelopeV3, ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3, - ForkchoiceState, ForkchoiceUpdated, PayloadAttributes, PayloadId, PayloadStatus, + ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4, ExecutionPayloadInputV2, + ExecutionPayloadV1, ExecutionPayloadV3, ExecutionPayloadV4, ForkchoiceState, ForkchoiceUpdated, + PayloadAttributes, PayloadId, PayloadStatus, }; use alloy_transport::{Transport, TransportResult}; -use crate::Provider; - /// Extension trait that gives access to engine API RPC methods. /// /// Note: @@ -41,6 +41,16 @@ pub trait EngineApi: Send + Sync { parent_beacon_block_root: B256, ) -> TransportResult; + /// Sends the given payload to the execution layer client, as specified for the Prague fork. + /// + /// See also + async fn new_payload_v4( + &self, + payload: ExecutionPayloadV4, + versioned_hashes: Vec, + parent_beacon_block_root: B256, + ) -> TransportResult; + /// Updates the execution layer client with the given fork choice, as specified for the Paris /// fork. /// @@ -110,6 +120,18 @@ pub trait EngineApi: Send + Sync { payload_id: PayloadId, ) -> TransportResult; + /// Returns the most recent version of the payload that is available in the corresponding + /// payload build process at the time of receiving this call. + /// + /// See also + /// + /// Note: + /// > Provider software MAY stop the corresponding build process after serving this call. + async fn get_payload_v4( + &self, + payload_id: PayloadId, + ) -> TransportResult; + /// Returns the execution payload bodies by the given hash. /// /// See also @@ -186,6 +208,17 @@ where .await } + async fn new_payload_v4( + &self, + payload: ExecutionPayloadV4, + versioned_hashes: Vec, + parent_beacon_block_root: B256, + ) -> TransportResult { + self.client() + .request("engine_newPayloadV4", (payload, versioned_hashes, parent_beacon_block_root)) + .await + } + async fn fork_choice_updated_v1( &self, fork_choice_state: ForkchoiceState, @@ -234,6 +267,13 @@ where self.client().request("engine_getPayloadV3", (payload_id,)).await } + async fn get_payload_v4( + &self, + payload_id: PayloadId, + ) -> TransportResult { + self.client().request("engine_getPayloadV4", (payload_id,)).await + } + async fn get_payload_bodies_by_hash_v1( &self, block_hashes: Vec,