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

Bounds on liquidate bypassing sentinel and repay ETH no excess #897

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

QGarchery
Copy link
Contributor

@QGarchery QGarchery commented Nov 5, 2024

First fix: testFullLiquidateUnhealthyUserWhenSentinelDisallowsButHealthFactorVeryLow
When the health factor is very low, liquidations are allowed, even if disallowed by the sentinel. To test this behavior, it consists in creating a position with a health factor below a given bound B. This is done via the _createPosition utility function in tests, and pass it a given health factor that is below B.
The problem arise when passing a health factor close to B, because _createPosition creates a position that has over-estimated close factor. To compensate, the bound B must be lowered.
See this failing CI run

Second fix: testRepayETH
It is checked that the repayed amount, when going through the WETH gateway, is the same as the value of the transaction. This is only true when repaying less than what is borrowed, otherwise there can be an excess of ETH, which is handled in another test, testRepayETHWithExcess.
In some cases the borrowed amount is over-estimated, so to compensate the amount passed to the gateway should be less to not be in excess.
See this failing CI run

@QGarchery QGarchery self-assigned this Nov 5, 2024
@QGarchery QGarchery changed the title Larger bound for bypassing sentinel liquidation Bounds on liquidate bypassing sentinel and repay ETH no excess Nov 5, 2024
Copy link
Collaborator

@Rubilmax Rubilmax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@MathisGD MathisGD merged commit 3ec6f10 into main Nov 7, 2024
9 checks passed
@MathisGD MathisGD deleted the test/liquidate-low-bound branch November 7, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants