The liquidateBorrower function incorrectly scales the user's debt a second time, causing an inaccurate balance check. This results in unnecessary reverts, preventing liquidations from occurring as intended.
The issue occurs due to double scaling of userDebt:
The function getUserDebt already returns the debt in underlying asset units, meaning no further scaling is required.
The additional scaling (rayMul(userDebt, lendingPool.getNormalizedDebt())) inflates the value, leading to an incorrect balance check:
Since scaledUserDebt is artificially higher than it should be, the function always reverts, blocking valid liquidations.
This issue completely prevents borrower liquidations, leading to:
Accumulation of bad debt, as liquidations are blocked.
Risk to protocol solvency, since positions that should be liquidated remain open.
Stability Pool funds not being utilized**, affecting ecosystem health.
Manual Review
Fix the incorrect scaling
Remove the unnecessary rayMul operation:
And update the balance check:
And update the approval amount:
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.