Summary
In file contracts/core/governance/gauges/GaugeController.sol , there are 6 unused variable related to vote / rewards system.
uint256 public constant VOTE_DELAY = 10 days;
uint256 public constant MIN_VOTE_DELAY = 1 days;
uint256 public constant MAX_VOTE_DELAY = 10 days;
uint256 public constant MIN_VOTE_WEIGHT = 100;
* @notice Type weights and periods
* @dev Tracking for gauge type weights and their time periods
* typeWeights: Weight multipliers for each gauge type
* typePeriods: Period data for each gauge type
*/
mapping(GaugeType => uint256) public typeWeights;
mapping(GaugeType => Period) public typePeriods;
Vulnerability Details
Based on the comments and the documentation, the vote function is missing DELAY / WEIGHT / type check
* @notice Core voting functionality for gauge weights
* @dev Updates gauge weights based on user's veToken balance
* @param gauge Address of gauge to vote for
* @param weight New weight value in basis points (0-10000)
*/
function vote(address gauge, uint256 weight) external override whenNotPaused {
if (!isGauge(gauge)) revert GaugeNotFound();
if (weight > WEIGHT_PRECISION) revert InvalidWeight();
uint256 votingPower = veRAACToken.balanceOf(msg.sender);
if (votingPower == 0) revert NoVotingPower();
uint256 oldWeight = userGaugeVotes[msg.sender][gauge];
userGaugeVotes[msg.sender][gauge] = weight;
_updateGaugeWeight(gauge, oldWeight, weight, votingPower);
emit WeightUpdated(gauge, oldWeight, weight);
}
Impact
Missing above checks for the vote / rewards function, an attacker could keeping to vote within 1 day and vote with any weight he/she wants.
The issue can impact the balance of the voting system and the rewards distribution logic.
Tools Used
Manual review
Recommendations
Adding checks in the vote function to make sure the cooling period and the weight is greater than the MIN_VOTE_WEIGHT
if (weight > 0 && weight < MIN_VOTE_WEIGHT) revert WeightBelowMinimum();
if (block.timestamp < lastVoteTime[msg.sender] + VOTE_DELAY) revert VoteTooFrequent();
lastVoteTime[msg.sender] = block.timestamp;