Trait reth_evm::ConfigureEvmEnv

source ·
pub trait ConfigureEvmEnv:
    Send
    + Sync
    + Unpin
    + Clone
    + 'static {
    type Header;

    // Required methods
    fn fill_tx_env(
        &self,
        tx_env: &mut TxEnv,
        transaction: &TransactionSigned,
        sender: Address,
    );
    fn fill_tx_env_system_contract_call(
        &self,
        env: &mut Env,
        caller: Address,
        contract: Address,
        data: Bytes,
    );
    fn fill_cfg_env(
        &self,
        cfg_env: &mut CfgEnvWithHandlerCfg,
        header: &Self::Header,
        total_difficulty: U256,
    );
    fn fill_block_env(
        &self,
        block_env: &mut BlockEnv,
        header: &Self::Header,
        after_merge: bool,
    );
    fn next_cfg_and_block_env(
        &self,
        parent: &Self::Header,
        attributes: NextBlockEnvAttributes,
    ) -> (CfgEnvWithHandlerCfg, BlockEnv);

    // Provided methods
    fn tx_env(&self, transaction: &TransactionSignedEcRecovered) -> TxEnv { ... }
    fn fill_cfg_and_block_env(
        &self,
        cfg: &mut CfgEnvWithHandlerCfg,
        block_env: &mut BlockEnv,
        header: &Self::Header,
        total_difficulty: U256,
    ) { ... }
}
Expand description

This represents the set of methods used to configure the EVM’s environment before block execution.

Default trait method implementation is done w.r.t. L1.

Required Associated Types§

source

type Header

The header type used by the EVM.

Required Methods§

source

fn fill_tx_env( &self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address, )

Fill transaction environment from a [TransactionSigned] and the given sender address.

source

fn fill_tx_env_system_contract_call( &self, env: &mut Env, caller: Address, contract: Address, data: Bytes, )

Fill transaction environment with a system contract call.

source

fn fill_cfg_env( &self, cfg_env: &mut CfgEnvWithHandlerCfg, header: &Self::Header, total_difficulty: U256, )

Fill [CfgEnvWithHandlerCfg] fields according to the chain spec and given header.

This must set the corresponding spec id in the handler cfg, based on timestamp or total difficulty

source

fn fill_block_env( &self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool, )

Fill [BlockEnv] field according to the chain spec and given header

source

fn next_cfg_and_block_env( &self, parent: &Self::Header, attributes: NextBlockEnvAttributes, ) -> (CfgEnvWithHandlerCfg, BlockEnv)

Returns the configured [CfgEnvWithHandlerCfg] and [BlockEnv] for parent + 1 block.

This is intended for usage in block building after the merge and requires additional attributes that can’t be derived from the parent block: attributes that are determined by the CL, such as the timestamp, suggested fee recipient, and randomness value.

Provided Methods§

source

fn tx_env(&self, transaction: &TransactionSignedEcRecovered) -> TxEnv

Returns a [TxEnv] from a [TransactionSignedEcRecovered].

source

fn fill_cfg_and_block_env( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, header: &Self::Header, total_difficulty: U256, )

Convenience function to call both fill_cfg_env and ConfigureEvmEnv::fill_block_env.

Note: Implementers should ensure that all fields are required fields are filled.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, T: 'a + ConfigureEvmEnv + ?Sized> ConfigureEvmEnv for &'a T
where &'a T: Send + Sync + Unpin + Clone + 'static,

source§

type Header = <T as ConfigureEvmEnv>::Header

source§

fn tx_env(&self, transaction: &TransactionSignedEcRecovered) -> TxEnv

source§

fn fill_tx_env( &self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address, )

source§

fn fill_tx_env_system_contract_call( &self, env: &mut Env, caller: Address, contract: Address, data: Bytes, )

source§

fn fill_cfg_env( &self, cfg_env: &mut CfgEnvWithHandlerCfg, header: &Self::Header, total_difficulty: U256, )

source§

fn fill_block_env( &self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool, )

source§

fn fill_cfg_and_block_env( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, header: &Self::Header, total_difficulty: U256, )

source§

fn next_cfg_and_block_env( &self, parent: &Self::Header, attributes: NextBlockEnvAttributes, ) -> (CfgEnvWithHandlerCfg, BlockEnv)

source§

impl<T: ConfigureEvmEnv + ?Sized> ConfigureEvmEnv for Arc<T>
where Arc<T>: Send + Sync + Unpin + Clone + 'static,

source§

type Header = <T as ConfigureEvmEnv>::Header

source§

fn tx_env(&self, transaction: &TransactionSignedEcRecovered) -> TxEnv

source§

fn fill_tx_env( &self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address, )

source§

fn fill_tx_env_system_contract_call( &self, env: &mut Env, caller: Address, contract: Address, data: Bytes, )

source§

fn fill_cfg_env( &self, cfg_env: &mut CfgEnvWithHandlerCfg, header: &Self::Header, total_difficulty: U256, )

source§

fn fill_block_env( &self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool, )

source§

fn fill_cfg_and_block_env( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, header: &Self::Header, total_difficulty: U256, )

source§

fn next_cfg_and_block_env( &self, parent: &Self::Header, attributes: NextBlockEnvAttributes, ) -> (CfgEnvWithHandlerCfg, BlockEnv)

Implementors§