In the BaseGauge contract, the boostState.minBoost variable is initialized to 1e18, which is significantly larger than boostState.maxBoost (initialized to 25000). This inconsistency causes the getUserWeight function to revert with overflow/underflow errors when calculating boosts.
The issue cascades into other core functions:
earned: This function relies on getUserWeight to calculate rewards. Since getUserWeight reverts, earned also reverts.
_updateReward: This function relies on earned to update user rewards. Since earned reverts, _updateReward also breaks.
As a result, the core functionality of the contract is severely impacted, making it impossible to calculate or update rewards for users.
The getUserWeight function always reverts, making it impossible to retrieve a user's weight with boost applied.
The earned function reverts, breaking reward calculations.
The _updateReward function reverts, preventing reward updates for users.
This breaks core functionality of the contract, including reward distribution and user state management.
Deploy the BaseGauge contract.
Call the getUserWeight function for any user.
Observe that the transaction reverts with an overflow/underflow error.
Call the earned function for any user.
Observe that the transaction reverts because it depends on getUserWeight.
The root cause is the incorrect initialization of boostState.minBoost in the BaseGauge constructor. The value 1e18 is not a valid basis points value and is much larger than boostState.maxBoost (25000). This inconsistency causes the boost calculation logic to fail, which cascades into other dependent functions.
Foundry Test
manual code review
Update the initialization of boostState.minBoost to a valid basis points value, such as 10000 (100%). This ensures that minBoost is smaller than maxBoost and aligns with the expected basis points scale.
getUserWeight:
earned:
_updateReward:
Documentation: Clearly document that maxBoost and minBoost are defined in basis points (where 10000 = 100%).
Validation: Add checks in the constructor to ensure maxBoost > minBoost.
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.