Trait CheatcodesExecutor
pub trait CheatcodesExecutor<CTX>where
CTX: ContextTr,{
// Required methods
fn with_nested_evm(
&mut self,
cheats: &mut Cheatcodes,
ecx: &mut CTX,
f: &mut dyn FnMut(&mut dyn NestedEvm<Spec = <<CTX as ContextTr>::Cfg as Cfg>::Spec, Tx = <CTX as ContextTr>::Tx, Block = <CTX as ContextTr>::Block>) -> Result<(), EVMError<DatabaseError>>,
) -> Result<(), EVMError<DatabaseError>>;
fn transact_on_db(
&mut self,
cheats: &mut Cheatcodes,
ecx: &mut CTX,
fork_id: Option<Uint<256, 4>>,
transaction: FixedBytes<32>,
) -> Result<(), Report>;
fn transact_from_tx_on_db(
&mut self,
cheats: &mut Cheatcodes,
ecx: &mut CTX,
tx: &<CTX as ContextTr>::Tx,
) -> Result<(), Report>;
fn with_fresh_nested_evm(
&mut self,
cheats: &mut Cheatcodes,
db: &mut dyn DatabaseExt<<CTX as ContextTr>::Block, <CTX as ContextTr>::Tx, <<CTX as ContextTr>::Cfg as Cfg>::Spec, Error = DatabaseError>,
evm_env: EvmEnv<<<CTX as ContextTr>::Cfg as Cfg>::Spec, <CTX as ContextTr>::Block>,
tx_env: <CTX as ContextTr>::Tx,
f: &mut dyn FnMut(&mut dyn NestedEvm<Spec = <<CTX as ContextTr>::Cfg as Cfg>::Spec, Tx = <CTX as ContextTr>::Tx, Block = <CTX as ContextTr>::Block>) -> Result<(), EVMError<DatabaseError>>,
) -> Result<(), EVMError<DatabaseError>>;
fn console_log(&mut self, cheats: &mut Cheatcodes, msg: &str);
// Provided methods
fn tracing_inspector(&mut self) -> Option<&mut TracingInspector> { ... }
fn set_in_inner_context(
&mut self,
_enabled: bool,
_original_origin: Option<Address>,
) { ... }
}Expand description
Helper trait for running nested EVM operations from inside cheatcode implementations.
Required Methods§
fn with_nested_evm(
&mut self,
cheats: &mut Cheatcodes,
ecx: &mut CTX,
f: &mut dyn FnMut(&mut dyn NestedEvm<Spec = <<CTX as ContextTr>::Cfg as Cfg>::Spec, Tx = <CTX as ContextTr>::Tx, Block = <CTX as ContextTr>::Block>) -> Result<(), EVMError<DatabaseError>>,
) -> Result<(), EVMError<DatabaseError>>
fn with_nested_evm( &mut self, cheats: &mut Cheatcodes, ecx: &mut CTX, f: &mut dyn FnMut(&mut dyn NestedEvm<Spec = <<CTX as ContextTr>::Cfg as Cfg>::Spec, Tx = <CTX as ContextTr>::Tx, Block = <CTX as ContextTr>::Block>) -> Result<(), EVMError<DatabaseError>>, ) -> Result<(), EVMError<DatabaseError>>
Runs a closure with a nested EVM built from the current context. The inspector is assembled internally — never exposed to the caller.
fn transact_on_db(
&mut self,
cheats: &mut Cheatcodes,
ecx: &mut CTX,
fork_id: Option<Uint<256, 4>>,
transaction: FixedBytes<32>,
) -> Result<(), Report>
fn transact_on_db( &mut self, cheats: &mut Cheatcodes, ecx: &mut CTX, fork_id: Option<Uint<256, 4>>, transaction: FixedBytes<32>, ) -> Result<(), Report>
Replays a historical transaction on the database. Inspector is assembled internally.
fn transact_from_tx_on_db(
&mut self,
cheats: &mut Cheatcodes,
ecx: &mut CTX,
tx: &<CTX as ContextTr>::Tx,
) -> Result<(), Report>
fn transact_from_tx_on_db( &mut self, cheats: &mut Cheatcodes, ecx: &mut CTX, tx: &<CTX as ContextTr>::Tx, ) -> Result<(), Report>
Executes a TransactionRequest on the database. Inspector is assembled internally.
fn with_fresh_nested_evm(
&mut self,
cheats: &mut Cheatcodes,
db: &mut dyn DatabaseExt<<CTX as ContextTr>::Block, <CTX as ContextTr>::Tx, <<CTX as ContextTr>::Cfg as Cfg>::Spec, Error = DatabaseError>,
evm_env: EvmEnv<<<CTX as ContextTr>::Cfg as Cfg>::Spec, <CTX as ContextTr>::Block>,
tx_env: <CTX as ContextTr>::Tx,
f: &mut dyn FnMut(&mut dyn NestedEvm<Spec = <<CTX as ContextTr>::Cfg as Cfg>::Spec, Tx = <CTX as ContextTr>::Tx, Block = <CTX as ContextTr>::Block>) -> Result<(), EVMError<DatabaseError>>,
) -> Result<(), EVMError<DatabaseError>>
fn with_fresh_nested_evm( &mut self, cheats: &mut Cheatcodes, db: &mut dyn DatabaseExt<<CTX as ContextTr>::Block, <CTX as ContextTr>::Tx, <<CTX as ContextTr>::Cfg as Cfg>::Spec, Error = DatabaseError>, evm_env: EvmEnv<<<CTX as ContextTr>::Cfg as Cfg>::Spec, <CTX as ContextTr>::Block>, tx_env: <CTX as ContextTr>::Tx, f: &mut dyn FnMut(&mut dyn NestedEvm<Spec = <<CTX as ContextTr>::Cfg as Cfg>::Spec, Tx = <CTX as ContextTr>::Tx, Block = <CTX as ContextTr>::Block>) -> Result<(), EVMError<DatabaseError>>, ) -> Result<(), EVMError<DatabaseError>>
Runs a closure with a fresh nested EVM built from a raw database and environment.
Unlike with_nested_evm, this does NOT clone from ecx and does NOT write back.
The caller is responsible for state merging. Used by executeTransactionCall.
fn console_log(&mut self, cheats: &mut Cheatcodes, msg: &str)
fn console_log(&mut self, cheats: &mut Cheatcodes, msg: &str)
Simulates console.log invocation.
Provided Methods§
fn tracing_inspector(&mut self) -> Option<&mut TracingInspector>
fn tracing_inspector(&mut self) -> Option<&mut TracingInspector>
Returns a mutable reference to the tracing inspector if it is available.
fn set_in_inner_context(
&mut self,
_enabled: bool,
_original_origin: Option<Address>,
)
fn set_in_inner_context( &mut self, _enabled: bool, _original_origin: Option<Address>, )
Marks that the next EVM frame is an “inner context” so that isolation mode does not
trigger a nested transact_inner. original_origin is stored for the existing
inner-context adjustment logic that restores tx.origin.