DeFiHardhat
12,000 USDC
View results
Submission Details
Severity: low
Invalid

Literal variables being used instead of constant.

Summary

Using constant variables in Solidity provides clarity and maintainability to your code. It allows you to define and reuse values that remain constant throughout the contract, improving readability and making it easier to update these values in the future.

Vulnerability Details

uint256 a0 = (10 ** n) * a;
uint256 xNew = 10;
root = (xNew + 5) / 10;

Impact

If literal variables are used inconsistently or without proper documentation, they can lead to confusion or unintended changes if their values are modified incorrectly. And using literal variables might introduce a slight performance overhead compared to using constants, especially if they are used in performance-critical sections of code.

Tools Used

Aderyn

Recommendations

Use Constants: Define constants for values that do not change throughout the contract's lifecycle. Constants can be declared using constant keyword or through immutable variables with constant values.
Centralize Constants: If multiple contracts within your system use the same constant values, consider centralizing those constants in a single contract or a library. This promotes consistency and reduces redundancy.

Updates

Lead Judging Commences

giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational/Invalid

Support

FAQs

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