Skip to main content

Module runner

Module runner 

Source
Expand description

The Forge test runner.

Structsยง

ContractRunner
A type that executes all tests of a contract
ContractRunnerContext ๐Ÿ”’
FunctionRunner ๐Ÿ”’
Executes a single test function, returning a TestResult.
InvariantCampaignScope ๐Ÿ”’
InvariantCampaignSelection ๐Ÿ”’
InvariantPersistedFailure ๐Ÿ”’
Holds data about a persisted invariant failure.
ReplayContext ๐Ÿ”’
Borrowed context shared by primary-invariant and handler-side replay helpers.

Constantsยง

LIBRARY_DEPLOYER
When running tests, we deploy all external libraries present in the project. To avoid additional libraries affecting nonces of senders used in tests, we are using separate address to predeploy libraries.

Functionsยง

base_counterexamples_to_txes ๐Ÿ”’
Converts a persisted counterexample to BasicTxDetails, setting show_solidity in place.
count_runnable_invariant_campaign_anchors ๐Ÿ”’
function_matches_network_pass ๐Ÿ”’
fuzzer_with_cases ๐Ÿ”’
inline_config_for ๐Ÿ”’
invariant_contract_name ๐Ÿ”’
Returns the invariant test contract name without the file path prefix.
invariant_failure_dir ๐Ÿ”’
Returns the contract-level invariant failure directory.
invariant_failure_file ๐Ÿ”’
Returns the current invariant failure cache path.
invariant_suite_configs_match ๐Ÿ”’
invariant_suite_paths ๐Ÿ”’
Sets the invariant corpus directory and returns the contract-level failure directory.
is_symbolic_entrypoint ๐Ÿ”’
legacy_invariant_failure_file ๐Ÿ”’
Returns the legacy invariant failure cache path.
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 under <failure_dir>/handlers/<site>.json, where <site> is keccak256(reverter || selector).
record_invariant_failure ๐Ÿ”’
Helper function to persist invariant failure.
replay_persisted_call_sequence ๐Ÿ”’
Converts a persisted BaseCounterExample sequence into BasicTxDetails (applying ctx.show_solidity in place) and replays it via check_sequence.
replay_persisted_handler_failures ๐Ÿ”’
Replays persisted handler-side assertion bugs. A file is kept only if the anchor still asserts at the same (reverter, selector) site; stale files (anchor no longer asserts, asserts at a different site, or earlier call asserts) are deleted in place.
select_invariant_campaigns ๐Ÿ”’
test_paths ๐Ÿ”’
Helper function to set test corpus dir and to compose persisted failure paths.

Type Aliasesยง

CheckSequenceResult ๐Ÿ”’
Mirrors check_sequenceโ€™s return: (success, replayed_entirely, optional_reason).