-
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
Use unscaled remaining amount when remove deposit #714
Conversation
…scaled deposit then set scaled deposit remaining to 0
Since the code change in the PR makes this regression pass I suggest we remove the regression test. |
We should keep regression test too, no harm in having it |
PR needs comments |
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.
_removeMaxDeposit
is called from two places:
moveQuoteToken
, which caches it asvars.fromBucketRemainingDeposit
removeQuoteToken
, which was updated to rename the variable
Both methods perform a zero check for the purposes of inducing a bucket bankruptcy if bucket LPs != 0 yet there is no remaining deposit. This fix seems appropriate for both cases.
Note there is merely one call to moveQuoteToken
in the gas reports, but I am not concerned about gas usage for this change.
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.
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 of change
High level
Description of bug or vulnerability and solution
LenderActions._removeMaxDeposit
returnunscaledRemaining_ = unscaledDepositAvailable - unscaledRemovedAmount;
insteadscaledRemaining_ = scaledDepositAvailable - removedAmount_;
Contract size
Pre Change
Post Change
Gas usage
Pre Change
Post Change