Expand description
EVM executor abstractions, which can execute calls.
Used for running tests, scripts, and interacting with the inner backend which holds the state.
Re-exportsΒ§
use crate::inspectors::Cheatcodes;πuse crate::inspectors::CmpOperands;πuse crate::inspectors::EdgeCoverage;πuse crate::inspectors::EdgeIndexMap;πuse crate::inspectors::InspectorData;πuse crate::inspectors::InspectorStack;πuse crate::inspectors::cheatcodes::BroadcastableTransactions;πuse alloy_consensus::transaction::Recovered;πuse alloy_dyn_abi::DynSolValue;πuse alloy_dyn_abi::FunctionExt;πuse alloy_dyn_abi::JsonAbiExt;πuse alloy_eips::Typed2718;πuse alloy_eips::eip4788::BEACON_ROOTS_ADDRESS;πuse alloy_eips::eip7702::SignedAuthorization;πuse alloy_json_abi::Function;πuse alloy_network::TransactionBuilder;πuse alloy_primitives::Address;πuse alloy_primitives::B256;πuse alloy_primitives::Bytes;πuse alloy_primitives::Log;πuse alloy_primitives::TxKind;πuse alloy_primitives::U256;πuse alloy_primitives::keccak256;πuse alloy_primitives::map::HashMap;πuse alloy_sol_types::SolCall;πuse alloy_sol_types::sol;πuse evm2::Evm;πuse evm2::TxResultWithState;πuse evm2::bytecode::Bytecode;πuse evm2::evm::AccountInfo;πuse evm2::evm::PendingState;πuse evm2::evm::SystemTx;πuse evm2::interpreter::InstrStop;πuse foundry_cheatcodes::CheatcodesBackend;πuse foundry_common::FoundryTransactionBuilder;πuse foundry_evm_core::backend::Backend;πuse foundry_evm_core::backend::BackendResult;πuse foundry_evm_core::backend::CowBackend;πuse foundry_evm_core::backend::GLOBAL_FAIL_SLOT;πuse foundry_evm_core::backend::handler_error;πuse foundry_evm_core::constants::CALLER;πuse foundry_evm_core::constants::CHEATCODE_ADDRESS;πuse foundry_evm_core::constants::CHEATCODE_CONTRACT_HASH;πuse foundry_evm_core::constants::DEFAULT_CREATE2_DEPLOYER;πuse foundry_evm_core::constants::DEFAULT_CREATE2_DEPLOYER_CODE;πuse foundry_evm_core::constants::DEFAULT_CREATE2_DEPLOYER_DEPLOYER;πuse foundry_evm_core::decode::RevertDecoder;πuse foundry_evm_core::decode::SkipReason;πuse foundry_evm_core::edgecov;πuse foundry_evm_core::edgecov::EdgeCovGuard;πuse foundry_evm_core::eip2935::HISTORY_STORAGE_ADDRESS;πuse foundry_evm_core::eip2935::HISTORY_STORAGE_CODE;πuse foundry_evm_core::eip2935::history_storage_slot;πuse foundry_evm_core::eip2935::history_storage_value;πuse foundry_evm_core::eip2935::history_window_start;πuse foundry_evm_core::evm::ChainFor;πuse foundry_evm_core::evm::EthEvmNetwork;πuse foundry_evm_core::evm::EvmEnv;πuse foundry_evm_core::evm::EvmEnvFor;πuse foundry_evm_core::evm::EvmFactoryFor;πuse foundry_evm_core::evm::FoundryEvmExt;πuse foundry_evm_core::evm::FoundryEvmFactory;πuse foundry_evm_core::evm::FoundryEvmFor;πuse foundry_evm_core::evm::FoundryEvmNetwork;πuse foundry_evm_core::evm::FoundryTxConversion;πuse foundry_evm_core::evm::SpecFor;πuse foundry_evm_core::evm::TransactionRequestFor;πuse foundry_evm_core::evm::TxFor;πuse foundry_evm_core::evm::TxResultFor;πuse foundry_evm_core::evm::TypesFor;πuse foundry_evm_core::evm::evm_env;πuse foundry_evm_core::evm::release_inspector;πuse foundry_evm_coverage::HitMaps;πuse foundry_evm_fuzz::ObservedCall;πuse foundry_evm_networks::NetworkConfigs;πuse foundry_evm_traces::SparsedTraceArena;πuse foundry_evm_traces::TraceRequirements;πuse sancov::SancovGuard;πuse std::borrow::Cow;πuse std::sync::Arc;πuse std::sync::atomic::AtomicBool;πuse std::sync::atomic::Ordering;πuse std::time::Duration;πuse std::time::Instant;πuse foundry_evm_core::evm::BlockContext;πmonaduse foundry_evm_core::evm::MonadEvmNetwork;πmonadpub use fuzz::FuzzedExecutor;pub use invariant::InvariantExecutor;
ModulesΒ§
- ITest
- Module containing a contractβs types and functions.
- builder π
- campaign π
- Worker-local call execution policy shared by stateless and invariant fuzz campaigns.
- corpus π
- Corpus management for parallel fuzzing with coverage-guided mutation.
- corpus_
io π - Shared helpers for reading on-disk corpus directories.
- fuzz
- invariant
- sancov π
- showmap π
- AFL-
afl-showmap-style corpus replay. - trace π
StructsΒ§
- Call
Result - The result of a call.
- Corpus
DirEntry - A single corpus file on disk.
- Deploy
Result - The result of a deployment.
- Dynamic
Target Ctx - Refs used during corpus replay to register contracts deployed mid-sequence as fuzz targets,
mirroring the campaign loop so follow-up calls into them arenβt dropped by
can_replay_tx. - Early
Exit - Helper struct to enable early exit behavior: when one test fails or run is interrupted, all other tests stop early.
- Execution π
- A transaction executed by the
Executor. - Execution
Err - Represents the context after an execution error occurred.
- Executor
- EVM executor.
- Executor
Builder - The builder that allows to configure an evm
Executorwhich a stack of optional evm2 inspectors, such asCheatcodes. - Fuzz
Test Timer - Timer for a fuzz test.
- Invariant
Replay Options - Invariant replay settings that affect when terminal checks run.
- Minimization
Replay Input - RawCall
Result - The result of a raw call.
- RawFailure
- The outcome of a call, see
RawCallResult::raw_failure. - Replay
Observation - Facts observed while replaying one candidate for corpus minimization.
- Showmap
Opts - Per-replay options.
- Showmap
Replay Target - Test target metadata needed to replay corpus entries.
- Showmap
Stats - Stats returned from a single trial replay.
- Stateless
Replay Target - Tracing
Executor - A default executor with tracing enabled
- Tracing
Fork - Fork state and network context used to construct a tracing executor.
EnumsΒ§
- EvmError
- EvmExecution
Cancellation π - Shared cancellation state for an active EVM execution.
- Replay
Failure - A structured identity for a failure observed during corpus replay.
- Showmap
Domain - Which coverage bitmap(s) to dump.
ConstantsΒ§
- DURATION_
BETWEEN_ πMETRICS_ REPORT - EIP8130_
TX_ πTYPE - EIP-8130 transaction type.
FunctionsΒ§
- calculate_
stipend - Returns the intrinsic gas
txpays before execution inevm_env. - canonical_
replay_ dirs - Returns every
worker*/corpus/underroot, or[root]if none exist. - collect_
debug_ πbytecodes - Returns the runtime bytecode of every traced account, as of after the call.
- convert_
executed_ πresult - Converts the data aggregated in the
inspectorandexecutionto aRawCallResult. - execute π
- Executes
txand returns its result and EVM for the caller to commit, park or discard. - install_
env π - Installs
envonevm, freshly created overbackend, which starts with the backendβs environment. - parse_
corpus_ filename - Parses a corpus filename of the form
<uuid>-<timestamp>.json[.gz]. - persist_
corpus_ seed - Persists one call sequence as a corpus seed in the canonical worker0 corpus directory.
- read_
corpus_ dir - Iterate corpus files in
path, ignoring entries with unparsable names. - read_
corpus_ tree - Reads corpus files from a file, corpus directory, worker corpus directory, or generated corpus
root such as
<root>/<contract>/<test>/worker0/corpus. - replay_
corpus_ to_ showmap - Replay every corpus entry under
corpus_dirand emit showmap files. - replay_
sequence_ for_ minimization - Replays one candidate input and returns coverage/failure facts for minimizers.
- same_
execution_ πconfig - Returns whether
currentandnextbuild the same execution config: the same spec and every field of their runtimeVersion, so only the block differs. - should_
ignore_ revert - Returns whether a nested revert can be ignored when fail-on-revert is disabled.
- with_
authorization_ πlist - Attaches an EIP-7702 authorization list to
tx, which then executes as a fee-less EIP-7702 transaction. - worker_
seed π - Derives the deterministic RNG seed for a fuzz or invariant worker.