Core Contracts

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

Underflow Risk in Liquidity Rate Calculation

Summary

The calculateLiquidityRate function calculates the net liquidity rate by subtracting a protocol fee from a gross liquidity rate. However, if the protocol fee rate is misconfigured or set too high, it can cause an underflow during subtraction, leading to a revert.

Vulnerability Details

function calculateLiquidityRate(uint256 utilizationRate, uint256 usageRate, uint256 protocolFeeRate, uint256 totalDebt) internal pure returns (uint256) {
if (totalDebt < 1) {
return 0;
}
uint256 grossLiquidityRate = utilizationRate.rayMul(usageRate);
uint256 protocolFeeAmount = grossLiquidityRate.rayMul(protocolFeeRate);
uint256 netLiquidityRate = grossLiquidityRate - protocolFeeAmount;
return netLiquidityRate;
}

If protocolFeeRate is set higher than 1 RAY(1e27) (i.e., above the expected maximum), then protocolFeeAmount may exceed grossLiquidityRate. This subtraction would underflow, causing the transaction to revert.

Impact

  • Transaction Reverts:
    Underflow during subtraction leads to reverts, which can disrupt interest rate calculations and overall protocol functionality.

  • Economic Disruption:
    Inaccurate liquidity rates may result in mispriced interest rates, potentially distorting the incentives for depositors and borrowers.

Tools Used

manual review

Recommendations

Enforce that protocolFeeRate is within the expected range (0 to 1 RAY) by adding appropriate checks (e.g., a require statement) before performing calculations.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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