The closeLiquidation function reverts if the current block.timestamp exceeds the liquidationStartTime[userAddress] + liquidationGracePeriod. This prevents users who have repaid their debt within the grace period from stopping the liquidation. As a result, the Stability Pool can call finalizeLiquidation, and the user's NFTs will be transferred to the Stability Pool even though the user has already repaid their debt. This is a serious flaw that unfairly penalizes users and undermines the fairness of the liquidation process.
Root Cause:
The closeLiquidation function checks if the current block.timestamp is within the grace period:
If the grace period has expired, the function reverts, and the user cannot stop the liquidation.
The finalizeLiquidation function does not check if the user has repaid their debt. It simply transfers the user's NFTs to the Stability Pool if the grace period has expired.
Impact:
Unfair Penalization: Users who repay their debt within the grace period but are unable to call closeLiquidation due to the timestamp check will lose their NFTs.
Loss of Trust: Users may lose trust in the protocol if they are unfairly penalized despite repaying their debt.
Unfair Penalization: Users who repay their debt within the grace period but are unable to call closeLiquidation due to the timestamp check will lose their NFTs.
Loss of Trust: Users may lose trust in the protocol if they are unfairly penalized despite repaying their debt.
System Instability: The unfair liquidation process could disrupt the governance process and lead to instability in the system.
A user's health factor falls below the liquidation threshold, and liquidation is initiated.
The user repays their debt within the grace period.
The user attempts to call closeLiquidation, but the function reverts because the grace period has expired.
The Stability Pool calls finalizeLiquidation, and the user's NFTs are transferred to the Stability Pool even though the user has already repaid their debt.
Manual Review
Add Debt Repayment Check in finalizeLiquidation:
Ensure that the finalizeLiquidation function checks if the user's debt has been fully repaid before transferring their NFTs to the Stability Pool.
Example:
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.