The getBoostMultiplier function in the BoostController contract contains a logical error in calculating the boost multiplier. The function will always return MAX_BOOST (25000) if userBoost.amount > 0, which is incorrect.
The getBoostMultiplier function is designed to calculate a boost multiplier for a user in a specific pool. However, the calculation logic is flawed:
Flawed Calculation:
The function calculates baseAmount as userBoost.amount * 10000 / MAX_BOOST.
It then returns userBoost.amount * 10000 / baseAmount, which simplifies to MAX_BOOST because baseAmount is proportional to userBoost.amount.
Always Returns MAX_BOOST:
If userBoost.amount > 0, the function will always return MAX_BOOST (25000), regardless of the actual boost amount.
The issue lies in the following lines of the getBoostMultiplier function:
The calculation userBoost.amount * 10000 / baseAmount simplifies to MAX_BOOST because baseAmount is derived from userBoost.amount.
User with Boost: A user has a boost amount of 1000.
Flawed Calculation:
baseAmount = 1000 * 10000 / 25000 = 400.
The function returns 1000 * 10000 / 400 = 25000 (MAX_BOOST).
Incorrect Result: The function always returns MAX_BOOST if userBoost.amount > 0.
Incorrect Boost Multipliers: The function always returns MAX_BOOST if userBoost.amount > 0, leading to incorrect boost calculations.
Operational Inefficiency: The protocol's boost mechanism becomes unreliable, as it cannot provide meaningful boost multipliers based on the user's boost amount. Therefore, other contracts depending on reading states from this function will be given false results.
Manual Code Review
Fix the Boost Multiplier Calculation:
Implement a correct calculation for the boost multiplier. For example, the boost multiplier could be proportional to the user's boost amount relative to MAX_BOOST.
This formula ensures that:
If userBoost.amount = 0, the multiplier is MIN_BOOST.
If userBoost.amount = MAX_BOOST, the multiplier is MAX_BOOST.
For values in between, the multiplier scales linearly.
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.