op_alloy::provider::ext::engine

Trait OpEngineApi

Source
pub trait OpEngineApi<N, T>: Send + Sync {
Show 13 methods // Required methods fn new_payload_v2<'life0, 'async_trait>( &'life0 self, payload: ExecutionPayloadInputV2, ) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, RpcError<TransportErrorKind>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn new_payload_v3<'life0, 'async_trait>( &'life0 self, payload: ExecutionPayloadV3, parent_beacon_block_root: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, RpcError<TransportErrorKind>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn new_payload_v4<'life0, 'async_trait>( &'life0 self, payload: ExecutionPayloadV3, parent_beacon_block_root: FixedBytes<32>, execution_requests: Vec<Bytes>, ) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, RpcError<TransportErrorKind>>> + 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<OpPayloadAttributes>, ) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, RpcError<TransportErrorKind>>> + 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<OpPayloadAttributes>, ) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, RpcError<TransportErrorKind>>> + 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<ExecutionPayloadEnvelopeV2, RpcError<TransportErrorKind>>> + 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<OpExecutionPayloadEnvelopeV3, RpcError<TransportErrorKind>>> + 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<OpExecutionPayloadEnvelopeV4, RpcError<TransportErrorKind>>> + 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>>, RpcError<TransportErrorKind>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_payload_bodies_by_range_v1<'life0, 'async_trait>( &'life0 self, start: u64, count: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ExecutionPayloadBodyV1>>, RpcError<TransportErrorKind>>> + 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>, RpcError<TransportErrorKind>>> + 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>, RpcError<TransportErrorKind>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn signal_superchain_v1<'life0, 'async_trait>( &'life0 self, signal: SuperchainSignal, ) -> Pin<Box<dyn Future<Output = Result<ProtocolVersion, RpcError<TransportErrorKind>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait;
}
Available on crate feature provider only.
Expand description

Extension trait that gives access to Optimism engine API RPC methods.

Note:

The provider should use a JWT authentication layer.

This follows the Optimism specs that can be found at: https://specs.optimism.io/protocol/exec-engine.html#engine-api

Required Methods§

Source

fn new_payload_v2<'life0, 'async_trait>( &'life0 self, payload: ExecutionPayloadInputV2, ) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, RpcError<TransportErrorKind>>> + 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.

See also https://github.com/ethereum/execution-apis/blob/584905270d8ad665718058060267061ecfd79ca5/src/engine/shanghai.md#engine_newpayloadv2

No modifications needed for OP compatibility.

Source

fn new_payload_v3<'life0, 'async_trait>( &'life0 self, payload: ExecutionPayloadV3, parent_beacon_block_root: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, RpcError<TransportErrorKind>>> + 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.
Source

fn new_payload_v4<'life0, 'async_trait>( &'life0 self, payload: ExecutionPayloadV3, parent_beacon_block_root: FixedBytes<32>, execution_requests: Vec<Bytes>, ) -> Pin<Box<dyn Future<Output = Result<PayloadStatus, RpcError<TransportErrorKind>>> + 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.

See also https://github.com/ethereum/execution-apis/blob/03911ffc053b8b806123f1fc237184b0092a485a/src/engine/prague.md#engine_newpayloadv4

OP modifications: TODO

Source

fn fork_choice_updated_v2<'life0, 'async_trait>( &'life0 self, fork_choice_state: ForkchoiceState, payload_attributes: Option<OpPayloadAttributes>, ) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, RpcError<TransportErrorKind>>> + 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.

See also https://github.com/ethereum/execution-apis/blob/6709c2a795b707202e93c4f2867fa0bf2640a84f/src/engine/shanghai.md#engine_forkchoiceupdatedv2

OP modifications:

Source

fn fork_choice_updated_v3<'life0, 'async_trait>( &'life0 self, fork_choice_state: ForkchoiceState, payload_attributes: Option<OpPayloadAttributes>, ) -> Pin<Box<dyn Future<Output = Result<ForkchoiceUpdated, RpcError<TransportErrorKind>>> + 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:

Source

fn get_payload_v2<'life0, 'async_trait>( &'life0 self, payload_id: PayloadId, ) -> Pin<Box<dyn Future<Output = Result<ExecutionPayloadEnvelopeV2, RpcError<TransportErrorKind>>> + 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.

See also https://github.com/ethereum/execution-apis/blob/6709c2a795b707202e93c4f2867fa0bf2640a84f/src/engine/shanghai.md#engine_getpayloadv2

Note:

Provider software MAY stop the corresponding build process after serving this call.

No modifications needed for OP compatibility.

Source

fn get_payload_v3<'life0, 'async_trait>( &'life0 self, payload_id: PayloadId, ) -> Pin<Box<dyn Future<Output = Result<OpExecutionPayloadEnvelopeV3, RpcError<TransportErrorKind>>> + 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:

Source

fn get_payload_v4<'life0, 'async_trait>( &'life0 self, payload_id: PayloadId, ) -> Pin<Box<dyn Future<Output = Result<OpExecutionPayloadEnvelopeV4, RpcError<TransportErrorKind>>> + 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:

Source

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>>, RpcError<TransportErrorKind>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source

fn get_payload_bodies_by_range_v1<'life0, 'async_trait>( &'life0 self, start: u64, count: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ExecutionPayloadBodyV1>>, RpcError<TransportErrorKind>>> + 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.

See also https://github.com/ethereum/execution-apis/blob/6452a6b194d7db269bf1dbd087a267251d3cc7f8/src/engine/shanghai.md#engine_getpayloadbodiesbyrangev1

Source

fn get_client_version_v1<'life0, 'async_trait>( &'life0 self, client_version: ClientVersionV1, ) -> Pin<Box<dyn Future<Output = Result<Vec<ClientVersionV1>, RpcError<TransportErrorKind>>> + 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.

See also https://github.com/ethereum/execution-apis/blob/main/src/engine/identification.md#engine_getclientversionv1

Source

fn exchange_capabilities<'life0, 'async_trait>( &'life0 self, capabilities: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, RpcError<TransportErrorKind>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the list of Engine API methods supported by the execution layer client software.

See also https://github.com/ethereum/execution-apis/blob/6452a6b194d7db269bf1dbd087a267251d3cc7f8/src/engine/common.md#capabilities

Source

fn signal_superchain_v1<'life0, 'async_trait>( &'life0 self, signal: SuperchainSignal, ) -> Pin<Box<dyn Future<Output = Result<ProtocolVersion, RpcError<TransportErrorKind>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Signals superchain information to the Engine

V1 signals which protocol version is recommended and required.

Implementors§

Source§

impl<N, T, P> OpEngineApi<N, T> for P
where N: Network, T: Transport + Clone, P: Provider<T, N>,