Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Valid

Incorrect Utilization Rate Due to Stale Lending Pool State

Relevant Context

The RAACMinter contract implements a dynamic emission rate mechanism that adjusts based on the system's utilization rate. The utilization rate is calculated using data from the LendingPool contract, which maintains indices that scale the borrowed and deposited amounts.

Finding Description

The updateEmissionRate() function in RAACMinter calculates a new emission rate based on the current utilization rate without first updating the LendingPool state. The LendingPool contract maintains liquidity and usage indices that scale the total borrowed and deposited amounts, and these indices need to be updated before reading the current state to ensure accurate calculations.

The root cause is in the updateEmissionRate() function, which directly calls calculateNewEmissionRate() without first calling lendingPool.updateState(). This leads to the getUtilizationRate() function using potentially stale indices when calculating the system's utilization.

Impact Explanation

High. The incorrect utilization rate directly affects the emission rate of RAAC tokens, which is a core economic parameter of the protocol. An inaccurate utilization rate could result in:

  1. Over-emission of tokens when the actual utilization is lower than reported

  2. Under-emission of tokens when the actual utilization is higher than reported
    Both scenarios could destabilize the protocol's economic incentives.

Likelihood Explanation

High. This issue will occur every time the emission rate is updated unless the LendingPool state happens to have been updated in the same block by another operation.

Proof of Concept

  1. User deposits into the lending pool, increasing the liquidity index

  2. Time passes, during which interest accrues

  3. updateEmissionRate() is called

  4. getUtilizationRate() uses stale indices to calculate utilization

  5. Emission rate is adjusted based on incorrect utilization data

  6. Protocol emits incorrect amount of tokens until next update

Recommendation

Update the updateEmissionRate() function to refresh the lending pool state before calculating the new emission rate:

// ... existing code ...
function updateEmissionRate() public whenNotPaused {
if (emissionUpdateInterval > 0 && block.timestamp < lastEmissionUpdateTimestamp + emissionUpdateInterval) {
revert EmissionUpdateTooFrequent();
}
lendingPool.updateState(); // Add this line
uint256 newRate = calculateNewEmissionRate();
emissionRate = newRate;
lastEmissionUpdateTimestamp = block.timestamp;
emit EmissionRateUpdated(newRate);
}
// ... existing code ...
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

LendingPool::getNormalizedIncome() and getNormalizedDebt() returns stale data without updating state first, causing RToken calculations to use outdated values

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!