Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
Submission Details
Impact: low
Likelihood: low

Unused state variable increases gas costs

Author Revealed upon completion

Unused state variable increases gas costs

Description

  • src/SnowmanAirdrop.sol contains an unused state variable s_claimers

  • Unused State Variables are stored on-chain, and storing data on Ethereum is expensive.

// Root cause in the codebase with @> marks to highlight the relevant section
// state variables is unused in contract
@> address[] private s_claimers; // array to store addresses of claimers

Risk


  • In Future developers or builders might get confused about the purpose of a variable, leading to accidental misuse or introduction of bugs

Proof of Concept

// unused state variable throughout contract
@> address[] private s_claimers; // array to store addresses of claimers

Recommended Mitigation

  • Either we can use the variable in SnowmanAirdrop::claimSnowman(), when claimer claims the snowman NFT we can store the address of claimers.

- remove this code
@> address[] private s_claimers; // array to store addresses of claimers

Support

FAQs

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