-
Notifications
You must be signed in to change notification settings - Fork 46
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
L-09 Rounding Error Might Prevent Borrowing at the Maximum Limit #489
Conversation
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 think I prefer just changing the inequality is _isHealthy
into a strict inequality. Comments about 1 WEI of asset feel a bit too much in my opinion
I don't see how it solves the issue: it just shifts the issue by 1. See my reasoning considering a strict inequality: When borrowing max ( |
I've created a draft PR #490. Tbh I think it's more difficult to reason about especially in the tests you must tweaks some things to have the behavior you expect which I'm not confortable with... |
You are right, it doesn't change much. The intent is to signal that the user shouldn't expect to have precision down to the WEI. I still feel like it's not worth adding a big comment just for that: it is putting the focus on a small issue. For example a tiny change in price can change the behavior. If we were to add a comment, just making clear that precision is not down to the WEI should be enough (and it's more general and applies to other computations) |
I'm fine with that too |
Would the following works for you @QGarchery ? |
Perfect |
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.
This fix feels a little bit weird to me. We round in favor of the market every time right ? When you borrow and then repay you might need to repay one more asset. When you supply and withdraw you might be able to withdraw one less asset. It's not so surprising to see the "same" thing happening in _isHealthy
. Anyway I'm not against the fix but I don't think that it was mandatory at all.
Co-authored-by: MathisGD <[email protected]> Signed-off-by: Merlin Egalite <[email protected]>
465cb7f
Fixes #480