Enum OpExecutionPayload

Source
pub enum OpExecutionPayload {
    V1(ExecutionPayloadV1),
    V2(ExecutionPayloadV2),
    V3(ExecutionPayloadV3),
    V4(OpExecutionPayloadV4),
}
Available on crate feature rpc-types-engine only.
Expand description

An execution payload, which can be either ExecutionPayloadV2, ExecutionPayloadV3, or OpExecutionPayloadV4.

Variants§

§

V1(ExecutionPayloadV1)

V1 payload

§

V2(ExecutionPayloadV2)

V2 payload

§

V3(ExecutionPayloadV3)

V3 payload

§

V4(OpExecutionPayloadV4)

V4 payload

Implementations§

Source§

impl OpExecutionPayload

Source

pub fn from_block_slow<T, H>( block: &Block<T, H>, ) -> (OpExecutionPayload, OpExecutionPayloadSidecar)

Conversion from alloy_consensus::Block. Also returns the OpExecutionPayloadSidecar extracted from the block.

See also from_block_unchecked.

Note: This re-calculates the block hash.

Source

pub fn from_block_unchecked<T, H>( block_hash: FixedBytes<32>, block: &Block<T, H>, ) -> (OpExecutionPayload, OpExecutionPayloadSidecar)

Conversion from alloy_consensus::Block. Also returns the OpExecutionPayloadSidecar extracted from the block.

See also ExecutionPayload::from_block_unchecked. See also OpExecutionPayloadSidecar::from_block.

Source

pub fn v2(payload: ExecutionPayloadInputV2) -> OpExecutionPayload

Creates a new instance from newPayloadV2 payload, i.e. V1 or V2 variant.

Spec: https://specs.optimism.io/protocol/exec-engine.html#engine_newpayloadv2

Source

pub const fn v3(payload: ExecutionPayloadV3) -> OpExecutionPayload

Creates a new instance from newPayloadV3 payload, i.e. V3 variant.

Spec: https://specs.optimism.io/protocol/exec-engine.html#engine_newpayloadv3

Source

pub const fn v4(payload: OpExecutionPayloadV4) -> OpExecutionPayload

Creates a new instance from newPayloadV4 payload, i.e. V4 variant.

Spec: https://specs.optimism.io/protocol/exec-engine.html#engine_newpayloadv4

Source

pub const fn as_v1(&self) -> &ExecutionPayloadV1

Returns a reference to the V1 payload.

Source

pub fn as_v1_mut(&mut self) -> &mut ExecutionPayloadV1

Returns a mutable reference to the V1 payload.

Source

pub const fn as_v2(&self) -> Option<&ExecutionPayloadV2>

Returns a reference to the V2 payload, if any.

Source

pub fn as_v2_mut(&mut self) -> Option<&mut ExecutionPayloadV2>

Returns a mutable reference to the V2 payload, if any.

Source

pub const fn as_v3(&self) -> Option<&ExecutionPayloadV3>

Returns a reference to the V3 payload, if any.

Source

pub fn as_v3_mut(&mut self) -> Option<&mut ExecutionPayloadV3>

Returns a mutable reference to the V3 payload, if any.

Source

pub const fn as_v4(&self) -> Option<&OpExecutionPayloadV4>

Returns a reference to the V4 payload, if any.

Source

pub fn as_v4_mut(&mut self) -> Option<&mut OpExecutionPayloadV4>

Returns a mutable reference to the V4 payload, if any.

Source

pub const fn parent_hash(&self) -> FixedBytes<32>

Returns the parent hash for the payload.

Source

pub const fn block_hash(&self) -> FixedBytes<32>

Returns the block hash for the payload.

Source

pub const fn block_number(&self) -> u64

Returns the block number for this payload.

Source

pub fn try_into_block<T>(self) -> Result<Block<T>, OpPayloadError>

Converts OpExecutionPayload to Block.

Checks that payload doesn’t contain:

  • blob transactions
  • L1 withdrawals

Caution: This does not set fields that are not part of the payload and only part of the OpExecutionPayloadSidecar:

  • parent_beacon_block_root

See also: OpExecutionPayload::try_into_block_with_sidecar

Source

pub fn try_into_block_with_sidecar<T>( self, sidecar: &OpExecutionPayloadSidecar, ) -> Result<Block<T>, OpPayloadError>

Tries to create a new unsealed block from the given payload and payload sidecar.

Additional to checks preformed in OpExecutionPayload::try_into_block, which is called under the hood, also checks that sidecar doesn’t contain:

  • blob versioned hashes
  • execution layer requests

See also docs for ExecutionPayload::try_into_block_with_sidecar.

Trait Implementations§

Source§

impl Clone for OpExecutionPayload

Source§

fn clone(&self) -> OpExecutionPayload

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OpExecutionPayload

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OpExecutionPayload

Available on crate feature serde only.
Source§

fn deserialize<D>( deserializer: D, ) -> Result<OpExecutionPayload, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for OpExecutionPayload

Source§

fn eq(&self, other: &OpExecutionPayload) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for OpExecutionPayload

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for OpExecutionPayload

Source§

impl StructuralPartialEq for OpExecutionPayload

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<'de, T> BorrowedRpcObject<'de> for T
where T: RpcBorrow<'de> + RpcSend,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T

Source§

impl<'de, T> RpcBorrow<'de> for T
where T: Deserialize<'de> + Debug + Send + Sync + Unpin,

Source§

impl<T> RpcObject for T
where T: RpcSend + RpcRecv,

Source§

impl<T> RpcRecv for T
where T: DeserializeOwned + Debug + Send + Sync + Unpin + 'static,

Source§

impl<T> RpcSend for T
where T: Serialize + Clone + Debug + Send + Sync + Unpin,