pub enum OpExecutionPayload {
V1(ExecutionPayloadV1),
V2(ExecutionPayloadV2),
V3(ExecutionPayloadV3),
V4(OpExecutionPayloadV4),
}
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
impl OpExecutionPayload
Sourcepub fn from_block_slow<T, H>(
block: &Block<T, H>,
) -> (OpExecutionPayload, OpExecutionPayloadSidecar)
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.
Sourcepub fn from_block_unchecked<T, H>(
block_hash: FixedBytes<32>,
block: &Block<T, H>,
) -> (OpExecutionPayload, OpExecutionPayloadSidecar)
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
.
Sourcepub fn v2(payload: ExecutionPayloadInputV2) -> OpExecutionPayload
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
Sourcepub const fn v3(payload: ExecutionPayloadV3) -> OpExecutionPayload
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
Sourcepub const fn v4(payload: OpExecutionPayloadV4) -> OpExecutionPayload
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
Sourcepub const fn as_v1(&self) -> &ExecutionPayloadV1
pub const fn as_v1(&self) -> &ExecutionPayloadV1
Returns a reference to the V1 payload.
Sourcepub fn as_v1_mut(&mut self) -> &mut ExecutionPayloadV1
pub fn as_v1_mut(&mut self) -> &mut ExecutionPayloadV1
Returns a mutable reference to the V1 payload.
Sourcepub const fn as_v2(&self) -> Option<&ExecutionPayloadV2>
pub const fn as_v2(&self) -> Option<&ExecutionPayloadV2>
Returns a reference to the V2 payload, if any.
Sourcepub fn as_v2_mut(&mut self) -> Option<&mut ExecutionPayloadV2>
pub fn as_v2_mut(&mut self) -> Option<&mut ExecutionPayloadV2>
Returns a mutable reference to the V2 payload, if any.
Sourcepub const fn as_v3(&self) -> Option<&ExecutionPayloadV3>
pub const fn as_v3(&self) -> Option<&ExecutionPayloadV3>
Returns a reference to the V3 payload, if any.
Sourcepub fn as_v3_mut(&mut self) -> Option<&mut ExecutionPayloadV3>
pub fn as_v3_mut(&mut self) -> Option<&mut ExecutionPayloadV3>
Returns a mutable reference to the V3 payload, if any.
Sourcepub const fn as_v4(&self) -> Option<&OpExecutionPayloadV4>
pub const fn as_v4(&self) -> Option<&OpExecutionPayloadV4>
Returns a reference to the V4 payload, if any.
Sourcepub fn as_v4_mut(&mut self) -> Option<&mut OpExecutionPayloadV4>
pub fn as_v4_mut(&mut self) -> Option<&mut OpExecutionPayloadV4>
Returns a mutable reference to the V4 payload, if any.
Sourcepub const fn parent_hash(&self) -> FixedBytes<32>
pub const fn parent_hash(&self) -> FixedBytes<32>
Returns the parent hash for the payload.
Sourcepub const fn block_hash(&self) -> FixedBytes<32>
pub const fn block_hash(&self) -> FixedBytes<32>
Returns the block hash for the payload.
Sourcepub const fn block_number(&self) -> u64
pub const fn block_number(&self) -> u64
Returns the block number for this payload.
Sourcepub fn try_into_block<T>(self) -> Result<Block<T>, OpPayloadError>where
T: Decodable2718 + Typed2718,
pub fn try_into_block<T>(self) -> Result<Block<T>, OpPayloadError>where
T: Decodable2718 + Typed2718,
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
Sourcepub fn try_into_block_with_sidecar<T>(
self,
sidecar: &OpExecutionPayloadSidecar,
) -> Result<Block<T>, OpPayloadError>where
T: Decodable2718 + Typed2718,
pub fn try_into_block_with_sidecar<T>(
self,
sidecar: &OpExecutionPayloadSidecar,
) -> Result<Block<T>, OpPayloadError>where
T: Decodable2718 + Typed2718,
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
impl Clone for OpExecutionPayload
Source§fn clone(&self) -> OpExecutionPayload
fn clone(&self) -> OpExecutionPayload
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for OpExecutionPayload
impl Debug for OpExecutionPayload
Source§impl<'de> Deserialize<'de> for OpExecutionPayload
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for OpExecutionPayload
serde
only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<OpExecutionPayload, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<OpExecutionPayload, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl PartialEq for OpExecutionPayload
impl PartialEq for OpExecutionPayload
Source§impl Serialize for OpExecutionPayload
impl Serialize for OpExecutionPayload
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for OpExecutionPayload
impl StructuralPartialEq for OpExecutionPayload
Auto Trait Implementations§
impl !Freeze for OpExecutionPayload
impl RefUnwindSafe for OpExecutionPayload
impl Send for OpExecutionPayload
impl Sync for OpExecutionPayload
impl Unpin for OpExecutionPayload
impl UnwindSafe for OpExecutionPayload
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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