Skip to main content

with_cloned_context

Function with_cloned_context 

Source
pub fn with_cloned_context<CTX: FoundryContextExt>(
    ecx: &mut CTX,
    f: impl FnOnce(&mut CTX::Db, EvmEnv<CTX::Spec, CTX::Block>, JournaledState) -> Result<(EvmEnv<CTX::Spec, CTX::Block>, JournaledState), EVMError<DatabaseError>>,
) -> Result<(), EVMError<DatabaseError>>
Expand description

Clones the current context (env + journal), passes the database, cloned env, and cloned journal inner to the callback. The callback builds whatever EVM it needs, runs its operations, and returns (result, modified_env, modified_journal). Modified state is written back after the callback returns.