Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Valid

Incorrect Gauge Weight Emission in BoostController Vote Function

Summary

The BoostController contract’s vote function emits the WeightUpdated event using the user-provided weight instead of the actual gauge weight computed after the vote update. This discrepancy leads to inaccurate reporting of gauge weight changes.

Vulnerability Details

In the vote function, the contract captures the old user vote weight from userGaugeVotes and then updates it with the new user-specified weight:

uint256 oldWeight = userGaugeVotes[msg.sender][gauge];
userGaugeVotes[msg.sender][gauge] = weight;

Subsequently, it calls the internal function _updateGaugeWeight which recalculates the gauge's weight based on the user's voting power:

function _updateGaugeWeight(
address gauge,
uint256 oldWeight,
uint256 newWeight,
uint256 votingPower
) internal {
Gauge storage g = gauges[gauge];
uint256 oldGaugeWeight = g.weight;
uint256 newGaugeWeight = oldGaugeWeight - (oldWeight * votingPower / WEIGHT_PRECISION)
+ (newWeight * votingPower / WEIGHT_PRECISION);
g.weight = newGaugeWeight;
g.lastUpdateTime = block.timestamp;
}

However, the event is emitted as follows:

emit WeightUpdated(gauge, oldWeight, weight);

This emission uses the raw input value weight (i.e. the new user vote weight) rather than the recalculated gauge weight (newGaugeWeight).

Impact

Off-chain systems and users relying on the WeightUpdated event for monitoring gauge weights may receive misleading data. Furthermore, inconsistent event data undermines transparency in gauge voting, potentially affecting the integrity of reward distribution and governance processes.

Tools Used

  • Manual Code Review

Recommended Mitigation

Modify the vote function to emit the actual updated gauge weight. For example, after calling _updateGaugeWeight, retrieve the new gauge weight from the contract’s storage and use it in the event emission:

uint256 oldWeight = userGaugeVotes[msg.sender][gauge];
userGaugeVotes[msg.sender][gauge] = weight;
_updateGaugeWeight(gauge, oldWeight, weight, votingPower);
// Retrieve the new gauge weight from storage
uint256 newGaugeWeight = gauges[gauge].weight;
emit WeightUpdated(gauge, oldWeight, newGaugeWeight);
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

WeightUpdated emits user's inputted weight instead of the new weight value as per IGaugeController

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

WeightUpdated emits user's inputted weight instead of the new weight value as per IGaugeController

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.