Santa's List

AI First Flight #3
Beginner FriendlyFoundry
EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

SantaToken.i_santasList should be renamed to better suit its type

feefwRoot + Impact

Description

  • One usually expects a variable with the word "list" in its name to be of a type that can list items.

  • Instead, the variable is a single address.

@> address private immutable i_santasList;

Risk

Likelihood:

  • The risk is for a developer to misunderstand this variable as something other than an address.

Impact:

  • The impact could be that devs misunderstand the logic of the contract.

Proof of Concept

Although compilation errors will flag this if a dev writes code that attempts to interact with i_santasList as if it were an array, etc., we do not want to even introduce the concept of this variable as an array, tuple, mapping, etc. It should be easily identifiable as an address.

// A dev may try to write the following code
for (uint256 i = 0; i < i_santasList.length; i++) {
console.log(santasList[i]);
}

Recommended Mitigation

The naming of the variable should be updated where it is declared and any other place it is called.

- remove this code
- address private immutable i_santasList;
+ add this code
+ address private immutable i_santasAddress;
+ update where i_santasList is used to i_santasAddress
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 4 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!