Open
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
Luisfc68
approved these changes
Mar 18, 2026
Collaborator
Luisfc68
left a comment
There was a problem hiding this comment.
The PR is approved, my comments are more related to the definition of some invariants, but not to the code itself, I think the discussion about the invariants should be taken separately as its not so simple, but as PoC the code LGTM
There was a problem hiding this comment.
Pull request overview
Adds a suite of Foundry invariant tests (isolated + integrated) for the Flyover system, refactoring invariant interactions through dedicated handler contracts, and includes a small PegInContract refactor to remove an opcode import dependency.
Changes:
- Introduces invariant handler contracts for Discovery, CollateralManagement, PegIn, PegOut, and a cross-contract System handler.
- Adds/updates invariant test suites to use the handlers, including a new integrated
SystemInvariantTest. - Updates Foundry invariant configuration (
runs,depth,fail_on_revert) and removesOpCodesimport usage inPegInContract.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/invariant/handlers/HandlerBase.sol | Shared utilities/constants for invariant handlers (quote staging, bookkeeping helpers). |
| test/invariant/handlers/DiscoveryHandler.sol | Fuzzable actions for Discovery invariant testing (register/toggle/update). |
| test/invariant/handlers/CollateralHandler.sol | Fuzzable actions for CollateralManagement invariant testing (add/slash/resign/withdraw). |
| test/invariant/handlers/PegInHandler.sol | Fuzzable actions for PegIn invariant testing (deposit/withdraw + LP tracking). |
| test/invariant/handlers/PegOutHandler.sol | Fuzzable actions for PegOut invariant testing (deposit/refund/withdraw + active quote tracking). |
| test/invariant/handlers/SystemHandler.sol | Cross-contract fuzzable actions + system-level ghost accounting. |
| test/invariant/DiscoveryInvariant.t.sol | New Discovery invariants wired to DiscoveryHandler. |
| test/invariant/CollateralInvariant.t.sol | Refactors Collateral invariants to use CollateralHandler and adds conservation assertions. |
| test/invariant/PegInInvariant.t.sol | Refactors PegIn invariants to use PegInHandler and tightens accounting checks. |
| test/invariant/PegOutInvariant.t.sol | Refactors PegOut invariants to use PegOutHandler and expands accounting invariants. |
| test/invariant/SystemInvariant.t.sol | New integrated/system invariant suite covering cross-contract solvency + conservation. |
| src/PegInContract.sol | Replaces OpCodes constants usage with locally defined opcode bytes. |
| foundry.toml | Adds [invariant] configuration for invariant runs/depth/revert behavior. |
You can also share your feedback on Copilot code review. Take the survey.
…dditional helper functions
…d dust in accounting
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.
What
Adding invariant tests, including both isolated and integrated test suites.
The changes include
discoveryContractSystemInvarianttest suite for integrated invariant testingTask
https://rsklabs.atlassian.net/browse/FLY-2167