pub enum ExecutionPayload {
V1(ExecutionPayloadV1),
V2(ExecutionPayloadV2),
V3(ExecutionPayloadV3),
V4(ExecutionPayloadV4),
}Expand description
An execution payload, which can be either ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3, or ExecutionPayloadV4.
Payload-to-block conversions return an unsealed block and do not recompute or compare the
advertised block_hash. Callers performing Engine API validation must hash the returned block
and compare it separately.
Variants§
V1(ExecutionPayloadV1)
V1 payload
V2(ExecutionPayloadV2)
V2 payload
V3(ExecutionPayloadV3)
V3 payload
V4(ExecutionPayloadV4)
V4 payload (Amsterdam)
Implementations§
Source§impl ExecutionPayload
impl ExecutionPayload
Sourcepub fn from_block_slow<T, H>(
block: &Block<T, H>,
) -> (Self, ExecutionPayloadSidecar)
pub fn from_block_slow<T, H>( block: &Block<T, H>, ) -> (Self, ExecutionPayloadSidecar)
Converts alloy_consensus::Block to ExecutionPayload and also returns the
ExecutionPayloadSidecar extracted from the block.
See also ExecutionPayloadV3::from_block_unchecked.
See also ExecutionPayloadSidecar::from_block.
Note: This re-calculates the block hash.
Sourcepub fn from_block_slow_with_bal<T, H>(
block: &Block<T, H>,
block_access_list: Bytes,
) -> (Self, ExecutionPayloadSidecar)
pub fn from_block_slow_with_bal<T, H>( block: &Block<T, H>, block_access_list: Bytes, ) -> (Self, ExecutionPayloadSidecar)
Converts alloy_consensus::Block to ExecutionPayload and also returns the
ExecutionPayloadSidecar extracted from the block along with block access list.
This preserves the full RLP-encoded block access list for Amsterdam/V4 payloads.
See also ExecutionPayloadV3::from_block_unchecked.
See also ExecutionPayloadSidecar::from_block.
Note: This re-calculates the block hash.
Sourcepub fn from_block_slow_with_extras<T, H>(
block: &Block<T, H>,
extras: impl Into<PayloadExtras>,
) -> (Self, ExecutionPayloadSidecar)
pub fn from_block_slow_with_extras<T, H>( block: &Block<T, H>, extras: impl Into<PayloadExtras>, ) -> (Self, ExecutionPayloadSidecar)
Converts alloy_consensus::Block to ExecutionPayload and also returns the
ExecutionPayloadSidecar extracted from the block along with payload extras.
This preserves the full RLP-encoded block access list for Amsterdam/V4 payloads.
See also ExecutionPayloadV3::from_block_unchecked.
See also ExecutionPayloadSidecar::from_block.
Note: This re-calculates the block hash.
Sourcepub fn from_block_unchecked<T, H>(
block_hash: B256,
block: &Block<T, H>,
) -> (Self, ExecutionPayloadSidecar)
pub fn from_block_unchecked<T, H>( block_hash: B256, block: &Block<T, H>, ) -> (Self, ExecutionPayloadSidecar)
Converts alloy_consensus::Block to ExecutionPayload and also returns the
ExecutionPayloadSidecar extracted from the block.
For Amsterdam/V4 payloads this uses the header’s block_access_list_hash bytes as the
block_access_list fallback, because the full RLP-encoded block access list is not part of
the block value. If the block header does not carry a BAL hash, this falls back to the
canonical empty BAL hash bytes. Use Self::from_block_unchecked_with_bal when the full
block access list bytes are available and should be preserved.
See also ExecutionPayloadV3::from_block_unchecked.
See also ExecutionPayloadSidecar::from_block.
The supplied hash is stored verbatim without checking it against the block. The payload version is inferred from the block access-list hash, parent beacon block root, and withdrawals.
Sourcepub fn from_block_unchecked_with_bal<T, H>(
block_hash: B256,
block: &Block<T, H>,
block_access_list: Bytes,
) -> (Self, ExecutionPayloadSidecar)
pub fn from_block_unchecked_with_bal<T, H>( block_hash: B256, block: &Block<T, H>, block_access_list: Bytes, ) -> (Self, ExecutionPayloadSidecar)
Converts alloy_consensus::Block to ExecutionPayload and also returns the
ExecutionPayloadSidecar extracted from the block along with block access list.
This preserves the full RLP-encoded block access list for Amsterdam/V4 payloads.
See also ExecutionPayloadV3::from_block_unchecked.
See also ExecutionPayloadSidecar::from_block.
Sourcepub fn from_block_unchecked_with_extras<T, H>(
block_hash: B256,
block: &Block<T, H>,
extras: impl Into<PayloadExtras>,
) -> (Self, ExecutionPayloadSidecar)
pub fn from_block_unchecked_with_extras<T, H>( block_hash: B256, block: &Block<T, H>, extras: impl Into<PayloadExtras>, ) -> (Self, ExecutionPayloadSidecar)
Converts alloy_consensus::Block to ExecutionPayload and also returns the
ExecutionPayloadSidecar extracted from the block along with optional extras.
This preserves the full RLP-encoded block access list for Amsterdam/V4 payloads if provided.
See also ExecutionPayloadV3::from_block_unchecked.
See also ExecutionPayloadSidecar::from_block.
Sourcepub fn try_into_block_with_sidecar<T: Decodable2718>(
self,
sidecar: &ExecutionPayloadSidecar,
) -> Result<Block<T>, PayloadError>
pub fn try_into_block_with_sidecar<T: Decodable2718>( self, sidecar: &ExecutionPayloadSidecar, ) -> Result<Block<T>, PayloadError>
Tries to create a new unsealed block from the given payload and payload sidecar.
Performs additional validation of extra_data and base_fee_per_gas fields.
The payload’s advertised block_hash is not recomputed or compared.
§Note
The log bloom is assumed to be validated during serialization.
Sourcepub fn try_into_block_with_sidecar_with<T, F, E>(
self,
sidecar: &ExecutionPayloadSidecar,
f: F,
) -> Result<Block<T>, PayloadError>
pub fn try_into_block_with_sidecar_with<T, F, E>( self, sidecar: &ExecutionPayloadSidecar, f: F, ) -> Result<Block<T>, PayloadError>
Converts ExecutionPayload to Block with sidecar and a custom transaction mapper.
The log bloom is assumed to be validated during serialization.
Sourcepub fn into_block_with_sidecar_raw(
self,
sidecar: &ExecutionPayloadSidecar,
) -> Result<Block<Bytes>, PayloadError>
pub fn into_block_with_sidecar_raw( self, sidecar: &ExecutionPayloadSidecar, ) -> Result<Block<Bytes>, PayloadError>
Converts ExecutionPayload to Block with raw Bytes transactions and sidecar.
This is similar to Self::try_into_block_with_sidecar_with but returns the transactions
as raw bytes without any conversion.
Sourcepub fn try_into_block<T: Decodable2718>(self) -> Result<Block<T>, PayloadError>
pub fn try_into_block<T: Decodable2718>(self) -> Result<Block<T>, PayloadError>
Converts ExecutionPayload to Block.
The returned block is unsealed, and the payload’s advertised block_hash is not recomputed
or compared.
Caution: This does not set fields that are not part of the payload and only part of the
ExecutionPayloadSidecar:
- parent_beacon_block_root
- requests_hash
Sourcepub fn try_into_block_with<T, F, E>(
self,
f: F,
) -> Result<Block<T>, PayloadError>
pub fn try_into_block_with<T, F, E>( self, f: F, ) -> Result<Block<T>, PayloadError>
Converts ExecutionPayload to Block with a custom transaction mapper.
Caution: This does not set fields that are not part of the payload and only part of the
ExecutionPayloadSidecar:
- parent_beacon_block_root
- requests_hash
Sourcepub fn into_block_raw(self) -> Result<Block<Bytes>, PayloadError>
pub fn into_block_raw(self) -> Result<Block<Bytes>, PayloadError>
Converts ExecutionPayload to Block with raw Bytes transactions.
This is similar to Self::try_into_block_with but returns the transactions as raw bytes
without any conversion.
Sourcepub fn into_block_raw_with_transactions_root(
self,
transactions_root: B256,
) -> Result<Block<Bytes>, PayloadError>
pub fn into_block_raw_with_transactions_root( self, transactions_root: B256, ) -> Result<Block<Bytes>, PayloadError>
Converts ExecutionPayload to Block with raw Bytes transactions using the
given transactions_root.
See also ExecutionPayloadV1::into_block_raw_with_transactions_root.
Sourcepub fn into_block_raw_with_transactions_root_opt(
self,
transactions_root: Option<B256>,
) -> Result<Block<Bytes>, PayloadError>
pub fn into_block_raw_with_transactions_root_opt( self, transactions_root: Option<B256>, ) -> Result<Block<Bytes>, PayloadError>
Converts ExecutionPayload to Block with raw Bytes transactions, optionally
using the given transactions_root.
If transactions_root is None, it will be computed from the transactions.
Sourcepub fn into_block_with_sidecar_raw_with_transactions_root(
self,
sidecar: &ExecutionPayloadSidecar,
transactions_root: B256,
) -> Result<Block<Bytes>, PayloadError>
pub fn into_block_with_sidecar_raw_with_transactions_root( self, sidecar: &ExecutionPayloadSidecar, transactions_root: B256, ) -> Result<Block<Bytes>, PayloadError>
Converts ExecutionPayload to Block with raw Bytes transactions and sidecar
using the given transactions_root.
See also Self::into_block_with_sidecar_raw.
Sourcepub const fn as_v1(&self) -> &ExecutionPayloadV1
pub const fn as_v1(&self) -> &ExecutionPayloadV1
Returns a reference to the V1 payload.
Sourcepub const fn as_v1_mut(&mut self) -> &mut ExecutionPayloadV1
pub const fn as_v1_mut(&mut self) -> &mut ExecutionPayloadV1
Returns a mutable reference to the V1 payload.
Sourcepub fn into_v1(self) -> ExecutionPayloadV1
pub fn into_v1(self) -> ExecutionPayloadV1
Consumes the payload and returns 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 const fn as_v2_mut(&mut self) -> Option<&mut ExecutionPayloadV2>
pub const 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 const fn as_v3_mut(&mut self) -> Option<&mut ExecutionPayloadV3>
pub const 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<&ExecutionPayloadV4>
pub const fn as_v4(&self) -> Option<&ExecutionPayloadV4>
Returns a reference to the V4 payload, if any.
Sourcepub const fn as_v4_mut(&mut self) -> Option<&mut ExecutionPayloadV4>
pub const fn as_v4_mut(&mut self) -> Option<&mut ExecutionPayloadV4>
Returns a mutable reference to the V4 payload, if any.
Sourcepub const fn withdrawals(&self) -> Option<&Vec<Withdrawal>>
pub const fn withdrawals(&self) -> Option<&Vec<Withdrawal>>
Returns the withdrawals for the payload.
Sourcepub const fn transactions(&self) -> &Vec<Bytes>
pub const fn transactions(&self) -> &Vec<Bytes>
Returns the transactions for the payload.
Sourcepub const fn transactions_mut(&mut self) -> &mut Vec<Bytes>
pub const fn transactions_mut(&mut self) -> &mut Vec<Bytes>
Returns a mutable reference to the transactions for the payload.
Sourcepub fn header_info(&self) -> HeaderInfo
pub fn header_info(&self) -> HeaderInfo
Extracts essential information into one container type.
Sourcepub fn saturated_base_fee_per_gas(&self) -> u64
pub fn saturated_base_fee_per_gas(&self) -> u64
Returns the gas limit for the payload.
Note: this returns the u64 saturated base fee, but it is specified as U256.
Sourcepub fn blob_gas_used(&self) -> Option<u64>
pub fn blob_gas_used(&self) -> Option<u64>
Returns the blob gas used for the payload.
Sourcepub fn excess_blob_gas(&self) -> Option<u64>
pub fn excess_blob_gas(&self) -> Option<u64>
Returns the excess blob gas for the payload.
Sourcepub fn block_access_list(&self) -> Option<&Bytes>
pub fn block_access_list(&self) -> Option<&Bytes>
Returns the block access list for the payload (EIP-7928).
Returns None for pre-Amsterdam payloads (V1, V2, V3).
Sourcepub fn bal_hash(&self) -> Option<B256>
pub fn bal_hash(&self) -> Option<B256>
Returns the block access list hash for the payload (EIP-7928).
Returns None for pre-Amsterdam payloads (V1, V2, V3).
Sourcepub fn slot_number(&self) -> Option<u64>
pub fn slot_number(&self) -> Option<u64>
Returns the slot number for the payload (EIP-7843).
Returns None for pre-Amsterdam payloads (V1, V2, V3).
Sourcepub const fn fee_recipient(&self) -> Address
pub const fn fee_recipient(&self) -> Address
Returns the fee recipient.
Sourcepub const fn parent_hash(&self) -> B256
pub const fn parent_hash(&self) -> B256
Returns the parent hash for the payload.
Sourcepub const fn block_hash(&self) -> B256
pub const fn block_hash(&self) -> B256
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 const fn block_num_hash(&self) -> BlockNumHash
pub const fn block_num_hash(&self) -> BlockNumHash
Returns the block number for this payload.
Sourcepub const fn prev_randao(&self) -> B256
pub const fn prev_randao(&self) -> B256
Returns the prev randao for this payload.
Sourcepub fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
pub fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
Returns the blob fee for this block according to the EIP-4844 spec.
Returns None if excess_blob_gas is None
Sourcepub fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
pub fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
Returns the blob fee for the next block according to the EIP-4844 spec.
Returns None if excess_blob_gas is None.
See also Self::next_block_excess_blob_gas
Sourcepub fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
pub fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
Calculate base fee for next block according to the EIP-1559 spec.
Returns a None if no base fee is set, no EIP-1559 support
Sourcepub fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
pub fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
Calculate excess blob gas for the next block according to the EIP-4844 spec.
Returns a None if no excess blob gas is set, no EIP-4844 support
Sourcepub fn maybe_next_block_excess_blob_gas(
&self,
blob_params: Option<BlobParams>,
) -> Option<u64>
pub fn maybe_next_block_excess_blob_gas( &self, blob_params: Option<BlobParams>, ) -> Option<u64>
Convenience function for Self::next_block_excess_blob_gas with an optional
BlobParams argument.
Returns None if the blob_params are None.
Sourcepub fn decoded_transactions<T: Decodable2718>(
&self,
) -> impl Iterator<Item = Eip2718Result<T>> + '_
pub fn decoded_transactions<T: Decodable2718>( &self, ) -> impl Iterator<Item = Eip2718Result<T>> + '_
Returns an iterator over the decoded transactions in this payload.
This iterator will decode transactions on the fly.
Sourcepub fn decoded_transactions_with_encoded<T: Decodable2718>(
&self,
) -> impl Iterator<Item = Eip2718Result<WithEncoded<T>>> + '_
pub fn decoded_transactions_with_encoded<T: Decodable2718>( &self, ) -> impl Iterator<Item = Eip2718Result<WithEncoded<T>>> + '_
Returns iterator over decoded transactions with their original encoded bytes.
This iterator will decode transactions on the fly and return them with their bytes.
Sourcepub fn recovered_transactions<T>(
&self,
) -> impl Iterator<Item = Result<Recovered<T>, RecoveryError>> + '_where
T: Decodable2718 + SignerRecoverable,
pub fn recovered_transactions<T>(
&self,
) -> impl Iterator<Item = Result<Recovered<T>, RecoveryError>> + '_where
T: Decodable2718 + SignerRecoverable,
Returns an iterator over the recovered transactions in this payload.
This iterator will decode and recover signer addresses for transactions on the fly.
Sourcepub fn recovered_transactions_with_encoded<T>(
&self,
) -> impl Iterator<Item = Result<WithEncoded<Recovered<T>>, RecoveryError>> + '_where
T: Decodable2718 + SignerRecoverable,
pub fn recovered_transactions_with_encoded<T>(
&self,
) -> impl Iterator<Item = Result<WithEncoded<Recovered<T>>, RecoveryError>> + '_where
T: Decodable2718 + SignerRecoverable,
Returns an iterator over the recovered transactions in this payload with their original encoded bytes.
This iterator will decode and recover signer addresses for transactions on the fly and return them with their bytes.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for ExecutionPayload
Available on crate features arbitrary only.
impl<'arbitrary> Arbitrary<'arbitrary> for ExecutionPayload
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for ExecutionPayload
impl Clone for ExecutionPayload
Source§fn clone(&self) -> ExecutionPayload
fn clone(&self) -> ExecutionPayload
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExecutionPayload
impl Debug for ExecutionPayload
Source§impl<'de> Deserialize<'de> for ExecutionPayload
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ExecutionPayload
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for ExecutionPayload
Source§impl From<ExecutionPayloadFieldV2> for ExecutionPayload
impl From<ExecutionPayloadFieldV2> for ExecutionPayload
Source§fn from(payload: ExecutionPayloadFieldV2) -> Self
fn from(payload: ExecutionPayloadFieldV2) -> Self
Source§impl From<ExecutionPayloadInputV2> for ExecutionPayload
impl From<ExecutionPayloadInputV2> for ExecutionPayload
Source§fn from(input: ExecutionPayloadInputV2) -> Self
fn from(input: ExecutionPayloadInputV2) -> Self
Source§impl From<ExecutionPayloadV1> for ExecutionPayload
impl From<ExecutionPayloadV1> for ExecutionPayload
Source§fn from(payload: ExecutionPayloadV1) -> Self
fn from(payload: ExecutionPayloadV1) -> Self
Source§impl From<ExecutionPayloadV2> for ExecutionPayload
impl From<ExecutionPayloadV2> for ExecutionPayload
Source§fn from(payload: ExecutionPayloadV2) -> Self
fn from(payload: ExecutionPayloadV2) -> Self
Source§impl From<ExecutionPayloadV3> for ExecutionPayload
impl From<ExecutionPayloadV3> for ExecutionPayload
Source§fn from(payload: ExecutionPayloadV3) -> Self
fn from(payload: ExecutionPayloadV3) -> Self
Source§impl From<ExecutionPayloadV4> for ExecutionPayload
impl From<ExecutionPayloadV4> for ExecutionPayload
Source§fn from(payload: ExecutionPayloadV4) -> Self
fn from(payload: ExecutionPayloadV4) -> Self
Source§impl PartialEq for ExecutionPayload
impl PartialEq for ExecutionPayload
Source§impl Serialize for ExecutionPayload
Available on crate feature serde only.
impl Serialize for ExecutionPayload
serde only.impl StructuralPartialEq for ExecutionPayload
Source§impl<T: Decodable2718> TryFrom<ExecutionPayload> for Block<T>
impl<T: Decodable2718> TryFrom<ExecutionPayload> for Block<T>
Source§type Error = PayloadError
type Error = PayloadError
Auto Trait Implementations§
impl !Freeze for ExecutionPayload
impl RefUnwindSafe for ExecutionPayload
impl Send for ExecutionPayload
impl Sync for ExecutionPayload
impl Unpin for ExecutionPayload
impl UnsafeUnpin for ExecutionPayload
impl UnwindSafe for ExecutionPayload
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 moreSource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 640 bytes
Size for each variant:
V1: 568 bytesV2: 592 bytesV3: 608 bytesV4: 640 bytes