Core Contracts

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

Tautological calculation in constructor can affect arithmetic clarity

Summary

Unnecessary arithmetic operations carried out that cancel out.

Vulnerability Details

The constructor of the BaseGauge contract contains a tautological calculation when determining the nextPeriod in the constructor. The line uint256 nextPeriod = ((currentTime / _periodDuration) * _periodDuration) + _periodDuration; effectively results in the same value as currentTime + _periodDuration, which can lead to confusion for readers and maintainers of the code. This redundancy may obscure the intent of the calculation and could potentially introduce errors if modifications are made in the future.

constructor(...) {
uint256 nextPeriod = ((currentTime / _periodDuration) * _periodDuration) + _periodDuration;
...
}

To improve clarity and maintainability, it is recommended to simplify this calculation to directly compute the nextPeriod as currentTime + _periodDuration. This change will enhance the readability of the code and reduce the risk of misinterpretation.

Impact

Reduces code readability and increases computational cost for users.

Tools Used

Manual Review

Recommendations

Replace the tautological line with:

uint256 nextPeriod = currentTime + _periodDuration;
Updates

Lead Judging Commences

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

Give us feedback!