In the LendingPool
contract, the totalUsage
variable tracks the total debt in the system, scaled by the debt index. However, if there are no new borrows or repayments, the totalUsage
value becomes stale because it is not updated to reflect the growing debt index over time. This leads to incorrect calculations of the utilization rate, which in turn affects the computation of interest rates and indices.
The totalUsage
variable represents the total debt in the system, scaled by the debt index (debtIndex
). It is updated during borrow and repayment operations. However, the debt index grows over time due to accrued interest, and if no borrows or repayments occur, the totalUsage
value becomes outdated. This results in incorrect calculations of the utilization rate, which is used to determine borrowing and liquidity rates.
The updateInterestRatesAndLiquidity
function in the ReserveLibrary
is responsible for updating interest rates and liquidity. It calculates the utilization rate based on totalLiquidity
and totalUsage
. However, totalUsage
is not updated to reflect the latest debt index unless a borrow or repayment occurs. This leads to stale values being used in the utilization rate calculation.
Incorrect Utilization Rate: The utilization rate is calculated based on stale totalUsage
values, leading to inaccurate borrowing and liquidity rates.
Wrong Index Computation: The debt index (debtIndex
) and liquidity index (liquidityIndex
) are computed incorrectly, affecting the overall system's state.
Manual Review
To address this issue, update the totalUsage
value every time a new rate or index is computed, ensuring it reflects the latest debt index.
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.