The BaseGauge contract implements a staking mechanism where users' reward weights are boosted based on their veToken holdings. The getRewardPerToken function is crucial for calculating the rate at which rewards are distributed.
In BaseGauge#getRewardPerToken, the reward rate calculation uses totalSupply() as the denominator, which represents the raw sum of staked tokens. However, the actual reward distribution is based on boosted weights from getUserWeight. This creates a mismatch between the reward rate calculation and the actual distribution of rewards.
The reward rate formula:
assumes that rewards should be distributed proportionally to staked amounts. However, since rewards are actually distributed based on boosted weights, this formula becomes incorrect when users have different boost multipliers.
High. This discrepancy leads to:
Incorrect reward rate calculations
Potential over-distribution of rewards when total boosted weight exceeds total supply
Unfair reward distribution that doesn't properly account for the boost system
High. This issue affects every reward distribution and becomes more severe as the disparity between users' boost multipliers increases.
Consider this scenario:
Total staked supply is 1000 tokens
User A stakes 500 tokens with 2x boost (effective weight 1000)
User B stakes 500 tokens with 1x boost (effective weight 500)
Total effective weight is 1500, but totalSupply() returns 1000
This causes reward rate to be calculated using 1000 as denominator instead of 1500
Results in 50% higher reward rate than intended
Maintain a separate total for boosted weights and use it in reward calculations:
This ensures reward rates accurately reflect the boosted weight system.
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.