Trait OpEngineApiServer
pub trait OpEngineApiServer<Engine>:
Sized
+ Send
+ Sync
+ 'staticwhere
Engine: EngineTypes,{
Show 13 methods
// Required methods
fn new_payload_v2<'life0, 'async_trait>(
&'life0 self,
payload: ExecutionPayloadInputV2,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn new_payload_v3<'life0, 'async_trait>(
&'life0 self,
payload: ExecutionPayloadV3,
versioned_hashes: Vec<FixedBytes<32>>,
parent_beacon_block_root: FixedBytes<32>,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn new_payload_v4<'life0, 'async_trait>(
&'life0 self,
payload: OpExecutionPayloadV4,
versioned_hashes: Vec<FixedBytes<32>>,
parent_beacon_block_root: FixedBytes<32>,
execution_requests: Requests,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn fork_choice_updated_v2<'life0, 'async_trait>(
&'life0 self,
fork_choice_state: ForkchoiceState,
payload_attributes: Option<<Engine as PayloadTypes>::PayloadAttributes>,
) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn fork_choice_updated_v3<'life0, 'async_trait>(
&'life0 self,
fork_choice_state: ForkchoiceState,
payload_attributes: Option<<Engine as PayloadTypes>::PayloadAttributes>,
) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_payload_v2<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV2, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_payload_v3<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV3, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_payload_v4<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV4, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_payload_bodies_by_hash_v1<'life0, 'async_trait>(
&'life0 self,
block_hashes: Vec<FixedBytes<32>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ExecutionPayloadBodyV1>>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_payload_bodies_by_range_v1<'life0, 'async_trait>(
&'life0 self,
start: Uint<64, 1>,
count: Uint<64, 1>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ExecutionPayloadBodyV1>>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_client_version_v1<'life0, 'async_trait>(
&'life0 self,
client_version: ClientVersionV1,
) -> Pin<Box<dyn Future<Output = Result<Vec<ClientVersionV1>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn exchange_capabilities<'life0, 'async_trait>(
&'life0 self,
capabilities: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided method
fn into_rpc(self) -> RpcModule<Self>
where <Engine as PayloadTypes>::PayloadAttributes: DeserializeOwned { ... }
}
rpc
only.Expand description
Server trait implementation for the OpEngineApi
RPC API.
Required Methods§
fn new_payload_v2<'life0, 'async_trait>(
&'life0 self,
payload: ExecutionPayloadInputV2,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn new_payload_v2<'life0, 'async_trait>(
&'life0 self,
payload: ExecutionPayloadInputV2,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Sends the given payload to the execution layer client, as specified for the Shanghai fork.
No modifications needed for OP compatibility.
fn new_payload_v3<'life0, 'async_trait>(
&'life0 self,
payload: ExecutionPayloadV3,
versioned_hashes: Vec<FixedBytes<32>>,
parent_beacon_block_root: FixedBytes<32>,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn new_payload_v3<'life0, 'async_trait>(
&'life0 self,
payload: ExecutionPayloadV3,
versioned_hashes: Vec<FixedBytes<32>>,
parent_beacon_block_root: FixedBytes<32>,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Sends the given payload to the execution layer client, as specified for the Cancun fork.
See also https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#engine_newpayloadv3
OP modifications:
- expected versioned hashes MUST be an empty array: therefore the
versioned_hashes
parameter is removed. - parent beacon block root MUST be the parent beacon block root from the L1 origin block of the L2 block.
- blob versioned hashes MUST be empty list.
fn new_payload_v4<'life0, 'async_trait>(
&'life0 self,
payload: OpExecutionPayloadV4,
versioned_hashes: Vec<FixedBytes<32>>,
parent_beacon_block_root: FixedBytes<32>,
execution_requests: Requests,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn new_payload_v4<'life0, 'async_trait>(
&'life0 self,
payload: OpExecutionPayloadV4,
versioned_hashes: Vec<FixedBytes<32>>,
parent_beacon_block_root: FixedBytes<32>,
execution_requests: Requests,
) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Sends the given payload to the execution layer client, as specified for the Prague fork.
- blob versioned hashes MUST be empty list.
- execution layer requests MUST be empty list.
fn fork_choice_updated_v2<'life0, 'async_trait>(
&'life0 self,
fork_choice_state: ForkchoiceState,
payload_attributes: Option<<Engine as PayloadTypes>::PayloadAttributes>,
) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn fork_choice_updated_v2<'life0, 'async_trait>(
&'life0 self,
fork_choice_state: ForkchoiceState,
payload_attributes: Option<<Engine as PayloadTypes>::PayloadAttributes>,
) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Updates the execution layer client with the given fork choice, as specified for the Shanghai fork.
Caution: This should not accept the parentBeaconBlockRoot
field in the payload attributes.
OP modifications:
- The
payload_attributes
parameter is extended with theEngineTypes::PayloadAttributes
type as described in https://specs.optimism.io/protocol/exec-engine.html#extended-payloadattributesv2
fn fork_choice_updated_v3<'life0, 'async_trait>(
&'life0 self,
fork_choice_state: ForkchoiceState,
payload_attributes: Option<<Engine as PayloadTypes>::PayloadAttributes>,
) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn fork_choice_updated_v3<'life0, 'async_trait>(
&'life0 self,
fork_choice_state: ForkchoiceState,
payload_attributes: Option<<Engine as PayloadTypes>::PayloadAttributes>,
) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Updates the execution layer client with the given fork choice, as specified for the Cancun fork.
See also https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#engine_forkchoiceupdatedv3
OP modifications:
- Must be called with an Ecotone payload
- Attributes must contain the parent beacon block root field
- The
payload_attributes
parameter is extended with theEngineTypes::PayloadAttributes
type as described in https://specs.optimism.io/protocol/exec-engine.html#extended-payloadattributesv2
fn get_payload_v2<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV2, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_payload_v2<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV2, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Retrieves an execution payload from a previously started build process, as specified for the Shanghai fork.
Note:
Provider software MAY stop the corresponding build process after serving this call.
No modifications needed for OP compatibility.
fn get_payload_v3<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV3, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_payload_v3<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV3, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Retrieves an execution payload from a previously started build process, as specified for the Cancun fork.
See also https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#engine_getpayloadv3
Note:
Provider software MAY stop the corresponding build process after serving this call.
OP modifications:
- the response type is extended to
EngineTypes::ExecutionPayloadEnvelopeV3
.
fn get_payload_v4<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV4, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_payload_v4<'life0, 'async_trait>(
&'life0 self,
payload_id: PayloadId,
) -> Pin<Box<dyn Future<Output = Result<<Engine as EngineTypes>::ExecutionPayloadEnvelopeV4, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
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 https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md#engine_getpayloadv4
Note:
Provider software MAY stop the corresponding build process after serving this call.
OP modifications:
- the response type is extended to
EngineTypes::ExecutionPayloadEnvelopeV4
.
fn get_payload_bodies_by_hash_v1<'life0, 'async_trait>(
&'life0 self,
block_hashes: Vec<FixedBytes<32>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ExecutionPayloadBodyV1>>, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_payload_bodies_by_hash_v1<'life0, 'async_trait>(
&'life0 self,
block_hashes: Vec<FixedBytes<32>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ExecutionPayloadBodyV1>>, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Returns the execution payload bodies by the given hash.
fn get_payload_bodies_by_range_v1<'life0, 'async_trait>(
&'life0 self,
start: Uint<64, 1>,
count: Uint<64, 1>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ExecutionPayloadBodyV1>>, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_payload_bodies_by_range_v1<'life0, 'async_trait>(
&'life0 self,
start: Uint<64, 1>,
count: Uint<64, 1>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ExecutionPayloadBodyV1>>, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Returns the execution payload bodies by the range starting at start
, containing count
blocks.
WARNING: This method is associated with the BeaconBlocksByRange message in the consensus layer p2p specification, meaning the input should be treated as untrusted or potentially adversarial.
Implementers should take care when acting on the input to this method, specifically ensuring that the range is limited properly, and that the range boundaries are computed correctly and without panics.
fn get_client_version_v1<'life0, 'async_trait>(
&'life0 self,
client_version: ClientVersionV1,
) -> Pin<Box<dyn Future<Output = Result<Vec<ClientVersionV1>, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_client_version_v1<'life0, 'async_trait>(
&'life0 self,
client_version: ClientVersionV1,
) -> Pin<Box<dyn Future<Output = Result<Vec<ClientVersionV1>, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Returns the execution client version information.
Note:
The
client_version
parameter identifies the consensus client.
fn exchange_capabilities<'life0, 'async_trait>(
&'life0 self,
capabilities: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn exchange_capabilities<'life0, 'async_trait>(
&'life0 self,
capabilities: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ErrorObject<'static>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Returns the list of Engine API methods supported by the execution layer client software.
Provided Methods§
fn into_rpc(self) -> RpcModule<Self>
fn into_rpc(self) -> RpcModule<Self>
Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.