Core Contracts

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

Unbounded gauge list growth can lead to DOS in critical functions

Description

The GaugeController contract maintains an array of all gauges (_gaugeList) that grows without bounds and is traversed in critical functions:

function addGauge(address gauge, GaugeType gaugeType, uint256 initialWeight) external {
// No mechanism to remove gauges
_gaugeList.push(gauge);
}
function getTotalWeight() public view returns (uint256) {
// Iterates through entire array
for (uint256 i = 0; i < _gaugeList.length; i++) {
if (gauges[_gaugeList[i]].isActive) {
total += gauges[_gaugeList[i]].weight;
}
}
}

This design has two critical issues:

  1. getTotalWeight() is called in core functions like reward distribution

  2. As more gauges are added, gas costs increase linearly

  3. Could reach block gas limit making functions inoperable

Recommendation

Maintain a running total instead of looping:

uint256 public totalWeight;
function addGauge(...) {
_gaugeList.push(gauge);
if(initialWeight > 0) {
totalWeight += initialWeight;
}
}
function getTotalWeight() public view returns (uint256) {
return totalWeight;
}

Or implement gauge removal and cleanup:

function removeGauge(address gauge) external {
// Remove from array and reorganize
// Update weights
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 3 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.