incorrect implementation of LendingPool::getUserDebt() may lead to lesser debt amount than than are supposed to be.
User debt is recorded in state variable UserData[userAddress].scaledDebtBalance, where this amount is the debtToken minted, not the real debt value. The real debt value is calculated from multiplying reserve debt index. However the code implemented in LendingPool::getUserDebt() does this by multiplying last time updated usageIndex, while it should be the in time index:
instead it should be :
while in most occasions, there will be a reserve index updating before any token actions(deposti/withdraw/repay), which will result in no differences of NormalizedDebt() and reserve.usageIndex.
Hovever In StabilityPool::liquidateBorrower(), userDebt is straightly calculated from lendingPool.getUserDebt(), which will results in less debt that users accumulated.
users get less debt than real time accumulated
manual
consider change getUserDebt() to :
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.