mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(engine): rename enveloped associated types to envelope (#11812)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -29,7 +29,7 @@ impl<E: EngineTypes> EngineApiTestContext<E> {
|
||||
pub async fn get_payload_v3(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> eyre::Result<E::ExecutionPayloadV3> {
|
||||
) -> eyre::Result<E::ExecutionPayloadEnvelopeV3> {
|
||||
Ok(EngineApiClient::<E>::get_payload_v3(&self.engine_api_client, payload_id).await?)
|
||||
}
|
||||
|
||||
@ -50,10 +50,10 @@ impl<E: EngineTypes> EngineApiTestContext<E> {
|
||||
versioned_hashes: Vec<B256>,
|
||||
) -> eyre::Result<B256>
|
||||
where
|
||||
E::ExecutionPayloadV3: From<E::BuiltPayload> + PayloadEnvelopeExt,
|
||||
E::ExecutionPayloadEnvelopeV3: From<E::BuiltPayload> + PayloadEnvelopeExt,
|
||||
{
|
||||
// setup payload for submission
|
||||
let envelope_v3: <E as EngineTypes>::ExecutionPayloadV3 = payload.into();
|
||||
let envelope_v3: <E as EngineTypes>::ExecutionPayloadEnvelopeV3 = payload.into();
|
||||
|
||||
// submit payload to engine api
|
||||
let submission = EngineApiClient::<E>::new_payload_v3(
|
||||
|
||||
@ -88,7 +88,7 @@ where
|
||||
attributes_generator: impl Fn(u64) -> Engine::PayloadBuilderAttributes + Copy,
|
||||
) -> eyre::Result<Vec<(Engine::BuiltPayload, Engine::PayloadBuilderAttributes)>>
|
||||
where
|
||||
Engine::ExecutionPayloadV3: From<Engine::BuiltPayload> + PayloadEnvelopeExt,
|
||||
Engine::ExecutionPayloadEnvelopeV3: From<Engine::BuiltPayload> + PayloadEnvelopeExt,
|
||||
AddOns::EthApi: EthApiSpec + EthTransactions + TraceExt + FullEthApiTypes,
|
||||
{
|
||||
let mut chain = Vec::with_capacity(length as usize);
|
||||
@ -113,7 +113,7 @@ where
|
||||
attributes_generator: impl Fn(u64) -> Engine::PayloadBuilderAttributes,
|
||||
) -> eyre::Result<(Engine::BuiltPayload, Engine::PayloadBuilderAttributes)>
|
||||
where
|
||||
<Engine as EngineTypes>::ExecutionPayloadV3:
|
||||
<Engine as EngineTypes>::ExecutionPayloadEnvelopeV3:
|
||||
From<Engine::BuiltPayload> + PayloadEnvelopeExt,
|
||||
{
|
||||
// trigger new payload building draining the pool
|
||||
@ -135,7 +135,7 @@ where
|
||||
attributes_generator: impl Fn(u64) -> Engine::PayloadBuilderAttributes,
|
||||
) -> eyre::Result<(Engine::BuiltPayload, Engine::PayloadBuilderAttributes)>
|
||||
where
|
||||
<Engine as EngineTypes>::ExecutionPayloadV3:
|
||||
<Engine as EngineTypes>::ExecutionPayloadEnvelopeV3:
|
||||
From<Engine::BuiltPayload> + PayloadEnvelopeExt,
|
||||
{
|
||||
let (payload, eth_attr) = self.new_payload(attributes_generator).await?;
|
||||
|
||||
@ -24,9 +24,9 @@ use serde::{de::DeserializeOwned, ser::Serialize};
|
||||
pub trait EngineTypes:
|
||||
PayloadTypes<
|
||||
BuiltPayload: TryInto<Self::ExecutionPayloadV1>
|
||||
+ TryInto<Self::ExecutionPayloadV2>
|
||||
+ TryInto<Self::ExecutionPayloadV3>
|
||||
+ TryInto<Self::ExecutionPayloadV4>,
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV2>
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV3>
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV4>,
|
||||
> + DeserializeOwned
|
||||
+ Serialize
|
||||
+ 'static
|
||||
@ -34,11 +34,29 @@ pub trait EngineTypes:
|
||||
/// Execution Payload V1 type.
|
||||
type ExecutionPayloadV1: DeserializeOwned + Serialize + Clone + Unpin + Send + Sync + 'static;
|
||||
/// Execution Payload V2 type.
|
||||
type ExecutionPayloadV2: DeserializeOwned + Serialize + Clone + Unpin + Send + Sync + 'static;
|
||||
type ExecutionPayloadEnvelopeV2: DeserializeOwned
|
||||
+ Serialize
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static;
|
||||
/// Execution Payload V3 type.
|
||||
type ExecutionPayloadV3: DeserializeOwned + Serialize + Clone + Unpin + Send + Sync + 'static;
|
||||
type ExecutionPayloadEnvelopeV3: DeserializeOwned
|
||||
+ Serialize
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static;
|
||||
/// Execution Payload V4 type.
|
||||
type ExecutionPayloadV4: DeserializeOwned + Serialize + Clone + Unpin + Send + Sync + 'static;
|
||||
type ExecutionPayloadEnvelopeV4: DeserializeOwned
|
||||
+ Serialize
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static;
|
||||
}
|
||||
|
||||
/// Type that validates the payloads sent to the engine.
|
||||
|
||||
@ -44,9 +44,9 @@ where
|
||||
+ TryInto<ExecutionPayloadEnvelopeV4>,
|
||||
{
|
||||
type ExecutionPayloadV1 = ExecutionPayloadV1;
|
||||
type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadV3 = ExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadV4 = ExecutionPayloadEnvelopeV4;
|
||||
type ExecutionPayloadEnvelopeV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadEnvelopeV3 = ExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadEnvelopeV4 = ExecutionPayloadEnvelopeV4;
|
||||
}
|
||||
|
||||
/// A default payload type for [`EthEngineTypes`]
|
||||
|
||||
@ -38,9 +38,9 @@ where
|
||||
+ TryInto<OpExecutionPayloadEnvelopeV4>,
|
||||
{
|
||||
type ExecutionPayloadV1 = ExecutionPayloadV1;
|
||||
type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadV3 = OpExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadV4 = OpExecutionPayloadEnvelopeV4;
|
||||
type ExecutionPayloadEnvelopeV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadEnvelopeV3 = OpExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadEnvelopeV4 = OpExecutionPayloadEnvelopeV4;
|
||||
}
|
||||
|
||||
/// A default payload type for [`OptimismEngineTypes`]
|
||||
|
||||
@ -118,7 +118,10 @@ pub trait EngineApi<Engine: EngineTypes> {
|
||||
/// 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 = "getPayloadV2")]
|
||||
async fn get_payload_v2(&self, payload_id: PayloadId) -> RpcResult<Engine::ExecutionPayloadV2>;
|
||||
async fn get_payload_v2(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> RpcResult<Engine::ExecutionPayloadEnvelopeV2>;
|
||||
|
||||
/// Post Cancun payload handler which also returns a blobs bundle.
|
||||
///
|
||||
@ -128,7 +131,10 @@ pub trait EngineApi<Engine: EngineTypes> {
|
||||
/// 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<Engine::ExecutionPayloadV3>;
|
||||
async fn get_payload_v3(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> RpcResult<Engine::ExecutionPayloadEnvelopeV3>;
|
||||
|
||||
/// Post Prague payload handler.
|
||||
///
|
||||
@ -138,7 +144,10 @@ pub trait EngineApi<Engine: EngineTypes> {
|
||||
/// 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 = "getPayloadV4")]
|
||||
async fn get_payload_v4(&self, payload_id: PayloadId) -> RpcResult<Engine::ExecutionPayloadV4>;
|
||||
async fn get_payload_v4(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> RpcResult<Engine::ExecutionPayloadEnvelopeV4>;
|
||||
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/6452a6b194d7db269bf1dbd087a267251d3cc7f8/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1>
|
||||
#[method(name = "getPayloadBodiesByHashV1")]
|
||||
|
||||
@ -289,7 +289,7 @@ where
|
||||
pub async fn get_payload_v2(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> EngineApiResult<EngineT::ExecutionPayloadV2> {
|
||||
) -> EngineApiResult<EngineT::ExecutionPayloadEnvelopeV2> {
|
||||
// First we fetch the payload attributes to check the timestamp
|
||||
let attributes = self.get_payload_attributes(payload_id).await?;
|
||||
|
||||
@ -324,7 +324,7 @@ where
|
||||
pub async fn get_payload_v3(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> EngineApiResult<EngineT::ExecutionPayloadV3> {
|
||||
) -> EngineApiResult<EngineT::ExecutionPayloadEnvelopeV3> {
|
||||
// First we fetch the payload attributes to check the timestamp
|
||||
let attributes = self.get_payload_attributes(payload_id).await?;
|
||||
|
||||
@ -359,7 +359,7 @@ where
|
||||
pub async fn get_payload_v4(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> EngineApiResult<EngineT::ExecutionPayloadV4> {
|
||||
) -> EngineApiResult<EngineT::ExecutionPayloadEnvelopeV4> {
|
||||
// First we fetch the payload attributes to check the timestamp
|
||||
let attributes = self.get_payload_attributes(payload_id).await?;
|
||||
|
||||
@ -778,7 +778,7 @@ where
|
||||
async fn get_payload_v2(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> RpcResult<EngineT::ExecutionPayloadV2> {
|
||||
) -> RpcResult<EngineT::ExecutionPayloadEnvelopeV2> {
|
||||
trace!(target: "rpc::engine", "Serving engine_getPayloadV2");
|
||||
let start = Instant::now();
|
||||
let res = Self::get_payload_v2(self, payload_id).await;
|
||||
@ -798,7 +798,7 @@ where
|
||||
async fn get_payload_v3(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> RpcResult<EngineT::ExecutionPayloadV3> {
|
||||
) -> RpcResult<EngineT::ExecutionPayloadEnvelopeV3> {
|
||||
trace!(target: "rpc::engine", "Serving engine_getPayloadV3");
|
||||
let start = Instant::now();
|
||||
let res = Self::get_payload_v3(self, payload_id).await;
|
||||
@ -818,7 +818,7 @@ where
|
||||
async fn get_payload_v4(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> RpcResult<EngineT::ExecutionPayloadV4> {
|
||||
) -> RpcResult<EngineT::ExecutionPayloadEnvelopeV4> {
|
||||
trace!(target: "rpc::engine", "Serving engine_getPayloadV4");
|
||||
let start = Instant::now();
|
||||
let res = Self::get_payload_v4(self, payload_id).await;
|
||||
|
||||
@ -157,9 +157,9 @@ impl PayloadTypes for CustomEngineTypes {
|
||||
|
||||
impl EngineTypes for CustomEngineTypes {
|
||||
type ExecutionPayloadV1 = ExecutionPayloadV1;
|
||||
type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadV3 = ExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadV4 = ExecutionPayloadEnvelopeV4;
|
||||
type ExecutionPayloadEnvelopeV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadEnvelopeV3 = ExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadEnvelopeV4 = ExecutionPayloadEnvelopeV4;
|
||||
}
|
||||
|
||||
/// Custom engine validator
|
||||
|
||||
Reference in New Issue
Block a user