In reward calculation, if total weight of all gauges exceed the weight of a single gauge in a considerable way, that gauge’s rewards will be calculated as zero.
GaugeController::distributeRewards
calls _calculateReward
with the specified gauge address.
_calculateReward
calls getTotalWeight
, which loops through all the gauges in the _gaugeList
and sums their weights.
Then, back in _calculateReward
function, the shares for that specific gauge is calculated with the following formula: uint256 gaugeShare = (g.weight * WEIGHT_PRECISION) / totalWeight;
WEIGHT_PRECISION is hardcoded to 10000.
Which means, if totalWeight surpasses the multiplication of the weight of the gauge in question with 10000, gaugeShare
will round down to zero.
When gaugeShare
gets calculated as 0, the return statement will also be 0 because here:
0 multiplied by anything else is 0, and when you divide 0 with anything, the result is again 0. So, even though the gauge has weight, the calculation returns 0 rewards.
Gauge rewards calculated wrongly and return 0 value.
You could consider a more precise weight precision like 1e18.
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.