The distributeRewards function calculates the reward share for a gauge based on its weight relative to the total weight of all gauges. The calculation depends on the getTotalWeight() function:
The function checks for totalWeight == 0 and returns 0, preventing a division by zero error inside _calculateReward. However, distributeRewards() itself does not check whether any valid weight exists before making an external reward transfer:
If all gauges have a weight of 0, _calculateReward() will always return 0, meaning no rewards are distributed. However, if reward emissions continue accumulating without valid distribution, the system may misallocate rewards later, leading to unexpected fund depletion or skewed emissions once weight is reintroduced.
The primary impact is that if total weight is ever reduced to zero, all emissions are temporarily halted, potentially leading to stuck rewards and unexpected distribution issues when weight is reintroduced.
Before calling notifyRewardAmount, validate that the total gauge weight is greater than zero at the beginning of distributeRewards() and implement a fallback mechanism to handle reward accumulation in such scenarios.
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.