The typeShare calculation in the _calculateReward function is incorrect. It uses MAX_TYPE_WEIGHT instead of calculating the share relative to the total typeWeights. This causes reward calculations to be inflated.
Affected Code: GaugeController::CalculateReward
In the current implementation, typeShare is calculated as:
Since MAX_TYPE_WEIGHT is a constant (10000) and matches WEIGHT_PRECISION, the typeShare is always equal to typeWeights[g.gaugeType]. This results in inflated reward calculations.
The correct calculation should be based on the total type weights, like this:
This ensures typeShare reflects the actual proportion of a gauge type's weight relative to the total weight.
If the typeWeights are adjusted to be:
typeWeights[GaugeType.RWA] = 7000
typeWeights[GaugeType.RAAC] = 5000
Under the current implementation, if a gauge belongs to RWA, the typeShare is 7000.
With the corrected implementation:
If the weights are adjusted such that their sum does not equal 10000 and the adjustment is non-proportional, the current implementation inflates rewards, whereas the correct calculation would maintain an accurate distribution of typeShare.
Since typeWeights can be adjusted dynamically, this issue becomes more significant if weights are changed non-proportionally, which can occur during normal contract operation. Such adjustments would further distort reward calculations, potentially leading to unfair distribution.
The incorrect typeShare calculation inflates reward calculations and can lead to over-rewarding certain gauges.
Manual code review.
Update the typeShare calculation to:
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.