Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit fb2f675

Browse files
committed
extend engine api trait
1 parent c01acf6 commit fb2f675

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

crates/engine/src/client.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use alloy_provider::{ReqwestProvider, RootProvider};
77
use alloy_rpc_client::RpcClient;
88
use alloy_rpc_types_engine::{
99
ExecutionPayloadV3, ForkchoiceState, ForkchoiceUpdated, JwtSecret, PayloadId, PayloadStatus,
10+
ExecutionPayloadEnvelopeV2,
1011
};
1112
use alloy_transport_http::{
1213
hyper_util::{
@@ -64,13 +65,21 @@ impl EngineClient {
6465
impl Engine for EngineClient {
6566
type Error = EngineError;
6667

67-
async fn get_payload(
68+
async fn get_payload_v2(
69+
&self,
70+
payload_id: PayloadId,
71+
) -> Result<ExecutionPayloadEnvelopeV2, Self::Error> {
72+
self.engine.get_payload_v2(payload_id).await.map_err(|_| EngineError::PayloadError)
73+
}
74+
75+
async fn get_payload_v3(
6876
&self,
6977
payload_id: PayloadId,
7078
) -> Result<OpExecutionPayloadEnvelopeV3, Self::Error> {
7179
self.engine.get_payload_v3(payload_id).await.map_err(|_| EngineError::PayloadError)
7280
}
7381

82+
7483
async fn forkchoice_update(
7584
&self,
7685
state: ForkchoiceState,

crates/engine/src/traits.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use alloy_eips::eip1898::BlockNumberOrTag;
44
use alloy_primitives::B256;
55
use alloy_rpc_types_engine::{
66
ExecutionPayloadV3, ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus,
7+
ExecutionPayloadEnvelopeV2,
78
};
89
use async_trait::async_trait;
910
use op_alloy_protocol::L2BlockInfo;
@@ -17,7 +18,13 @@ pub trait Engine {
1718
type Error: core::fmt::Debug;
1819

1920
/// Gets a payload for the given payload id.
20-
async fn get_payload(
21+
async fn get_payload_v2(
22+
&self,
23+
payload_id: PayloadId,
24+
) -> Result<ExecutionPayloadEnvelopeV2, Self::Error>;
25+
26+
/// Gets a payload for the given payload id.
27+
async fn get_payload_v3(
2128
&self,
2229
payload_id: PayloadId,
2330
) -> Result<OpExecutionPayloadEnvelopeV3, Self::Error>;

0 commit comments

Comments
 (0)