The utilization rate calculation in the updateInterestRatesAndLiquidity function of ReserveLibrary.sol contract was incorrect due to not accounting for accumulated interest in debt and liquidity, leading to inaccurate updates of borrow and liquidity rates and risk assessments.
The issue arises in the current calculation of the utilization rate, where the system only considers the raw debt and liquidity values without factoring in accumulated interest.
Current Calculation:
The actual debt and liquidity should include accumulated interest, which the current method ignores as shown below:
Current Calculation Example:
actualDebt = rawDebt + accumulatedInterest
actualLiquidity = rawLiquidity + accumulatedDepositInterest
Original liquidity = 1000 USDC
Original debt = 500 USDC
Accumulated debt interest = 50 USDC
Accumulated liquidity interest = 30 USDC
Current Utilization Rate Calculation: utilizationRate = 500 / (1000 + 500) = 33.33%
Correct Calculation: utilizationRate = 550 / (1030 + 550) = 34.81%
Underestimated Utilization Rate:
The system calculates a lower or higher utilization rate than the actual value, leading to an inaccurate assessment of the system’s liquidity utilization.
Incorrect Interest Rate Updates:
Since the utilization rate is used to update borrow and liquidity interest rates, incorrect utilization rates may result in wrong interest rate adjustments, affecting both borrowers and lenders.
Underestimated Risk:
The failure to include accumulated interest in the utilization rate means that the system is underestimating or overestimating the actual debt to liquidity ratio. This can lead to an incorrect risk assessment and potential solvency issues, as the system may not take into account the full exposure.
Potential Financial Losses:
Incorrect interest rate calculations and underestimation of risk can lead to imbalanced liquidity pools, higher chances of liquidations, and financial instability within the system.
Manual code review
It is recommended to fix the utilization rate calculation and modify the updateInterestRatesAndLiquidity function to use the computed debt and liquidity values, which include accumulated interest, in the utilization rate calculation.
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.