The GaugeController::_calculateReward function performs division operations before final multiplication, causing precision loss that results in underpaid rewards. The current implementation calculates gauge and type shares using intermediate divisions (WEIGHT_PRECISION denominator), truncating fractional values before the final reward calculation. This approach magnifies rounding errors when multiple divisions occur sequentially.
Configure test environment with:
Period emission: 123,456,789 tokens
Gauge weight: 1,234
Total weight: 5,555
Type weight: 6,666
MAX_TYPE_WEIGHT: 10,000
Original calculation:
Improved calculation:
In this example, 18,281,481 - 18,278,007 = ~3474 tokens lost as a result.
Add to test file GaugeController.test.js:
High severity. Direct financial impact to users through systematically underpaid rewards. Protocol loses accuracy in incentive distribution, potentially undermining gauge participation. Difference of 3,474 tokens in example scales linearly with larger emissions.
Formula restructuring
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.