-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invariant tests for UbiquityPoolFacet #953
Invariant tests for UbiquityPoolFacet #953
Conversation
…ition and price feed setup
I understand that this is a draft pull request, so you should mark it as a draft pull request instead of emphasizing in your pull request body. |
…ng limits with fuzzing
…r price manipulation tests
…on and update invariant
…d mintUbiquityDollars
Hey everyone, I believe we're could start with this invariant test. The primary goal was to implement a condition that consistently ensures the dollar amount remains fully collateralized. This condition addresses two key scenarios:
If either of these scenarios were to succeed, it would break the collateralization of the Dollar, thereby violating the invariant During the test, it performs various manipulations with the values of collateral, USD, ETH/USDT, and Dollar prices, as well as minting and redemption fees, among other parameters As the next step, additional invariants might be about the governance token and its associated logic Looking forward to your feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexandr-masl Overall this is a great job.
- Pls fix minor issues in the comments
- Here you mention the
Users cannot redeem more collateral (in USD value) than the corresponding Dollar tokens
invariant test. Is it going to be implemented? - This issue also implies setting up CI. You may take fuzzing CI as an example.
packages/contracts/test/invariant/diamond/facets/PoolFacetHandler.sol
Outdated
Show resolved
Hide resolved
packages/contracts/test/invariant/diamond/facets/PoolFacetHandler.sol
Outdated
Show resolved
Hide resolved
packages/contracts/test/invariant/diamond/facets/PoolFacetHandler.sol
Outdated
Show resolved
Hide resolved
packages/contracts/test/invariant/diamond/facets/PoolFacetHandler.sol
Outdated
Show resolved
Hide resolved
Thanks for the feedback and kind words, will come up with an update soon |
I did a review of the invariant tests skeleton, looks like a good start. Looking forward to see it in the ready for review stage. |
Thanks for the feedback. I'm actively working on it |
Please review my basic invariant tests. I have minimized the use of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls add this config to foundry.toml:
[profile.intense.invariant]
runs = 50000 # ~1 hour
packages/contracts/test/invariant/diamond/facets/PoolFacetHandler.sol
Outdated
Show resolved
Hide resolved
packages/contracts/test/invariant/diamond/facets/PoolFacetHandler.sol
Outdated
Show resolved
Hide resolved
packages/contracts/test/invariant/diamond/facets/UbiquityPoolFacet.invariant.t.sol
Outdated
Show resolved
Hide resolved
I'm not highly experienced with the Ran 2 tests for test/invariant/diamond/facets/UbiquityPoolFacet.invariant.t.sol:UbiquityPoolFacetInvariantTest
[PASS] invariant_CannotMintMoreDollarsThanCollateral() (runs: 3280, calls: 1640000, reverts: 133999)
[PASS] invariant_CannotRedeemMoreCollateralThanDollarValue() (runs: 4743, calls: 2371500, reverts: 193564)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 809.21s (1384.47s CPU time) |
That's strange, we'll see how it goes in the CI environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this is a good start. There're still too many reverts but it's something that we should work out in the next invariant tests iteration.
Resolves #563