foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat(invariant): assert all invariants on `continuous_run`

Open grandizzy opened this issue 1 month ago • 2 comments

Motivation

  • closes #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 avatar Nov 17 '25 17:11 grandizzy

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.

0xalpharush avatar Nov 27 '25 01:11 0xalpharush

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

grandizzy avatar Nov 27 '25 05:11 grandizzy