Core Contracts

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

Inefficient Total Gauge Weight Calculation

Location

governance -> gauges -> GaugeController.sol -> Line 418

Summary

The getTotalWeight function calculates the total weight of all active gauges by iterating over the entire _gaugeList array. While functionally correct, this approach may become gas‑inefficient if the number of gauges grows significantly.

Vulnerability Details

Intended Behavior:
The function should provide an aggregate weight of all active gauges to determine revenue and reward distribution.

Observed Behavior:
The implementation uses a for‑loop over _gaugeList and checks each gauge’s isActive flag before summing its weight.

Why It Matters:
Although this is not a security vulnerability per se, high gas costs can hinder usability and lead to transaction failures in scenarios with many gauges.

Impact

Performance Impact:
Increased gas usage could make calling this function expensive or cause it to fail in high-load scenarios.

User Experience:
Elevated gas costs affect overall protocol efficiency and could discourage users from interacting with gauge-related functions.

function getTotalWeight() public view override returns (uint256) {
uint256 total = 0;
for (uint256 i = 0; i < _gaugeList.length; i++) {
if (gauges[_gaugeList[i]].isActive) {
total += gauges[_gaugeList[i]].weight;
}
}
return total;
}

Recommendations

To optimize gas usage:

  • Maintain a running total of active gauge weights that updates whenever a gauge’s weight or status changes.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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