pub trait FoundryEvmFactory:
Clone
+ Debug
+ Default
+ Send
+ Sync
+ 'static {
type Types: FoundryExecutionHooks + EvmTypesHost<SpecId: ExecutionSpec + Default + Debug + PartialEq + Send + Sync + Unpin, Tx: Typed2718 + Clone + Debug + Send + Sync, BlockEnvExt: Copy + Debug + Default + Send + Sync + 'static, EvmExt: FoundryEvmExt<<Self::Types as EvmTypesHost>::Tx>, TxResultExt: FoundryTxResultExt>;
Show 13 methods
// Required methods
fn version(&self, spec: SpecOf<Self>, chain_id: u64) -> Version;
fn tx_registry(
&self,
spec: SpecOf<Self>,
) -> TxRegistry<Self::Types, TxResult<Self::Types>>;
fn precompiles(
&self,
env: &EvmEnv<Self::Types>,
ext: &<Self::Types as EvmTypesHost>::EvmExt,
) -> Box<dyn PrecompileProvider<Self::Types>>;
// Provided methods
fn execution_config(
&self,
spec: SpecOf<Self>,
version: Version,
) -> ExecutionConfig<Self::Types> { ... }
fn evm_ext(
&self,
_env: &EvmEnv<Self::Types>,
) -> <Self::Types as EvmTypesHost>::EvmExt { ... }
fn configure_for<D: FoundryDatabase + ?Sized>(
&self,
_db: &D,
_env: &EvmEnv<Self::Types>,
) -> Self { ... }
fn with_networks(&self, _networks: NetworkConfigs) -> Self { ... }
fn initialize_evm(&self, _evm: &mut Evm<'_, Self::Types>, _is_forked: bool) { ... }
fn create_evm<'a>(
&self,
db: impl FoundryDatabase + 'a,
env: EvmEnv<Self::Types>,
) -> Evm<'a, Self::Types> { ... }
fn new_evm<'a>(
&self,
db: impl FoundryDatabase + 'a,
env: EvmEnv<Self::Types>,
) -> Evm<'a, Self::Types> { ... }
fn new_evm_with_ext<'a>(
&self,
db: impl FoundryDatabase + 'a,
env: EvmEnv<Self::Types>,
ext: <Self::Types as EvmTypesHost>::EvmExt,
) -> Evm<'a, Self::Types> { ... }
fn env_with_spec(
&self,
env: EvmEnv<Self::Types>,
spec: SpecOf<Self>,
) -> EvmEnv<Self::Types> { ... }
fn set_env(&self, evm: &mut Evm<'_, Self::Types>, env: EvmEnv<Self::Types>) { ... }
}Expand description
Builds Foundry-configured EVMs for one evm2 [EvmTypesHost] family.
Implementors provide configuration (version, registry, precompiles, extension state). Construction and spec changes are provided on top, so every network builds its EVM the same way.
Required Associated Types§
Sourcetype Types: FoundryExecutionHooks + EvmTypesHost<SpecId: ExecutionSpec + Default + Debug + PartialEq + Send + Sync + Unpin, Tx: Typed2718 + Clone + Debug + Send + Sync, BlockEnvExt: Copy + Debug + Default + Send + Sync + 'static, EvmExt: FoundryEvmExt<<Self::Types as EvmTypesHost>::Tx>, TxResultExt: FoundryTxResultExt>
type Types: FoundryExecutionHooks + EvmTypesHost<SpecId: ExecutionSpec + Default + Debug + PartialEq + Send + Sync + Unpin, Tx: Typed2718 + Clone + Debug + Send + Sync, BlockEnvExt: Copy + Debug + Default + Send + Sync + 'static, EvmExt: FoundryEvmExt<<Self::Types as EvmTypesHost>::Tx>, TxResultExt: FoundryTxResultExt>
evm2 type family: spec, transaction, block, EVM and result extensions.
Required Methods§
Sourcefn version(&self, spec: SpecOf<Self>, chain_id: u64) -> Version
fn version(&self, spec: SpecOf<Self>, chain_id: u64) -> Version
Returns the default runtime version for spec on chain_id.
Sourcefn tx_registry(
&self,
spec: SpecOf<Self>,
) -> TxRegistry<Self::Types, TxResult<Self::Types>>
fn tx_registry( &self, spec: SpecOf<Self>, ) -> TxRegistry<Self::Types, TxResult<Self::Types>>
Returns the transaction handler registry for spec.
Provided Methods§
Sourcefn execution_config(
&self,
spec: SpecOf<Self>,
version: Version,
) -> ExecutionConfig<Self::Types>
fn execution_config( &self, spec: SpecOf<Self>, version: Version, ) -> ExecutionConfig<Self::Types>
Returns the execution config (dispatch tables) for spec with runtime version.
Sourcefn evm_ext(
&self,
_env: &EvmEnv<Self::Types>,
) -> <Self::Types as EvmTypesHost>::EvmExt
fn evm_ext( &self, _env: &EvmEnv<Self::Types>, ) -> <Self::Types as EvmTypesHost>::EvmExt
Returns fresh extension state for an EVM built with env.
Sourcefn configure_for<D: FoundryDatabase + ?Sized>(
&self,
_db: &D,
_env: &EvmEnv<Self::Types>,
) -> Self
fn configure_for<D: FoundryDatabase + ?Sized>( &self, _db: &D, _env: &EvmEnv<Self::Types>, ) -> Self
Returns this factory configured for an EVM over db, such as Base’s activation admin for
the fork’s source chain.
Sourcefn with_networks(&self, _networks: NetworkConfigs) -> Self
fn with_networks(&self, _networks: NetworkConfigs) -> Self
Returns this factory configured for networks, such as Celo’s transfer precompile on
Ethereum.
Sourcefn initialize_evm(&self, _evm: &mut Evm<'_, Self::Types>, _is_forked: bool)
fn initialize_evm(&self, _evm: &mut Evm<'_, Self::Types>, _is_forked: bool)
Seeds network state into a newly created EVM, such as Tempo genesis or Base sentinels.
Sourcefn create_evm<'a>(
&self,
db: impl FoundryDatabase + 'a,
env: EvmEnv<Self::Types>,
) -> Evm<'a, Self::Types>
fn create_evm<'a>( &self, db: impl FoundryDatabase + 'a, env: EvmEnv<Self::Types>, ) -> Evm<'a, Self::Types>
Creates a Foundry-configured EVM without an inspector.
Sourcefn new_evm<'a>(
&self,
db: impl FoundryDatabase + 'a,
env: EvmEnv<Self::Types>,
) -> Evm<'a, Self::Types>
fn new_evm<'a>( &self, db: impl FoundryDatabase + 'a, env: EvmEnv<Self::Types>, ) -> Evm<'a, Self::Types>
Creates a Foundry-configured EVM with fresh extension state, without seeding network state.
For inherited extension state, configure the factory with Self::configure_for and use
Self::new_evm_with_ext instead.
Sourcefn new_evm_with_ext<'a>(
&self,
db: impl FoundryDatabase + 'a,
env: EvmEnv<Self::Types>,
ext: <Self::Types as EvmTypesHost>::EvmExt,
) -> Evm<'a, Self::Types>
fn new_evm_with_ext<'a>( &self, db: impl FoundryDatabase + 'a, env: EvmEnv<Self::Types>, ext: <Self::Types as EvmTypesHost>::EvmExt, ) -> Evm<'a, Self::Types>
Creates a Foundry-configured EVM with the given network extension state, such as the running EVM’s for a nested frame.
The factory must already be configured for the source database and environment. This
neither reconfigures it nor seeds network state; db may be a temporary placeholder.
Sourcefn env_with_spec(
&self,
env: EvmEnv<Self::Types>,
spec: SpecOf<Self>,
) -> EvmEnv<Self::Types>
fn env_with_spec( &self, env: EvmEnv<Self::Types>, spec: SpecOf<Self>, ) -> EvmEnv<Self::Types>
Returns env with spec, keeping Foundry’s execution toggles and limits.
Sourcefn set_env(&self, evm: &mut Evm<'_, Self::Types>, env: EvmEnv<Self::Types>)
fn set_env(&self, evm: &mut Evm<'_, Self::Types>, env: EvmEnv<Self::Types>)
Switches evm to env: its block, spec and chain ID, keeping Foundry’s execution toggles
and limits.
This rebuilds the dispatch tables, the transaction registry and the precompiles, so opcode
and precompile availability follows the new spec. It must not be called while evm is
executing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl FoundryEvmFactory for BaseEvmFactory
Available on crate feature base only.
impl FoundryEvmFactory for BaseEvmFactory
base only.type Types = BaseEvmTypes
fn version(&self, spec: BaseSpecId, chain_id: u64) -> Version
fn execution_config( &self, spec: BaseSpecId, version: Version, ) -> ExecutionConfig<BaseEvmTypes>
fn tx_registry( &self, spec: BaseSpecId, ) -> TxRegistry<BaseEvmTypes, TxResult<BaseEvmTypes>>
fn precompiles( &self, env: &EvmEnv<BaseEvmTypes>, _ext: &BaseEvmExt, ) -> Box<dyn PrecompileProvider<BaseEvmTypes>>
fn configure_for<D: FoundryDatabase + ?Sized>( &self, db: &D, env: &EvmEnv<BaseEvmTypes>, ) -> Self
fn initialize_evm(&self, evm: &mut Evm<'_, BaseEvmTypes>, _is_forked: bool)
Source§impl FoundryEvmFactory for MonadEvmFactory
Available on crate feature monad only.
impl FoundryEvmFactory for MonadEvmFactory
monad only.type Types = MonadEvmTypes
fn version(&self, spec: MonadHardfork, chain_id: u64) -> Version
fn execution_config( &self, spec: MonadHardfork, version: Version, ) -> ExecutionConfig<MonadEvmTypes>
fn tx_registry( &self, spec: MonadHardfork, ) -> TxRegistry<MonadEvmTypes, TxResult<MonadEvmTypes>>
fn precompiles( &self, env: &EvmEnv<MonadEvmTypes>, _ext: &MonadEvmExt, ) -> Box<dyn PrecompileProvider<MonadEvmTypes>>
Source§impl FoundryEvmFactory for OpEvmFactory
Available on crate feature optimism only.
impl FoundryEvmFactory for OpEvmFactory
optimism only.