fix(symbolic): explore stateful invariant paths#15591
Open
figtracer wants to merge 23 commits into
Open
Conversation
72d63c4 to
6fb335d
Compare
Import setup-time vm.setArbitraryStorage targets into symbolic invariant execution and carry model values for concrete storage slots into replay. This lets invariant counterexamples that depend on symbolic storage behind deployed setup dependencies replay against Forge's concrete executor.
6fb335d to
651c75c
Compare
mablr
reviewed
Jul 6, 2026
mablr
reviewed
Jul 6, 2026
mablr
reviewed
Jul 7, 2026
mablr
reviewed
Jul 7, 2026
mablr
reviewed
Jul 7, 2026
mablr
reviewed
Jul 7, 2026
This was referenced Jul 8, 2026
mablr
reviewed
Jul 8, 2026
mablr
left a comment
Member
There was a problem hiding this comment.
Looks good overall.
I left 3 non-blocking suggestions, but can be handled later in follow-up as the PR is already big.
mablr
reviewed
Jul 8, 2026
# Conflicts: # crates/forge/src/cmd/fuzz.rs
mablr
reviewed
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This improves symbolic invariant execution for stateful Morpho-style paths. It lets bounded symbolic invariant exploration continue through multi-call sequences, replays setup-time arbitrary-storage values for explicit symbolic-storage targets, and completes hard-arithmetic fallback models with the supporting storage values needed by checked ERC20-style arithmetic guards.
supply -> supplyCollateral -> borrowsequence. OnGalloDaSballo/morpho-foundry-fv@example-concrete-fallback, the clean harness pins the market/token/oracle addresses, but it does not provide a concrete target path that funds/approves tokens or sets an oracle price. Normal invariant fuzzing confirms that boundary:invariant_hasBorrowedpassed after 256 runs with all 128000 target calls reverting.forge test --symbolicon the same repro reaches the relevant shape but stops incomplete after 26 paths withhard arithmetic heuristic witness used; no replayed counterexample found.loanToken,collateralToken, andoracleas arbitrary storage, this PR finds and replays the 3-callsupply -> supplyCollateral -> borrowcounterexample (paths: 177,models: 1,hard-arith: 84in a fresh run).Current workaround: explicit dependency storage boundary:
vm.setArbitraryStorage(address)when a symbolic invariant depends on setup-deployed dependency contracts whose storage must be satisfiable, but no target call in the invariant campaign writes that storage. In the Morpho repro, that means the ERC20 token mocks and oracle mock:What this intentionally does not do:
--symbolic-storage-layout genericproduces a 2-path counterexample that does not replay because it also makes harness/protocol state arbitrary. That is too broad for this class of invariant test.Status quo
svm.enableSymbolicStorage/ Foundryvm.setArbitraryStorage), so it is not a better no-annotation UX for this case.MorphoHarness,requireassumptions,extSloads => NONDET,_.price() => CONSTANT, and envfree getters instead of asking the prover to infer arbitrary dependency storage.