Skip to main content

Module shrink

Module shrink 

Source

StructsΒ§

CallSequenceShrinker πŸ”’
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.
CheckSequenceOptions
Options controlling how check_sequence evaluates a candidate call 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.

EnumsΒ§

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.

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 πŸ”’
handler_sequence_still_triggers_bug πŸ”’
Shrink predicate: anchor asserts on the same path as the originally recorded bug.
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.
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_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.