pub trait EvmFactory:
Clone
+ Debug
+ Send
+ Sync
+ Unpin
+ 'staticwhere
<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§
Required Methods§
Sourcefn spec_id(&self, spec: SpecId) -> Self::SpecId
fn spec_id(&self, spec: SpecId) -> Self::SpecId
Maps an Ethereum hardfork to the runtime specification selected by this factory.
Sourcefn tx_registry(
&self,
spec: Self::SpecId,
) -> TxRegistry<Self::Types, TxResult<Self::Types>>
fn tx_registry( &self, spec: Self::SpecId, ) -> TxRegistry<Self::Types, TxResult<Self::Types>>
Builds the transaction registry for a runtime specification.
Provided Methods§
Sourcefn block_env(&self, block: BlockEnv) -> BlockEnv<Self::Types>
fn block_env(&self, block: BlockEnv) -> BlockEnv<Self::Types>
Converts the standard Ethereum block environment into the factory’s block environment.
Sourcefn version(&self, spec: SpecId, chain_id: u64) -> Version
fn version(&self, spec: SpecId, chain_id: u64) -> Version
Returns the runtime version for an Ethereum hardfork.
Sourcefn execution_config(
&self,
spec: Self::SpecId,
version: Version,
) -> ExecutionConfig<Self::Types>
fn execution_config( &self, spec: Self::SpecId, version: Version, ) -> ExecutionConfig<Self::Types>
Builds the execution configuration for a runtime specification.
Sourcefn precompiles(&self, spec: Self::SpecId) -> Precompiles<Self::Types>
fn precompiles(&self, spec: Self::SpecId) -> Precompiles<Self::Types>
Builds the precompile table for a runtime specification.
Sourcefn configure_evm(&self, _evm: &mut Evm<'_, Self::Types>)
fn configure_evm(&self, _evm: &mut Evm<'_, Self::Types>)
Applies factory-specific configuration to a newly created EVM.
Sourcefn precompile_cache_policy(&self, _spec: Self::SpecId) -> PrecompileCachePolicy
Available on crate feature std only.
fn precompile_cache_policy(&self, _spec: Self::SpecId) -> PrecompileCachePolicy
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".