Core Contracts

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

Incorrect Boost Multiplier Calculation in `BoostController` Contract

Summary

The getBoostMultiplier function in the BoostController contract is intended to return the current boost multiplier for a user in a specific pool. However, due to an incorrect calculation, the function always returns MAX_BOOST, leading to inaccurate boost multipliers.

Vulnerability Details

Affected Function:

function getBoostMultiplier(
address user,
address pool
) external view override returns (uint256) {
if (!supportedPools[pool]) revert PoolNotSupported();
UserBoost storage userBoost = userBoosts[user][pool];
if (userBoost.amount == 0) return MIN_BOOST;
// Incorrect calculation
uint256 baseAmount = userBoost.amount * 10000 / MAX_BOOST;
return userBoost.amount * 10000 / baseAmount;
}

Root Cause:

  1. The variable baseAmount is calculated as:

    uint256 baseAmount = userBoost.amount * 10000 / MAX_BOOST;

    This intends to normalize the boost amount, but in most cases, baseAmount is a fraction of MAX_BOOST, leading to an incorrect divisor in the next calculation.

  2. The final return statement performs the following calculation:

    return userBoost.amount * 10000 / baseAmount;
    • Since baseAmount is already a fraction of MAX_BOOST, this operation effectively cancels out the normalization and always results in MAX_BOOST (25000 basis points), regardless of the actual boost amount.

Calculation Breakdown:

Let's assume a scenario where userBoost.amount = 10000:

uint256 baseAmount = (10000 * 10000) / 25000; // baseAmount = 4000
return (10000 * 10000) / 4000; // Returns 25000 (MAX_BOOST)

Why Does it Always Return MAX_BOOST (25000)?

  • The baseAmount formula effectively cancels out userBoost.amount, leaving just MAX_BOOST (25000).

  • Regardless of userBoost.amount, the function always results in 25000.

Impact

  • Users always receive MAX_BOOST as the multiplier, even if their actual boost amount is lower.

  • This miscalculation leads to incorrect rewards distribution in protocols that depend on the boost multiplier.

Tools Used

  • Manual code review

Recommendations

  1. Correct the boost multiplier calculation to ensure it accurately reflects the user’s boost amount. The intended calculation might be:

    return MIN_BOOST + (userBoost.amount * (MAX_BOOST - MIN_BOOST) / MAX_BOOST);
Updates

Lead Judging Commences

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

BoostController::getBoostMultiplier always returns MAX_BOOST for any non-zero boost due to mathematical calculation error, defeating the incentive mechanism

Support

FAQs

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

Give us feedback!