-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fixes after internal audit #118
Fixes after internal audit #118
Conversation
Changes to gas cost
🧾 Summary (20% most significant diffs)
Full diff report 👇
|
LCOV of commit
|
return | ||
earmarked_ == 0 ? int248(uint248(balance_)) : int248(uint248(balance_)) - int248(uint248(earmarked_)); | ||
// Decreases claimable excess by the `roundingError` for extra level of safety and solvency. | ||
return int240(balance_) - int240(earmarked_) - roundingError; |
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.
It should be + roundingError
since it can be a positive or negative number.
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.
yes, it is intentionally int vs uint.
Though it is positive if protocol occurred 'loss', so it needs to be subtracted from excess,
and error is negative when protocol has a surplus, so -(-) cancels out into + and abs of rounding error will be added to excess
roundingError
safety feature