-
Notifications
You must be signed in to change notification settings - Fork 11
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_reserves
failure when take
/ bucketTake
#1050
Conversation
invariant_reserves
failure when take
/ bucketTake
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.
Could be missing something but is this accurate? -> https://github.com/ajna-finance/contracts/blob/6da58b4cdd2f75decac124502da0c55f6c70e9d2/tests/INVARIANTS.md?plain=1#L67
I think the reservesErrorMargin
value has a maximum of 1e13 value not 1e15
. Suggest invariants.md is updated to match the code accordingly.
tests/forge/invariants/base/handlers/unbounded/UnboundedLiquidationPoolHandler.sol
Show resolved
Hide resolved
tests/forge/invariants/base/handlers/unbounded/UnboundedLiquidationPoolHandler.sol
Show resolved
Hide resolved
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.
Fine with this. Note I was not able to reproduce the failure at 600 depth. Also, merge conflict needs resolution.
Fixed. -> dcae802 |
Changed |
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.
LGTM
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.
LGTM
Description
reserves invariant failure
Add logic in invariant test harness to allow reserves to increase up to ~1e-18th of the current inflator.
Purpose
Because debt is stores in t0 terms and reserves include current debt, due to roundoff error the reserves will fluctuate up to
1 WAD
times the current inflator value. This change allows for this expected error in reserves changes, enabling deeper invariant test runs. In particular, it fixes regression sequencestest_regression_failure_reserves_bucketTake_18precision
andtest_regression_failure_reserves_regularTake_18precision
.Impact
Core contracts are untouched by this change, so no impact on size or gas.
Tasks