Skip to content
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

[R&D review] Wrong hypothetical balance state when entering a market #1476

Closed
QGarchery opened this issue Nov 30, 2022 · 3 comments · Fixed by #1502
Closed

[R&D review] Wrong hypothetical balance state when entering a market #1476

QGarchery opened this issue Nov 30, 2022 · 3 comments · Fixed by #1502
Assignees
Labels
🐛 bug Something isn't working

Comments

@QGarchery
Copy link
Collaborator

https://github.com/morpho-dao/morpho-v1/blob/b45de2424c6c1a89671af890fc2d6c7f4a8a7ee7/contracts/aave-v2/lens/UsersLens.sol#L218

This check affects whether or not the hypothetical withdrawborrow is taken into account. If the user is not part of the poolToken market, it means that hypothetical borrows are not taken into account at all, potentially giving the false impression that the user is able to borrow

@QGarchery QGarchery added the 🐛 bug Something isn't working label Nov 30, 2022
@MerlinEgalite
Copy link
Contributor

Clearly yes

@Rubilmax
Copy link
Collaborator

Rubilmax commented Dec 1, 2022

This just made me realize that Morpho-Compound's _isLiquidatable and MorphoAaveV2's _liquidityData are working as expected only because the entered markets of the user are updated before calling the function. Perhaps this should be added in the NatSpec

@Rubilmax
Copy link
Collaborator

Rubilmax commented Dec 1, 2022

I also realized that underflows are not happening when subtracting liquidity data due to an hypothetical withdraw because we the hypothetical withdraw amount passed in this function is at most the supply amount of the user on the market
Lots of edge cases were not covered here, this is not an easy one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants