The getBoostMultiplier
function in the BoostController
contract contains a logical error that causes it to always return the MAX_BOOST
value, regardless of the actual userBoost.amount
. This issue arises due to incorrect mathematical operations in the calculation of the boost multiplier. As a result, the function fails to dynamically compute the boost multiplier based on the user's boost amount, rendering it ineffective for its intended purpose.
The vulnerability lies in the following code segment within the getBoostMultiplier
function:
Here, baseAmount
is calculated as the ratio of userBoost.amount
to MAX_BOOST
, scaled by 10000
. So the expression return userBoost.amount * 10000 / baseAmount;
simplifies to:
The userBoost.amount * 10000
terms cancel out, leaving the result as MAX_BOOST
.
add the following test case to BoostController.test.js
run npx hardhat test --grep "test getBoostMultiplier"
Although User1 and User2 have different amout of veToken, their boost multipier are the same, both are 25000.
Regardless of the value of userBoost.amount
(as long as it is non-zero), the function always returns MAX_BOOST
.
This behavior defeats the purpose of the function, which is expected to dynamically compute the boost multiplier based on the user's boost amount.
The impact is Medium, the likelihood is High, so the severity is Medium.
Manual Review
Consider following fix:
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.