Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

No Cap on eggCounter Growth

Summary

Vulnerability Details

if (random < eggFindThreshold) {
eggCounter++;
eggsFound[msg.sender] += 1;
eggNFT.mintEgg(msg.sender, eggCounter);
emit EggFound(msg.sender, eggCounter, eggsFound[msg.sender]);
}

The searchForEgg() function increments a global eggCounter and mints NFTs without any upper bound.

Without a cap:

  • Players could farm an unlimited number of eggs.

  • mintEgg() could be spammed if the pseudo-randomness is manipulated.

  • The eggCounter could overflow in the long term (though unlikely with uint256, still theoretically possible).

  • Game balance, rarity mechanics, or metadata tied to token IDs may be unintentionally affected.

Impact

Unlimited minting can lead to devaluation of NFTs.

Tools Used

Recommendations

Introduce a cap or maximum number of eggs (e.g., MAX_EGGS) and enforce it:

uint256 public constant MAX_EGGS = 10000;
require(eggCounter < MAX_EGGS, "All eggs have been found");
Updates

Lead Judging Commences

m3dython Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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