Bounds on liquidate bypassing sentinel and repay ETH no excess #897
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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