Skip to main content

EvmFactory

Trait EvmFactory 

Source
pub trait EvmFactory:
    Clone
    + Debug
    + Send
    + Sync
    + Unpin
    + 'static
where <Self::Types as EvmTypesHost>::BlockEnvExt: Send + Sync, <Self::Types as EvmTypesHost>::EvmExt: Default, <Self::Types as EvmTypesHost>::TxResultExt: Send + Sync,
{ type Types: EvmTypes + EvmTypesHost<SpecId = Self::SpecId>; type SpecId: Copy + Into<SpecId> + Eq + Hash + Debug + Send + Sync + Clone + 'static; // Required methods fn spec_id(&self, spec: SpecId) -> Self::SpecId; fn tx_registry( &self, spec: Self::SpecId, ) -> TxRegistry<Self::Types, TxResult<Self::Types>>; // Provided methods fn block_env(&self, block: BlockEnv) -> BlockEnv<Self::Types> { ... } fn version(&self, spec: SpecId, chain_id: u64) -> Version { ... } fn execution_config( &self, spec: Self::SpecId, version: Version, ) -> ExecutionConfig<Self::Types> { ... } fn precompiles(&self, spec: Self::SpecId) -> Precompiles<Self::Types> { ... } fn configure_evm(&self, _evm: &mut Evm<'_, Self::Types>) { ... } fn precompile_cache_policy( &self, _spec: Self::SpecId, ) -> PrecompileCachePolicy { ... } }
Expand description

Factory used to construct an evm2-backed EVM.

Custom-node integrations can select a different evm2 transaction type through Self::Types.

Required Associated Types§

Source

type Types: EvmTypes + EvmTypesHost<SpecId = Self::SpecId>

Runtime evm2 type family used by the EVM.

Source

type SpecId: Copy + Into<SpecId> + Eq + Hash + Debug + Send + Sync + Clone + 'static

Runtime specification identifier used by the EVM type family.

Required Methods§

Source

fn spec_id(&self, spec: SpecId) -> Self::SpecId

Maps an Ethereum hardfork to the runtime specification selected by this factory.

Source

fn tx_registry( &self, spec: Self::SpecId, ) -> TxRegistry<Self::Types, TxResult<Self::Types>>

Builds the transaction registry for a runtime specification.

Provided Methods§

Source

fn block_env(&self, block: BlockEnv) -> BlockEnv<Self::Types>

Converts the standard Ethereum block environment into the factory’s block environment.

Source

fn version(&self, spec: SpecId, chain_id: u64) -> Version

Returns the runtime version for an Ethereum hardfork.

Source

fn execution_config( &self, spec: Self::SpecId, version: Version, ) -> ExecutionConfig<Self::Types>

Builds the execution configuration for a runtime specification.

Source

fn precompiles(&self, spec: Self::SpecId) -> Precompiles<Self::Types>

Builds the precompile table for a runtime specification.

Source

fn configure_evm(&self, _evm: &mut Evm<'_, Self::Types>)

Applies factory-specific configuration to a newly created EVM.

Source

fn precompile_cache_policy(&self, _spec: Self::SpecId) -> PrecompileCachePolicy

Available on crate feature std only.

Selects pure precompiles eligible for shared caching. Custom factories default to uncached.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl EvmFactory for RethEvmFactory

Source§

type Types = BaseEvmTypes

Source§

type SpecId = SpecId