Skip to main content

Module executors

Module executors 

Source
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; πŸ”’ monad
use foundry_evm_core::evm::MonadEvmNetwork; πŸ”’ monad
pub 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Β§

CallResult
The result of a call.
CorpusDirEntry
A single corpus file on disk.
DeployResult
The result of a deployment.
DynamicTargetCtx
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.
EarlyExit
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.
ExecutionErr
Represents the context after an execution error occurred.
Executor
EVM executor.
ExecutorBuilder
The builder that allows to configure an evm Executor which a stack of optional evm2 inspectors, such as Cheatcodes.
FuzzTestTimer
Timer for a fuzz test.
InvariantReplayOptions
Invariant replay settings that affect when terminal checks run.
MinimizationReplayInput
RawCallResult
The result of a raw call.
RawFailure
The outcome of a call, see RawCallResult::raw_failure.
ReplayObservation
Facts observed while replaying one candidate for corpus minimization.
ShowmapOpts
Per-replay options.
ShowmapReplayTarget
Test target metadata needed to replay corpus entries.
ShowmapStats
Stats returned from a single trial replay.
StatelessReplayTarget
TracingExecutor
A default executor with tracing enabled
TracingFork
Fork state and network context used to construct a tracing executor.

EnumsΒ§

EvmError
EvmExecutionCancellation πŸ”’
Shared cancellation state for an active EVM execution.
ReplayFailure
A structured identity for a failure observed during corpus replay.
ShowmapDomain
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 tx pays before execution in evm_env.
canonical_replay_dirs
Returns every worker*/corpus/ under root, 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 inspector and execution to a RawCallResult.
execute πŸ”’
Executes tx and returns its result and EVM for the caller to commit, park or discard.
install_env πŸ”’
Installs env on evm, freshly created over backend, 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_dir and emit showmap files.
replay_sequence_for_minimization
Replays one candidate input and returns coverage/failure facts for minimizers.
same_execution_config πŸ”’
Returns whether current and next build the same execution config: the same spec and every field of their runtime Version, 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.