Bid Beasts

First Flight #49
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Non-Standard Variable Naming and Typographical Error in `BidBeasts::CurrenTokenID`

Root + Impact

  • Root Cause: The variable uint256 public CurrenTokenID in the BidBeasts contract uses a non-standard naming convention and contains a typographical error. The name CurrenTokenID appears to be a misspelling of CurrentTokenID, likely intended to track the current or next token ID for NFT minting. This violates the Solidity Style Guide, which recommends camelCase (e.g., currentTokenId) for state variables and functions, reserving PascalCase for contracts, structs, and enums. Additionally, the public visibility generates an automatic getter function (CurrenTokenID()) that inherits the non-standard name.

  • Impact: This issue reduces code readability and maintainability, potentially leading to developer confusion, inconsistent interfaces, and integration challenges. It increases the risk of errors during development or maintenance and may require additional documentation or workarounds for off-chain systems, slightly impacting project efficiency and trustworthiness.

Description:

The variable uint256 public CurrenTokenID in the BidBeasts contract violates the Solidity Style Guide by using a non-standard naming convention and containing a typographical error. Specifically:

  • The name CurrenTokenID appears to be a misspelling of CurrentTokenID, reducing clarity about its intended purpose (likely to track the current or next token ID for NFT minting).

  • The variable uses a mix of PascalCase (CurrenTokenID) and non-standard capitalization (TokenID instead of TokenId), whereas the Solidity Style Guide recommends camelCase (e.g., currentTokenId) for state variables and functions, reserving PascalCase for contracts, structs, and enums.

  • The public visibility of the variable generates an automatic getter function (CurrenTokenID()), which inherits the non-standard name, further propagating confusion in external interfaces or integrations.

uint256 public CurrenTokenID;

Risk

  • Likelihood: Low. The issue affects only the naming convention and does not impact core functionality, making it unlikely to cause runtime errors unless misinterpreted during development or integration. It depends on developers or integrators encountering the non-standard name.

  • Impact: Low. The impact is limited to readability and maintainability, with no direct financial or security risk. However, it may lead to minor inefficiencies, confusion during audits, or additional effort for documentation and integration, slightly affecting project quality and user experience.

Proof of Concept

The vulnerability stems from the non-standard naming and typographical error in CurrenTokenID, which can be illustrated as follows:

  • Naming Violation: The variable CurrenTokenID uses PascalCase, which is reserved for contracts, structs, and enums, while the Solidity Style Guide mandates camelCase for state variables (e.g., currentTokenId). This deviation makes the code less intuitive, as developers scanning the contract might overlook or misjudge its role.

  • Typographical Error: The misspelling "Curren" instead of "Current" introduces ambiguity. For instance, a developer might assume CurrenTokenID relates to a currency token ID rather than the current NFT token ID, leading to logical errors if they base their implementation on this misinterpretation.

  • Getter Propagation: The public visibility generates CurrenTokenID(), which external callers (e.g., frontends or other contracts) must use. This non-standard name requires additional documentation or mapping (e.g., in ABI handling), increasing the risk of integration errors or confusion for developers unfamiliar with the project’s naming quirks.

  • Long-Term Risk: Over time, as the project evolves or new developers join, the non-standard name could lead to maintenance overhead, such as inconsistent naming in related functions or variables, compounding the initial error into broader codebase inconsistencies.

The absence of a revert or functional failure means this issue is not immediately exploitable, but its impact grows with project complexity and team turnover, highlighting the importance of adhering to established naming conventions from the outset.

Recommended Mitigation:

  • Refactor the variable name to follow camelCase convention:

+ uint256 public currentTokenId; // Standard naming
- uint256 public CurrenTokenID;
Updates

Lead Judging Commences

cryptoghost Lead Judge about 1 month ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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