The contract declares an immutable variable as follows:
In Solidity, immutable variables are assigned once at contract deployment and cannot be modified afterward. This provides gas efficiency and ensures the value cannot be tampered with after deployment.
However, the current variable name entranceFee does not follow recommended naming conventions. Per coding standards, immutable variables should be prefixed with i_. This convention signals immutability to developers, improving code readability, maintainability, and reducing the risk of misinterpreting the variable’s mutability in complex contract logic.
Severity: Low
Type: Maintainability / Readability
Impact: While there is no direct security vulnerability, inconsistent naming conventions can lead to confusion and mistakes when the contract is extended or maintained, particularly in large codebases. Clear and consistent naming helps prevent misusing variables that are immutable.
Low security impact: The immutability is enforced by the compiler, so the variable cannot be altered post-deployment.
Maintainability: Using the i_ prefix makes immutable variables easily identifiable, enhancing readability for developers and auditors.
Best Practices: Aligns with widely adopted Solidity style guides and internal coding standards.
The current declaration:
The recommended change is:
Explanation:
The - line shows the existing variable declaration, which does not indicate immutability clearly.
The + line shows the recommended naming convention using the i_ prefix.
Functions or contract logic referencing entranceFee should be updated to i_entranceFee. For example:
This demonstrates that all reads from the variable remain correct after renaming, ensuring functional integrity while improving readability.
Rename all immutable variables in the contract to use the i_ prefix.
Update all references in the contract accordingly to prevent compilation issues.
Document this naming convention in the project’s coding guidelines to enforce consistency across the codebase.
Review other constants and immutable variables to ensure consistent naming, improving overall code readability and maintainability.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.