Skip to main content

Module shrink

Module shrink 

Source

StructsΒ§

CheckSequenceOptions
Options controlling how check_sequence evaluates a candidate call sequence.
CheckSequenceOutcome
Outcome from replaying an invariant call sequence through check_sequence.
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.
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.
ShrinkProgress πŸ”’
Live shrink progress display. The progress bar itself is owned by forge’s test runner; this type only formats the transient message shown while invariant shrinking is active.
ShrinkRun
Shared shrink attempt driver.
ShrinkRunStats
Attempt counters collected while trying shrink candidates.
ShrunkSequence

EnumsΒ§

CheckSequenceFailureSite
Concrete failure site observed while replaying a sequence through check_sequence.
ReplayDecision πŸ”’
Per-call decision returned by callbacks driving replay_sequence. Continue hands the result back so non-reverted calls auto-commit; Stop short-circuits.
ShrinkErrorPolicy πŸ”’
How run_shrink_loop handles a predicate error.
TerminalFailureSite πŸ”’

ConstantsΒ§

LIVE_SHRINK_SEQUENCE_EDGE_CALLS πŸ”’

FunctionsΒ§

apply_warp_roll πŸ”’
Applies accumulated warp/roll to a call, returning a modified copy.
apply_warp_roll_to_env πŸ”’
Applies warp/roll adjustments directly to the executor’s environment.
assertion_failure_reason πŸ”’
build_shrunk_sequence πŸ”’
Builds the final shrunk sequence from the shrinker state.
call_failure_reason πŸ”’
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.
finish_sequence_check πŸ”’
format_shrink_progress_message πŸ”’
handler_sequence_still_triggers_bug πŸ”’
Shrink predicate: anchor asserts on the same path as the originally recorded bug.
push_shrink_progress_call πŸ”’
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_sequence πŸ”’
Replays sequence (indices into calls) against executor. When accumulate_warp_roll is set, warp/roll from skipped calls is folded into the next included call. on_call may stop early; otherwise non-reverted calls are committed.
reset_shrink_progress πŸ”’
Resets the progress bar before each shrink. position = Some((i, N)) renders [i/N] Shrink: <label> for multi-invariant campaigns.
run_shrink_loop πŸ”’
Shared shrink loop driver. Tries to drop each call; predicate returns whether the candidate still triggers the bug.
selector_from_calldata πŸ”’
sequence_call_failure_site πŸ”’
shrink_handler_sequence πŸ”’
Shrinks a handler-bug sequence to the shortest prefix that still asserts on the anchor AND keeps the same edge fingerprint (so we don’t change bug identity).
shrink_sequence πŸ”’
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.
shrink_sequence_value πŸ”’
Shrinks a call sequence to the shortest sequence that still produces the target optimization value. This is specifically for optimization mode where we want to find the minimal sequence that achieves the maximum value.
terminal_failure_site πŸ”’