Trait reth::builder::PayloadBuilderAttributes

pub trait PayloadBuilderAttributes: Send + Sync + Debug {
    type RpcPayloadAttributes;
    type Error: Error;

    // Required methods
    fn try_new(
        parent: FixedBytes<32>,
        rpc_payload_attributes: Self::RpcPayloadAttributes,
    ) -> Result<Self, Self::Error>
       where Self: Sized;
    fn payload_id(&self) -> PayloadId;
    fn parent(&self) -> FixedBytes<32>;
    fn timestamp(&self) -> u64;
    fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>;
    fn suggested_fee_recipient(&self) -> Address;
    fn prev_randao(&self) -> FixedBytes<32>;
    fn withdrawals(&self) -> &Withdrawals;
    fn cfg_and_block_env(
        &self,
        chain_spec: &ChainSpec,
        parent: &Header,
    ) -> (CfgEnvWithHandlerCfg, BlockEnv);
}
Expand description

This can be implemented by types that describe a currently running payload job.

This is used as a conversion type, transforming a payload attributes type that the engine API receives, into a type that the payload builder can use.

Required Associated Types§

type RpcPayloadAttributes

The payload attributes that can be used to construct this type. Used as the argument in PayloadBuilderAttributes::try_new.

type Error: Error

The error type used in PayloadBuilderAttributes::try_new.

Required Methods§

fn try_new( parent: FixedBytes<32>, rpc_payload_attributes: Self::RpcPayloadAttributes, ) -> Result<Self, Self::Error>
where Self: Sized,

Creates a new payload builder for the given parent block and the attributes.

Derives the unique PayloadId for the given parent and attributes

fn payload_id(&self) -> PayloadId

Returns the PayloadId for the running payload job.

fn parent(&self) -> FixedBytes<32>

Returns the parent block hash for the running payload job.

fn timestamp(&self) -> u64

Returns the timestamp for the running payload job.

fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>

Returns the parent beacon block root for the running payload job, if it exists.

fn suggested_fee_recipient(&self) -> Address

Returns the suggested fee recipient for the running payload job.

fn prev_randao(&self) -> FixedBytes<32>

Returns the prevrandao field for the running payload job.

fn withdrawals(&self) -> &Withdrawals

Returns the withdrawals for the running payload job.

fn cfg_and_block_env( &self, chain_spec: &ChainSpec, parent: &Header, ) -> (CfgEnvWithHandlerCfg, BlockEnv)

Returns the configured CfgEnvWithHandlerCfg and BlockEnv for the targeted payload (that has the parent as its parent).

The chain_spec is used to determine the correct chain id and hardfork for the payload based on its timestamp.

Block related settings are derived from the parent block and the configured attributes.

NOTE: This is only intended for beacon consensus (after merge).

Implementations on Foreign Types§

source§

impl PayloadBuilderAttributes for OptimismPayloadBuilderAttributes

source§

fn try_new( parent: FixedBytes<32>, attributes: OptimismPayloadAttributes, ) -> Result<OptimismPayloadBuilderAttributes, <OptimismPayloadBuilderAttributes as PayloadBuilderAttributes>::Error>

Creates a new payload builder for the given parent block and the attributes.

Derives the unique PayloadId for the given parent and attributes

§

type RpcPayloadAttributes = OptimismPayloadAttributes

§

type Error = Error

source§

fn payload_id(&self) -> PayloadId

source§

fn parent(&self) -> FixedBytes<32>

source§

fn timestamp(&self) -> u64

source§

fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>

source§

fn suggested_fee_recipient(&self) -> Address

source§

fn prev_randao(&self) -> FixedBytes<32>

source§

fn withdrawals(&self) -> &Withdrawals

source§

fn cfg_and_block_env( &self, chain_spec: &ChainSpec, parent: &Header, ) -> (CfgEnvWithHandlerCfg, BlockEnv)

Implementors§