-
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
Sherlock-104: PoolCommons._calculateInterestRate
make decrease rate condition inline with increase condition
#903
Conversation
PoolCommons._calculateInterestRate
make decrease rate condition inline with increase condition
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.
I agree that the proposed change matches how we are performing an increase. Am curious to know the reason behind this change or the why.
Is it because this code was not inline with the spec?
this was changed in order to allow greater values / avoid overflow for the if clause with 23e7485#diff-f180a783f7f398e0540bb5a9fee461cbec2f970bdd423c904b5e12c6ec69c325R286 but not for the else clause |
PoolCommons._calculateInterestRate
make decrease rate condition inline with increase conditionPoolCommons._calculateInterestRate
make decrease rate condition inline with increase condition
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
The links that summarize the issue may die... please copy and paste the issue into the description directly
updated |
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.
Reviewed the original change to line 294, scaling before squaring, to prevent overflow. This appears consistent with that change, as stated.
Description of change
High level
PoolCommons._calculateInterestRate
the condition formula for decreasing interest rate is implemented differently than condition for increasing rate. Condition for increasing rate was changed with 23e7485#diff-f180a783f7f398e0540bb5a9fee461cbec2f970bdd423c904b5e12c6ec69c325R286 to fix an overflow while condition for decreasing wasn't, hence same error can manifestPoolCommons._calculateInterestRate
at par with increase rate condition, that is fromchange to
Contract size
Pre Change
Post Change
Gas usage
Pre Change
Post Change