The BaseGauge::_getBaseWeight function incorrectly returns the gauge's total weight instead of the user's base weight, causing user rewards to be inflated based on the entire gauge's weight rather than their individual stake. In addition, any user with veTokens become eligible to earn rewards without staking.
In BaseGauge.sol, the _getBaseWeight function returns the gauge's total weight instead of calculating the user's individual base weight:
This value is then used in BaseGauge::getUserWeight which is called by BaseGauge::earned to calculate rewards. The issue compounds because the base weight is not tied to user's staked amount and so, rewards are inflated by using the gauge's total weight and non-stakers can claim rewards.
POC
Alice stakes 100 tokens in a gauge with total weight of 5000
Bob has 0 staked tokens but holds veTokens
Bob calls BaseGauge::earned
_getBaseWeight returns 5000 (gauge weight) instead of 0 (Bob's stake)
Bob can claim inflated rewards despite having no stake
To use foundry in the codebase, follow the hardhat guide here: Foundry-Hardhat hybrid integration by Nomic foundation
Users can earn rewards without staking tokens and reward calculations are severely inflated.
Manual review, foundry test suite
Add functionality that takes into consideration a user's stake before allowing claim
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.