Skip to main content

Module invariant

Module invariant 

Source

Modules§

IInvariantTest
Module containing a contract’s types and functions.

Structs§

CheckSequenceOptions
Options controlling how check_sequence evaluates a candidate call sequence.
CheckSequenceOutcome
Outcome from replaying an invariant call sequence through check_sequence.
HandlerAssertionFailure
A handler-side assertion bug: a require/assert inside a fuzzed handler that the campaign reached. Deduped by (reverter, selector) site (Echidna/Medusa semantics), shortest sequence wins on collision.
HandlerReplayOutcome
Result of a strict handler-bug replay: anchor asserts, no earlier call asserts, and the recomputed edge fingerprint identifies which path the assertion took.
InvariantExecutor
Wrapper around any Executor implementer which provides fuzzing support using [proptest].
InvariantFailures
Stores invariant test failures and revert counts.
InvariantFuzzTestResult
The outcome of an invariant fuzz test
InvariantMetrics
Contains invariant metrics for a single fuzzed selector.
SequenceShrink
Shrinker for a call sequence failure. Iterates sequence call sequence top down and removes calls one by one. If the failure is still reproducible with removed call then moves to the next one. If the failure is not reproducible then restore removed call and moves to next one.
ShrinkCandidateKeys
Shared key set for shrinkers that need to skip duplicate concrete replays.
ShrinkRun
Shared shrink attempt driver.
ShrinkRunStats
Attempt counters collected while trying shrink candidates.

Enums§

CheckSequenceFailureSite
Concrete failure site observed while replaying a sequence through check_sequence.
FailureKey
Identifies a single entry in the InvariantFailures map. Invariant predicate failures and handler-side assertion bugs share one map keyed by this enum.
InvariantFuzzError

Functions§

check_sequence
Checks if the given call sequence breaks the invariant.
check_sequence_value
Executes a call sequence and returns the optimization value (int256) from the invariant function. Used during shrinking for optimization mode.
execute_tx
Executes an invariant replay fuzz call and returns the result.
execute_tx_and_register_created
Executes an invariant replay call on a validation executor and registers created targets.
handler_site_already_minimal
True iff there is already a HandlerAssertionFailure for site no longer than candidate_len. Used to skip inserting a not-strictly-shorter repro.
replay_error
Replays and shrinks a call sequence, collecting logs and traces.
replay_handler_failure_sequence
Replays a handler-bug sequence and returns whether the anchor still asserts on the same path. Rejects sequences with a pre-anchor assertion (would be a different bug).
replay_run
Replays a call sequence for collecting logs and traces. Returns counterexample to be used when the call sequence is a failed scenario.
shrink_sequence_by_removing
Shared sequence shrinker. Tries to drop each call; predicate decides whether the candidate should be accepted, rejected, or skipped without spending a replay attempt.