getNormalizedDebt
function in ReserveLibrary library is defined as follows:
This function is supposed to return the normalised index for usage (debt). If current block timestamp is greater than the last update timestamp, getNormalizedDebt
returns reserve.usageIndex
multiplied by the compounded interests since last reserve update.
The problem arises in the case where current block timestamp is the same as the last reserve update. Indeed, in this case, reserve.totalUsage
is returned instead of reserve.usageIndex
, which will lead to undesired behaviour in the protocol.
In comparison, getNormalizedIncome
in ReserveLibrary is defined as follows:
We can see that it is correct, with reserve.liquidityIndex
being returned, corresponding to the current liquidity index.
The impact of this issue is high. Indeed, in a context where the deposit
function is correctly implemented apart from this error, getNormalizedDebt
will return a wrong value (raw total borrowed amount) instead of a RAY usage index, breaking interest rate computation.
Manual review
Make sure to correctly implement getNormalizedDebt
in ReserveLibrary:
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.