pub trait FoundryEvmFactory:
Clone
+ Debug
+ Default
+ Send
+ Sync
+ 'static {
type Types: FoundryExecutionHooks + EvmTypesHost
where <Self::Types as EvmTypesHost>::SpecId: ExecutionSpec + Default + Debug + PartialEq + Send + Sync + Unpin,
<Self::Types as EvmTypesHost>::Tx: Typed2718 + Clone + Debug + Send + Sync,
<Self::Types as EvmTypesHost>::BlockEnvExt: Copy + Debug + Default + Send + Sync + 'static,
<Self::Types as EvmTypesHost>::EvmExt: FoundryEvmExt<<Self::Types as EvmTypesHost>::Tx>,
<Self::Types as EvmTypesHost>::TxResultExt: FoundryTxResultExt;
Show 13 methods
// Required methods
fn version(
&self,
spec: <Self::Types as EvmTypesHost>::SpecId,
chain_id: u64,
) -> Version;
fn tx_registry(
&self,
spec: <Self::Types as EvmTypesHost>::SpecId,
) -> TxRegistry<Self::Types, TxResultExt<<Self::Types as EvmTypesHost>::TxResultExt>>;
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: <Self::Types as EvmTypesHost>::SpecId,
version: Version,
) -> ExecutionConfig<Self::Types> { ... }
fn evm_ext(
&self,
_env: &EvmEnv<Self::Types>,
) -> <Self::Types as EvmTypesHost>::EvmExt { ... }
fn configure_for<D>(&self, _db: &D, _env: &EvmEnv<Self::Types>) -> Self
where D: FoundryDatabase + ?Sized { ... }
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: <Self::Types as EvmTypesHost>::SpecId,
) -> 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
where
<Self::Types as EvmTypesHost>::SpecId: ExecutionSpec + Default + Debug + PartialEq + Send + Sync + Unpin,
<Self::Types as EvmTypesHost>::Tx: Typed2718 + Clone + Debug + Send + Sync,
<Self::Types as EvmTypesHost>::BlockEnvExt: Copy + Debug + Default + Send + Sync + 'static,
<Self::Types as EvmTypesHost>::EvmExt: FoundryEvmExt<<Self::Types as EvmTypesHost>::Tx>,
<Self::Types as EvmTypesHost>::TxResultExt: FoundryTxResultExt
type Types: FoundryExecutionHooks + EvmTypesHost where <Self::Types as EvmTypesHost>::SpecId: ExecutionSpec + Default + Debug + PartialEq + Send + Sync + Unpin, <Self::Types as EvmTypesHost>::Tx: Typed2718 + Clone + Debug + Send + Sync, <Self::Types as EvmTypesHost>::BlockEnvExt: Copy + Debug + Default + Send + Sync + 'static, <Self::Types as EvmTypesHost>::EvmExt: FoundryEvmExt<<Self::Types as EvmTypesHost>::Tx>, <Self::Types as EvmTypesHost>::TxResultExt: FoundryTxResultExt
evm2 type family: spec, transaction, block, EVM and result extensions.
Required Methods§
Sourcefn version(
&self,
spec: <Self::Types as EvmTypesHost>::SpecId,
chain_id: u64,
) -> Version
fn version( &self, spec: <Self::Types as EvmTypesHost>::SpecId, chain_id: u64, ) -> Version
Returns the default runtime version for spec on chain_id.
Sourcefn tx_registry(
&self,
spec: <Self::Types as EvmTypesHost>::SpecId,
) -> TxRegistry<Self::Types, TxResultExt<<Self::Types as EvmTypesHost>::TxResultExt>>
fn tx_registry( &self, spec: <Self::Types as EvmTypesHost>::SpecId, ) -> TxRegistry<Self::Types, TxResultExt<<Self::Types as EvmTypesHost>::TxResultExt>>
Returns the transaction handler registry for spec.
Provided Methods§
Sourcefn execution_config(
&self,
spec: <Self::Types as EvmTypesHost>::SpecId,
version: Version,
) -> ExecutionConfig<Self::Types>
fn execution_config( &self, spec: <Self::Types as EvmTypesHost>::SpecId, 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>(&self, _db: &D, _env: &EvmEnv<Self::Types>) -> Selfwhere
D: FoundryDatabase + ?Sized,
fn configure_for<D>(&self, _db: &D, _env: &EvmEnv<Self::Types>) -> Selfwhere
D: FoundryDatabase + ?Sized,
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: <Self::Types as EvmTypesHost>::SpecId,
) -> EvmEnv<Self::Types>
fn env_with_spec( &self, env: EvmEnv<Self::Types>, spec: <Self::Types as EvmTypesHost>::SpecId, ) -> 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".