The initiateLiquidation
function incorrectly checks the user's health factor against the liquidation threshold. The current implementation reverts if the health factor is greater than or equal to the threshold, whereas it should revert only if the health factor is above the threshold, ensuring liquidation occurs only when necessary.
In the initiateLiquidation
function, the following line contains a logic error:
The intention behind this condition is to prevent liquidation if the user’s health factor is above the liquidation threshold, meaning their position is safe. However, the revert message HealthFactorTooLow
suggests the opposite, implying that the user's health factor is too low for liquidation to proceed.
Logically, liquidation should only occur when the health factor is below the threshold. The correct condition should be:
With the current flawed implementation, liquidation may be incorrectly prevented, and healthy accounts might be liquidated while unhealthy ones remain unliquidated.
Prevents liquidation of accounts that should be liquidated, leading to risk accumulation in the protocol.
Allows liquidation of accounts that should not be liquidated, causing unnecessary losses to users.
Can lead to unintended protocol insolvency due to unliquidated bad debt.
Manual Review
Modify the conditional check to properly reflect the intended liquidation logic:
Additionally, consider adding unit tests to validate liquidation logic and ensure that users are only liquidated when their health factor is below the threshold.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.