Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(engine): rename enveloped associated types to envelope #11812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/e2e-test-utils/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?)
}

Expand All @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions crates/e2e-test-utils/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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?;
Expand Down
30 changes: 24 additions & 6 deletions crates/engine/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,39 @@ 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
{
/// 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.
Expand Down
6 changes: 3 additions & 3 deletions crates/ethereum/engine-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand Down
6 changes: 3 additions & 3 deletions crates/optimism/node/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand Down
15 changes: 12 additions & 3 deletions crates/rpc/rpc-api/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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.
///
Expand All @@ -127,7 +130,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.
///
Expand All @@ -137,7 +143,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")]
Expand Down
12 changes: 6 additions & 6 deletions crates/rpc/rpc-engine-api/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,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?;

Expand Down Expand Up @@ -316,7 +316,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?;

Expand Down Expand Up @@ -351,7 +351,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?;

Expand Down Expand Up @@ -785,7 +785,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;
Expand All @@ -805,7 +805,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;
Expand All @@ -825,7 +825,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;
Expand Down
6 changes: 3 additions & 3 deletions examples/custom-engine-types/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,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
Expand Down
Loading