The ReserveLibrary::getNormalizedDebt
function incorrectly returns reserve.totalUsage
instead of reserve.usageIndex
when timeDelta < 1
. This leads to inaccurate calculations for normalized debt, potentially affecting borrowing and repayment logic.
Problem description
The function getNormalizedDebt
is designed to calculate the normalized debt based on the reserve’s state.
When timeDelta < 1
, the function returns reserve.totalUsage
, which is incorrect.
The correct return value should be reserve.usageIndex
, as usageIndex
represents the normalized debt scaling factor.
This issue can lead to incorrect debt calculations and affect lending protocol operations.
Affected Code in getNormalizedDebt
Steps to reproduce
Call getNormalizedDebt
when timeDelta < 1
.
Observe that the function returns reserve.totalUsage
instead of reserve.usageIndex
.
Confirm that reserve.usageIndex
is the correct scaling factor for normalized debt.
Inaccurate debt calculations: Borrowers and lenders are affected due to incorrect debt tracking.
Manual Review
Change the return value when timeDelta < 1
to reserve.usageIndex
.
Verify that the usageIndex
is correctly updated in other parts of the contract.
Test the function to ensure proper calculations of normalized debt.
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.