The GaugeController contract implements a voting system where users can vote on gauges using their veToken balance as voting power. The gauge weights determine how rewards are distributed among different gauges. Users can vote by specifying a weight between 0 and 10000 (100%).
The GaugeController#vote and GaugeController#_updateGaugeWeight functions incorrectly calculate gauge weights when a user's voting power changes between votes. The current implementation uses the user's current voting power both for removing the old weight and adding the new weight, instead of using the historical voting power for removing the old weight.
When calculating the new gauge weight, the contract:
Subtracts oldWeight * currentVotingPower / WEIGHT_PRECISION
Adds newWeight * currentVotingPower / WEIGHT_PRECISION
This assumes the user's voting power hasn't changed since their last vote, which may not be true as veToken balances can change over time through various mechanisms (locking, unlocking, etc.).
High. The incorrect gauge weight calculation directly affects reward distribution across the protocol. When gauge weights are incorrectly calculated, it leads to unfair reward distribution where some gauges receive more or fewer rewards than they should based on the actual voting power allocated to them.
High. Changes in voting power are common in veToken systems due to the time-locked nature of the tokens. Users can increase their voting power by locking more tokens or see it decrease as locks expire.
User has 10,000 voting power and votes on gauge A with weight 50%
Gauge A weight = 5,000 (50% * 10,000)
User's voting power decreases to 5,000
User votes again on gauge A with weight 50%
Current implementation:
Old contribution removed: 50% * 5,000 = 2,500 (incorrect)
New contribution added: 50% * 5,000 = 2,500
Final gauge weight = 5,000 - 2,500 + 2,500 = 5,000 (incorrect)
Expected implementation:
Old contribution removed: 50% * 10,000 = 5,000
New contribution added: 50% * 5,000 = 2,500
Final gauge weight = 5,000 - 5,000 + 2,500 = 2,500 (correct)
Store the actual voting power contribution instead of just the weight percentage:
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.