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
FunctionRunner ๐Ÿ”’
Executes a single test function, returning a TestResult.
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.
fuzzer_with_cases ๐Ÿ”’
persisted_call_sequence ๐Ÿ”’
Helper function to load failed call sequence from file. Ignores failure if generated with different invariant settings than the current ones.
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.
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).