Skip to content

Conversation

@grandizzy
Copy link
Collaborator

@grandizzy grandizzy commented Nov 17, 2025

Motivation

  • closes feat(forge test): add an option to continue fuzzing run on assertion failure #9727
  • assert all invariants defined in test contract and generate counterexamples if continuous_run set
  • invariants that already have persisted failure are not picked up / asserted
  • for other invariants asserted the counterexample is saved in original and can be shrinked on subsequent test run
  • upon ctrl+c or when runs complete all failures are presented (even if the main tested invariant is not broken)
Screencast.from.11-18-2025.10.07.36.AM.webm

@forkforkdog @rappie @GalloDaSballo appreciate some feedback and if that's what you were looking for, thank you
CC @0xalpharush

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@grandizzy grandizzy changed the title [WIP] feat(invariant): assert all invariants feat(invariant): assert all invariants Nov 18, 2025
@grandizzy grandizzy marked this pull request as ready for review November 18, 2025 08:12
@grandizzy grandizzy added this to the v1.6.0 milestone Nov 18, 2025
@grandizzy grandizzy changed the title feat(invariant): assert all invariants feat(invariant): assert all invariants on continuous_run Nov 18, 2025
@grandizzy grandizzy moved this to Ready For Review in Foundry Nov 24, 2025
pub timeout: Option<u32>,
/// Display counterexample as solidity calls.
pub show_solidity: bool,
/// Continue invariant run until all invariants declared in current test suite breaks.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Continue invariant run until all invariants declared in current test suite breaks.
/// Continue invariant run until all invariants declared in the test suite break.

@0xalpharush
Copy link
Contributor

invariants that already have persisted failure are not picked up / asserted

Not to say this can't be done, but this isn't how Medusa/Echidna do it. The "pro" that comes to mind is you may find a smaller reproducer or a reproducer that reveals the patch was incomplete i.e. only fixed one repro but not the other.

It is possible to do deduplication with the edge map to avoid saving too many if you went this route.

@grandizzy
Copy link
Collaborator Author

invariants that already have persisted failure are not picked up / asserted

Not to say this can't be done, but this isn't how Medusa/Echidna do it. The "pro" that comes to mind is you may find a smaller reproducer or a reproducer that reveals the patch was incomplete i.e. only fixed one repro but not the other.

It is possible to do deduplication with the edge map to avoid saving too many if you went this route.

I see, makes sense, can accommodate such

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready For Review

Development

Successfully merging this pull request may close these issues.

feat(forge test): add an option to continue fuzzing run on assertion failure

4 participants