* The protocol allows liquidators to partially liquidate unhealthy positions by repaying a portion of the user's debt in exchange for collateral plus a bonus. The liquidation function checks that the user's health factor improves after liquidation.
* When a liquidator partially liquidates a position, the remaining debt may become too small to be profitably liquidated due to gas costs. This leaves the user with an unhealthy position that cannot be liquidated, creating bad debt that accumulates in the protocol.
```vyper
@external
def liquidate(collateral: address, user: address, debt_to_cover: uint256):
assert debt_to_cover > 0, "DSCEngine__NeedsMoreThanZero"
starting_user_health_factor: uint256 = self._health_factor(user)
assert (
starting_user_health_factor < MIN_HEALTH_FACTOR
), "DSCEngine__HealthFactorOk"
token_amount_from_debt_covered: uint256 = self._get_token_amount_from_usd(
collateral, debt_to_cover
)
bonus_collateral: uint256 = (
token_amount_from_debt_covered * LIQUIDATION_BONUS
) // LIQUIDATION_PRECISION
self._redeem_collateral(
collateral,
token_amount_from_debt_covered + bonus_collateral,
user,
msg.sender,
)
self._burn_dsc(debt_to_cover, user, msg.sender) // @> Partial liquidation allowed
ending_user_health_factor: uint256 = self._health_factor(user)
assert (
ending_user_health_factor > starting_user_health_factor
), "DSCEngine__HealthFactorNotImproved"
self._revert_if_health_factor_is_broken(msg.sender)
```
Likelihood:
* Liquidators will prefer to liquidate only profitable portions of debt, leaving small remaining debts
* Gas costs make it unprofitable to liquidate very small debt amounts (e.g., < $10 worth of debt)
* Market conditions can cause positions to become unhealthy with small debt amounts remaining after partial liquidations
Impact:
* Users become stuck with unhealthy positions that cannot be liquidated
* Bad debt accumulates in the protocol, reducing overall solvency
* Protocol becomes insolvent if enough positions become unliquidatable
* No mechanism exists to recover from these dust positions
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.