Expand description
The Forge test runner.
Re-exportsΒ§
use crate::MultiContractRunner;πuse crate::TestFilter;πuse crate::coverage::HitMaps;πuse crate::fuzz::BaseCounterExample;πuse crate::fuzz::FuzzTestResult;πuse crate::multi_runner::FuzzMinimizeConfig;πuse crate::multi_runner::FuzzMinimizeMode;πuse crate::multi_runner::FuzzMinimizeObservation;πuse crate::multi_runner::LibraryDeployment;πuse crate::multi_runner::TestContract;πuse crate::multi_runner::TestFunctionMatcher;πuse crate::multi_runner::TestRunnerConfig;πuse crate::multi_runner::is_generated_symbolic_regression_contract;πuse crate::progress::TestsProgress;πuse crate::result::InvariantFailure;πuse crate::result::InvariantOutcome;πuse crate::result::InvariantPredicateResult;πuse crate::result::SetupOutcome;πuse crate::result::SetupStorage;πuse crate::result::SuiteResult;πuse crate::result::SymbolicArtifactRef;πuse crate::result::SymbolicCallTrace;πuse crate::result::SymbolicCorpusSeedMetadata;πuse crate::result::SymbolicCorpusSeedRef;πuse crate::result::SymbolicCounterexample;πuse crate::result::SymbolicCounterexampleArtifact;πuse crate::result::SymbolicCounterexampleArtifactKind;πuse crate::result::SymbolicCounterexampleCall;πuse crate::result::SymbolicCounterexampleMinimization;πuse crate::result::SymbolicCounterexampleReplaySemantics;πuse crate::result::SymbolicCounterexampleTestIdentity;πuse crate::result::SymbolicInvariantArtifactFailure;πuse crate::result::SymbolicInvariantFailureSite;πuse crate::result::SymbolicReplayMetadata;πuse crate::result::SymbolicReplayStatus;πuse crate::result::SymbolicResult;πuse crate::result::TestKind;πuse crate::result::TestResult;πuse crate::result::TestSetup;πuse crate::result::TestStatus;πuse crate::result::invariant_campaign_display_name;πuse crate::result::invariant_kind;πuse crate::symbolic_minimizer::MinimizedSequence;πuse crate::symbolic_minimizer::minimize_sequence_counterexample;πuse crate::symbolic_minimizer::minimize_single_call_counterexample;πuse alloy_dyn_abi::DynSolValue;πuse alloy_dyn_abi::JsonAbiExt;πuse alloy_json_abi::Function;πuse alloy_json_abi::JsonAbi;πuse alloy_json_abi::StateMutability;πuse alloy_primitives::Address;πuse alloy_primitives::B256;πuse alloy_primitives::Bytes;πuse alloy_primitives::I256;πuse alloy_primitives::Selector;πuse alloy_primitives::U256;πuse alloy_primitives::address;πuse alloy_primitives::hex;πuse alloy_primitives::hex;πuse alloy_primitives::keccak256;πuse alloy_primitives::map::Entry;πuse alloy_primitives::map::HashMap;πuse alloy_primitives::map::HashSet;πuse evm2::bytecode::Bytecode;πuse evm2::evm::Cache;πuse evm2::evm::InMemoryDB;πuse evm2::interpreter::InstrStop;πuse evm2::interpreter::op as opcode;πuse eyre::Result;πuse foundry_common::LIBRARY_DEPLOYER;πuse foundry_common::TestFunctionExt;πuse foundry_common::TestFunctionKind;πuse foundry_common::contracts::ContractsByAddress;πuse foundry_compilers::utils::canonicalized;πuse foundry_config::Config;πuse foundry_config::FuzzConfig;πuse foundry_config::FuzzCorpusConfig;πuse foundry_config::FuzzDictionaryConfig;πuse foundry_config::InlineConfig;πuse foundry_config::InvariantConfig;πuse foundry_config::InvariantDepthMode;πuse foundry_config::SymbolicConfig;πuse foundry_evm::constants::CALLER;πuse foundry_evm::constants::MAGIC_ASSUME;πuse foundry_evm::core::evm::FoundryEvmNetwork;πuse foundry_evm::decode::RevertDecoder;πuse foundry_evm::decode::SkipReason;πuse foundry_evm::executors::CallResult;πuse foundry_evm::executors::DynamicTargetCtx;πuse foundry_evm::executors::EvmError;πuse foundry_evm::executors::Executor;πuse foundry_evm::executors::ITest;πuse foundry_evm::executors::InvariantReplayOptions;πuse foundry_evm::executors::MinimizationReplayInput;πuse foundry_evm::executors::RawCallResult;πuse foundry_evm::executors::RawFailure;πuse foundry_evm::executors::ShowmapOpts;πuse foundry_evm::executors::ShowmapReplayTarget;πuse foundry_evm::executors::StatelessReplayTarget;πuse foundry_evm::executors::canonical_replay_dirs;πuse foundry_evm::executors::fuzz::FuzzedExecutor;πuse foundry_evm::executors::invariant::CandidateReplay;πuse foundry_evm::executors::invariant::CheckSequenceFailureSite;πuse foundry_evm::executors::invariant::CheckSequenceOptions;πuse foundry_evm::executors::invariant::CheckSequenceOutcome;πuse foundry_evm::executors::invariant::HandlerAssertionFailure;πuse foundry_evm::executors::invariant::InvariantExecutor;πuse foundry_evm::executors::invariant::InvariantFuzzError;πuse foundry_evm::executors::invariant::LiveInvariantSolution;πuse foundry_evm::executors::invariant::LiveInvariantSolver;πuse foundry_evm::executors::invariant::ReplayErrorResult;πuse foundry_evm::executors::invariant::apply_invariant_call_delay;πuse foundry_evm::executors::invariant::check_sequence;πuse foundry_evm::executors::invariant::deadline_passed;πuse foundry_evm::executors::invariant::did_fail_on_assert;πuse foundry_evm::executors::invariant::execute_and_commit_tx;πuse foundry_evm::executors::invariant::execute_tx;πuse foundry_evm::executors::invariant::execute_tx_and_register_created;πuse foundry_evm::executors::invariant::handler_edge_fingerprint;πuse foundry_evm::executors::invariant::replay_error;πuse foundry_evm::executors::invariant::replay_handler_failure_sequence;πuse foundry_evm::executors::invariant::replay_run;πuse foundry_evm::executors::invariant::reset_shrink_progress;πuse foundry_evm::executors::persist_corpus_seed;πuse foundry_evm::executors::read_corpus_dir;πuse foundry_evm::executors::replay_corpus_to_showmap;πuse foundry_evm::executors::replay_sequence_for_minimization;πuse foundry_evm::executors::should_ignore_revert;πuse foundry_evm::fuzz::BasicTxDetails;πuse foundry_evm::fuzz::CallDetails;πuse foundry_evm::fuzz::CounterExample;πuse foundry_evm::fuzz::FuzzFixtures;πuse foundry_evm::fuzz::fixture_name;πuse foundry_evm::fuzz::invariant::FuzzRunIdentifiedContracts;πuse foundry_evm::fuzz::invariant::InvariantContract;πuse foundry_evm::fuzz::invariant::InvariantSettings;πuse foundry_evm::fuzz::invariant::SenderFilters;πuse foundry_evm::fuzz::invariant::TargetedContracts;πuse foundry_evm::fuzz::invariant::is_optimization_invariant;πuse foundry_evm::fuzz::strategies::EvmFuzzState;πuse foundry_evm::inspectors::CmpOperands;πuse foundry_evm::inspectors::EdgeCovConfig;πuse foundry_evm::inspectors::EdgeCovKind;πuse foundry_evm::inspectors::cheatcodes::Vm::AccountAccess;πuse foundry_evm::traces::TraceKind;πuse foundry_evm::traces::TraceRequirements;πuse foundry_evm::traces::load_contracts;πuse foundry_evm_networks::NetworkVariant;πuse foundry_evm_symbolic::ExecutorView;πuse foundry_evm_symbolic::SYMBOLIC_VM_COMPAT_ADDRESS;πuse foundry_evm_symbolic::SymbolicBranchTarget;πuse foundry_evm_symbolic::SymbolicConcreteInput;πuse foundry_evm_symbolic::SymbolicExecutor;πuse foundry_evm_symbolic::SymbolicInvariantCandidateInput;πuse foundry_evm_symbolic::SymbolicInvariantCounterexampleKind;πuse foundry_evm_symbolic::SymbolicInvariantRunInput;πuse foundry_evm_symbolic::SymbolicInvariantRunResult;πuse foundry_evm_symbolic::SymbolicInvariantStep;πuse foundry_evm_symbolic::SymbolicInvariantTarget;πuse foundry_evm_symbolic::SymbolicRunInput;πuse foundry_evm_symbolic::SymbolicRunResult;πuse foundry_evm_symbolic::SymbolicStats;πuse foundry_evm_symbolic::SymbolicStopReason;πuse foundry_evm_symbolic::SymbolicStorageAssignment;πuse foundry_evm_symbolic::symbolic_vm_selectors;πuse itertools::Itertools;πuse proptest::test_runner::RngAlgorithm;πuse proptest::test_runner::TestError;πuse proptest::test_runner::TestRng;πuse proptest::test_runner::TestRunner;πuse serde::Deserialize;πuse serde::Deserialize;πuse serde::Serialize;πuse serde::Serialize;πuse std::borrow::Cow;πuse std::collections::BTreeMap;πuse std::ops::Deref;πuse std::path::Path;πuse std::path::PathBuf;πuse std::sync::Arc;πuse std::sync::Mutex;πuse std::time::Instant;πuse tokio::signal;πuse tracing::Span;πuse rayon::prelude::*;π
StructsΒ§
- Confirmed
Frontier πInvariant Failure - An invariant failure confirmed while solving a captured fuzz frontier.
- Contract
Runner - A type that executes all tests of a contract
- Contract
Runner πContext - Function
Runner π - Executes a single test function, returning a
TestResult. - Fuzz
Branch πFrontier Artifact - Fuzz
Branch πFrontier Operands - Fuzz
Branch πFrontier Record - Fuzz
Branch πFrontier Site - Invariant
Campaign πScope - Invariant
Campaign πSelection - Invariant
Persisted πFailure - Holds data about a persisted invariant failure.
- Replayed
Invariant πSequence - A replayed and shrunk invariant counterexample.
- Sequence
Artifact πSpec - Metadata for the symbolic artifact persisted with a replayed invariant sequence.
- Sequence
Replay π - A stateful call sequence replay target shared by symbolic minimization and failure checks.
- Symbolic
Handler πReplay Storage - Symbolic storage assignments that only apply when replaying the exact recorded sequence.
EnumsΒ§
- Persisted
Fingerprint πProvenance - Reproducible edge-fingerprint algorithms and their capture configuration.
- Sequence
Minimization π - How to report a failing invariant sequence, see
FunctionRunner::minimize_invariant_sequence.
ConstantsΒ§
- FUZZ_
BRANCH_ πFRONTIER_ FILE - FUZZ_
BRANCH_ πFRONTIER_ SCHEMA - STATEFUL_
FUZZ_ πBRANCH_ FRONTIER_ SCHEMA
FunctionsΒ§
- apply_
symbolic_ πstorage - Applies the setup storage of a symbolic counterexample. Arbitrary storage draws the modeled values instead of random ones, keeping its own rules for when a slot is drawn; other storage, such as under the generic layout, is written directly.
- base_
counterexample_ πto_ tx - base_
counterexamples π - Converts campaign transactions into displayable counterexample calls.
- base_
counterexamples_ πto_ txes - Converts a persisted counterexample to
BasicTxDetails, settingshow_solidityin place. - can_
merge_ πinvariant_ suite - Returns whether predicates can share a concrete campaign. Symbolic execution checks one predicate at a time with its own symbolic configuration, result, and replay.
- comparison_
result π - contract_
short_ πname - Returns the contract name without the file path prefix.
- corpus_
has_ πentries - Returns whether any canonical replay directory under
dirholds a corpus entry. - count_
runnable_ πinvariant_ campaign_ anchors - effective_
test_ πfunction_ kind - failed_
invariant_ πcalls - Returns the failing call sequence of a replayable invariant error.
- frontier_
comparison_ πflipped - frontier_
filter_ πdisplay - frontier_
selector π - function_
matches_ πnetwork_ pass - fuzz_
test_ πpath_ name - Returns a stable path component that distinguishes overloaded fuzz tests.
- fuzzer_
with_ πcases - handler_
failure_ πfile - inline_
config_ πfor - invariant_
corpus_ πdir - Returns the corpus directory of a shared contract campaign or an isolated campaign.
- invariant_
failure_ πfile - Returns the current invariant failure cache path.
- invariant_
frontier_ πdir - Returns the collision-free directory for one stateful frontier campaign.
- invariant_
handler_ πfailure_ name - invariant_
suite_ πpaths - Sets the invariant corpus directory and returns the contract-level failure directory.
- legacy_
fuzz_ πcorpus_ dir - Returns the legacy unqualified corpus when the qualified corpus has no entries.
- minimized_
reason π - Returns the reason to show for a minimized sequence, whose values can differ from the campaignβs: the minimized replayβs reason when replaying the original sequence reproduced the campaign reason, otherwise the campaign reason.
- narrow_
generated_ πcorpus_ root - Narrows a generated corpus root to the per-test directory when it exists.
- parse_
frontier_ πselectors - persisted_
call_ πsequence - Helper function to load failed call sequence from file. Ignores failure if generated with different invariant settings than the current ones.
- persisted_
invariant_ πfailure - Loads a persisted invariant failure from the new cache path, falling back to the legacy path.
- record_
handler_ πfailure - Persists a handler-side assertion bug with symbolic replay storage.
- record_
invariant_ πfailure - Persists an invariant failure, with any symbolic replay storage and confirmed failure site.
- replay_
fuzz_ πminimize - Replays one corpus-minimization candidate and records its coverage observation.
- replay_
ran_ πout_ of_ gas - Returns whether a replay ran out of gas without failing an assertion first. The symbolic engine
does not model gas, so such a halt is not the failure the solver model was found for.
MemoryLimitOOGandInvalidOperandOOGare memory exceptions the engine does model. - replayed_
memory_ πhalt - Returns whether a replay ran out of gas at
pcon a memory access that ends beyondmemory_limit, the halt the symbolic engine modeled there. - same_
sequence_ πfailure - Returns
trueif two sequence replays failed in the same way at the same site. - sample_
stateful_ πfrontiers - sanitize_
symbolic_ πartifact_ component - select_
context_ πdiverse_ frontiers - select_
invariant_ πcampaigns - select_
stateful_ πfrontiers - should_
symbolically_ πimport_ fuzz_ corpus - solve_
live_ πinvariant_ frontier - Solves a live comparison from its concrete prefix. Only the campaign can turn the returned sequence into a reported failure or a coverage-winning corpus entry.
- stable_
hashed_ πcomponent - svm_
returns_ πexhausted - Returns whether a replay answered with
svm_returnsmade ansvm.*call past them. A test that clears mocked calls also clears the sequence, which only matters when it had returns. - symbolic_
artifact_ πfile_ name - symbolic_
invariant_ πcounterexample_ calls - symbolic_
invariant_ πunsupported_ domain_ reason - test_
paths π - Helper function to set test corpus dir and to compose persisted failure paths.
- warn_
fork_ πblock_ mismatch - Warns when a persisted failure is replayed on a different fork block than it was recorded on. Returns whether the blocks differ.
- warn_
unimported_ πfrontiers - Warns about requested frontier
labels that the frontier file atpathdid not provide.
Type AliasesΒ§
- Handler
Failure πMap - Persisted handler-side assertion bugs keyed by
(reverter, selector). - Sequence
Reasons π - Failure reasons of replaying an original sequence and its minimized form.
- Symbolic
Handler πStorage Map - Symbolic replay storage for handler bugs keyed by
(reverter, selector, fingerprint).