The _repay function incorrectly applies scaling twice to the repayment amount, resulting in underpayment of debt. This leaves residual debt even when users attempt full repayment, violating core protocol invariants and leading to unexpected liquidations or collateral lockups.
The _repay function calculates scaledAmount by applying rayDiv to actualRepayAmount, which is already a scaled if the actualRepayAmount = userScaledDebt we must not scaled this value again because it's already scaled. This double scaling reduces the effective repayment amount, preventing full debt clearance.
The value of scaledAmount is wrong because of double scaling
Manual Review
Remove redundant scaling by directly using actualRepayAmount:
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.