Core Contracts

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

Unused slopeChanges Variable in VotingPowerState

Summary

The VotingPowerState.slopeChanges mapping is updated in _updateSlopeChanges(), but it is never used in any other function. As a result, the stored slope change values have no impact on the system, making this unnecessary state storage that increases gas costs without providing any functionality.

Vulnerability Details

slopeChanges Is Updated But Never Read

The contract modifies slopeChanges in _updateSlopeChanges()

function _updateSlopeChanges(
VotingPowerState storage state,
uint256 unlockTime,
int128 oldSlope,
int128 newSlope
) internal {
if (oldSlope != 0) {
state.slopeChanges[unlockTime] -= oldSlope;
}
if (newSlope != 0) {
state.slopeChanges[unlockTime] += newSlope;
}
}

** Problems**

  • The slopeChanges mapping is updated every time a user’s voting power changes, but it is never referenced elsewhere in the contract.

  • This means any modifications to slopeChanges have no effect on the voting power calculations.

Unnecessary Storage Increases Gas Costs

  • Since slopeChanges is stored on-chain in a mapping, updating it incurs unnecessary gas fees without any functional impact.

  • Storing useless data increases contract complexity and state size, which is inefficient.

Impact

  • slopeChanges writes to storage but is never used, wasting gas.

  • The contract stores data that serves no purpose, increasing blockchain state size.

Tools Used

Manual Review

Recommendations

Remove slopeChanges if Not Needed

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

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