Skip to main content

ExecutionPayload

Enum ExecutionPayload 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

See https://github.com/ethereum/go-ethereum/blob/79a478bb6176425c2400e949890e668a3d9a3d05/core/beacon/types.go#L145

Source

pub fn try_into_block_with_sidecar_with<T, F, E>( self, sidecar: &ExecutionPayloadSidecar, f: F, ) -> Result<Block<T>, PayloadError>
where F: FnMut(Bytes) -> Result<T, E>, E: Into<PayloadError>,

Converts ExecutionPayload to Block with sidecar and a custom transaction mapper.

The log bloom is assumed to be validated during serialization.

See https://github.com/ethereum/go-ethereum/blob/79a478bb6176425c2400e949890e668a3d9a3d05/core/beacon/types.go#L145

Source

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.

Source

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

See also: ExecutionPayload::try_into_block_with_sidecar

Source

pub fn try_into_block_with<T, F, E>( self, f: F, ) -> Result<Block<T>, PayloadError>
where F: FnMut(Bytes) -> Result<T, E>, E: Into<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

See also: ExecutionPayload::try_into_block_with_sidecar

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Returns a reference to the V1 payload.

Source

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

Returns a mutable reference to the V1 payload.

Source

pub fn into_v1(self) -> ExecutionPayloadV1

Consumes the payload and returns the V1 payload.

Source

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

Returns a reference to the V2 payload, if any.

Source

pub const 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 const 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<&ExecutionPayloadV4>

Returns a reference to the V4 payload, if any.

Source

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

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

Source

pub const fn withdrawals(&self) -> Option<&Vec<Withdrawal>>

Returns the withdrawals for the payload.

Source

pub const fn transactions(&self) -> &Vec<Bytes>

Returns the transactions for the payload.

Source

pub const fn transactions_mut(&mut self) -> &mut Vec<Bytes>

Returns a mutable reference to the transactions for the payload.

Source

pub fn header_info(&self) -> HeaderInfo

Extracts essential information into one container type.

Source

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.

Source

pub fn blob_gas_used(&self) -> Option<u64>

Returns the blob gas used for the payload.

Source

pub fn excess_blob_gas(&self) -> Option<u64>

Returns the excess blob gas for the payload.

Source

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).

Source

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).

Source

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).

Source

pub const fn gas_limit(&self) -> u64

Returns the gas limit for the payload.

Source

pub const fn fee_recipient(&self) -> Address

Returns the fee recipient.

Source

pub const fn timestamp(&self) -> u64

Returns the timestamp for the payload.

Source

pub const fn parent_hash(&self) -> B256

Returns the parent hash for the payload.

Source

pub const fn block_hash(&self) -> B256

Returns the block hash for the payload.

Source

pub const fn block_number(&self) -> u64

Returns the block number for this payload.

Source

pub const fn block_num_hash(&self) -> BlockNumHash

Returns the block number for this payload.

Source

pub const fn prev_randao(&self) -> B256

Returns the prev randao for this payload.

Source

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

Source

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

Source

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

Source

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

Source

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.

Source

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.

Source

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.

Source

pub fn recovered_transactions<T>( &self, ) -> impl Iterator<Item = Result<Recovered<T>, RecoveryError>> + '_

Returns an iterator over the recovered transactions in this payload.

This iterator will decode and recover signer addresses for transactions on the fly.

Source

pub fn recovered_transactions_with_encoded<T>( &self, ) -> impl Iterator<Item = Result<WithEncoded<Recovered<T>>, RecoveryError>> + '_

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.
Source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl Clone for ExecutionPayload

Source§

fn clone(&self) -> ExecutionPayload

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ExecutionPayload

Source§

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

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

impl<'de> Deserialize<'de> for ExecutionPayload

Available on crate feature serde only.
Source§

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

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

impl Eq for ExecutionPayload

Source§

impl From<ExecutionPayloadFieldV2> for ExecutionPayload

Source§

fn from(payload: ExecutionPayloadFieldV2) -> Self

Converts to this type from the input type.
Source§

impl From<ExecutionPayloadInputV2> for ExecutionPayload

Source§

fn from(input: ExecutionPayloadInputV2) -> Self

Converts to this type from the input type.
Source§

impl From<ExecutionPayloadV1> for ExecutionPayload

Source§

fn from(payload: ExecutionPayloadV1) -> Self

Converts to this type from the input type.
Source§

impl From<ExecutionPayloadV2> for ExecutionPayload

Source§

fn from(payload: ExecutionPayloadV2) -> Self

Converts to this type from the input type.
Source§

impl From<ExecutionPayloadV3> for ExecutionPayload

Source§

fn from(payload: ExecutionPayloadV3) -> Self

Converts to this type from the input type.
Source§

impl From<ExecutionPayloadV4> for ExecutionPayload

Source§

fn from(payload: ExecutionPayloadV4) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ExecutionPayload

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for ExecutionPayload

Available on crate feature serde only.
Source§

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

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

impl StructuralPartialEq for ExecutionPayload

Source§

impl<T: Decodable2718> TryFrom<ExecutionPayload> for Block<T>

Source§

type Error = PayloadError

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

fn try_from(value: ExecutionPayload) -> Result<Self, Self::Error>

Performs the conversion.

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, dest: *mut u8)

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

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

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

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 bytes
  • V2: 592 bytes
  • V3: 608 bytes
  • V4: 640 bytes