Skip to main content

FoundryEvmFactory

Trait FoundryEvmFactory 

Source
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§

Source

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§

Source

fn version( &self, spec: <Self::Types as EvmTypesHost>::SpecId, chain_id: u64, ) -> Version

Returns the default runtime version for spec on chain_id.

Source

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.

Source

fn precompiles( &self, env: &EvmEnv<Self::Types>, ext: &<Self::Types as EvmTypesHost>::EvmExt, ) -> Box<dyn PrecompileProvider<Self::Types>>

Returns the precompiles for env, sharing any accounting state held by ext.

Provided Methods§

Source

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.

Source

fn evm_ext( &self, _env: &EvmEnv<Self::Types>, ) -> <Self::Types as EvmTypesHost>::EvmExt

Returns fresh extension state for an EVM built with env.

Source

fn configure_for<D>(&self, _db: &D, _env: &EvmEnv<Self::Types>) -> Self
where D: FoundryDatabase + ?Sized,

Returns this factory configured for an EVM over db, such as Base’s activation admin for the fork’s source chain.

Source

fn with_networks(&self, _networks: NetworkConfigs) -> Self

Returns this factory configured for networks, such as Celo’s transfer precompile on Ethereum.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

type Types = BaseEvmTypes

Source§

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

Source§

fn execution_config( &self, spec: BaseSpecId, version: Version, ) -> ExecutionConfig<BaseEvmTypes>

Source§

fn tx_registry( &self, spec: BaseSpecId, ) -> TxRegistry<BaseEvmTypes, TxResultExt<<BaseEvmTypes as EvmTypesHost>::TxResultExt>>

Source§

fn precompiles( &self, env: &EvmEnv<BaseEvmTypes>, _ext: &BaseEvmExt, ) -> Box<dyn PrecompileProvider<BaseEvmTypes>>

Source§

fn configure_for<D>(&self, db: &D, env: &EvmEnv<BaseEvmTypes>) -> BaseEvmFactory
where D: FoundryDatabase + ?Sized,

Source§

fn initialize_evm(&self, evm: &mut Evm<'_, BaseEvmTypes>, _is_forked: bool)

Source§

impl FoundryEvmFactory for MonadEvmFactory

Source§

type Types = MonadEvmTypes

Source§

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

Source§

fn execution_config( &self, spec: MonadHardfork, version: Version, ) -> ExecutionConfig<MonadEvmTypes>

Source§

fn tx_registry( &self, spec: MonadHardfork, ) -> TxRegistry<MonadEvmTypes, TxResultExt<<MonadEvmTypes as EvmTypesHost>::TxResultExt>>

Source§

fn precompiles( &self, env: &EvmEnv<MonadEvmTypes>, _ext: &MonadEvmExt, ) -> Box<dyn PrecompileProvider<MonadEvmTypes>>

Source§

impl FoundryEvmFactory for OpEvmFactory

Source§

type Types = OpEvmTypes

Source§

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

Source§

fn execution_config( &self, spec: OpSpecId, version: Version, ) -> ExecutionConfig<OpEvmTypes>

Source§

fn tx_registry( &self, spec: OpSpecId, ) -> TxRegistry<OpEvmTypes, TxResultExt<<OpEvmTypes as EvmTypesHost>::TxResultExt>>

Source§

fn precompiles( &self, env: &EvmEnv<OpEvmTypes>, _ext: &OpEvmExt, ) -> Box<dyn PrecompileProvider<OpEvmTypes>>

Source§

impl FoundryEvmFactory for TempoEvmFactory

Source§

type Types = TempoEvmTypes

Source§

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

Source§

fn execution_config( &self, spec: TempoHardfork, version: Version, ) -> ExecutionConfig<TempoEvmTypes>

Source§

fn tx_registry( &self, spec: TempoHardfork, ) -> TxRegistry<TempoEvmTypes, TxResultExt<<TempoEvmTypes as EvmTypesHost>::TxResultExt>>

Source§

fn precompiles( &self, env: &EvmEnv<TempoEvmTypes>, ext: &TempoEvmExt, ) -> Box<dyn PrecompileProvider<TempoEvmTypes>>

Source§

fn initialize_evm(&self, evm: &mut Evm<'_, TempoEvmTypes>, is_forked: bool)

Implementors§