Core Contracts

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

Variable Shadowing in `processVote()` Function

Summary

Variable shadowing [totalVotes] in BaseGauge.

Vulnerability Details

The processVote() function in the BaseGauge contract has a potential issue with variable shadowing. The function takes a parameter named totalVotes, which is also the name of a state variable in the contract. This can lead to confusion about which totalVotes is being referred to within the function, especially when performing operations like totalVotes - vote.weight + votingPower.

Variable shadowing can lead to unintended behavior if the wrong variable is used in calculations or logic, potentially affecting the accuracy of vote processing and the integrity of the voting system.

Impact

Reduces code readability.

Tools Used

Manual Review

Recommendations

To avoid confusion and potential errors, rename the function parameter to something distinct, such as currentTotalVotes, to clearly differentiate it from the state variable. This will help ensure that the correct variable is used in calculations and improve code readability.

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 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.