The GaugeController::vote
function uses the raw veRAACToken
balance (18 decimals) without scaling, causing gauge weights to become exponentially large. This leads to arithmetic precision loss in reward calculations, resulting in zero rewards being distributed to gauges.
In GaugeController::vote
, the user's voting power is taken directly from veRAACToken.balanceOf(msg.sender)
without accounting for the token's 18 decimal places. This inflated voting power is then used in _updateGaugeWeight
to calculate gauge weights.
The vulnerability exists in the interaction between three key functions:
GaugeController::vote
: Uses unscaled veRAACToken
balance as voting power
GaugeController::_updateGaugeWeight
: Calculates new gauge weight using the inflated voting power
GaugeController::_calculateReward
: Attempts to calculate rewards using the inflated gauge weight
The core issue is that votingPower
includes 18 decimal places from veRAACToken
, but is used directly in weight calculations. For example:
1 veRAACToken = 1e18 units
With weight = 1 (minimum), the gauge weight becomes: 1 * 1e18 / 10000 = 1e14
With weight = 10000 (maximum), the gauge weight becomes: 10000 * 1e18 / 10000 = 1e18
This causes two critical problems:
Gauge weights become astronomically large (1e14 to 1e18 range)
The reward calculation divides by WEIGHT_PRECISION
twice (once for gaugeShare, once for typeShare), causing precision loss
Initial Setup
User votes with minimum weight (1) for gaugeA
User votes with maximum weight (10000) for gaugeB
Reward calculation for gaugeA fails
POC
To use foundry in the codebase, follow the hardhat guide here: Foundry-Hardhat hybrid integration by Nomic foundation
The vulnerability causes:
Gauge weights to be inflated by 1e18
Zero rewards distribution due to arithmetic precision loss
Permanent denial of service as weights cannot be reduced once inflated
Manual review, foundry test suite
Scale down the voting power by 1e18 before using it in weight calculations:
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.