Eggstravaganza

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

`mintEgg()` Lacks Explicit Input Validation for Duplicate `tokenId`

Summary

The mintEgg() function in EggstravaganzaNFT depends on OpenZeppelin's internal _update() logic (via _mint()) to prevent duplicate tokenIds. While this is technically secure, it lacks explicit validation and emits an ambiguous revert reason, which reduces clarity and auditability.

Vulnerability Details

The function is implemented as follows:

function mintEgg(address to, uint256 tokenId) external returns (bool) {
require(msg.sender == gameContract, "Unauthorized minter");
_mint(to, tokenId);
totalSupply += 1;
return true;
}

This relies on _mint() from the ERC721 base contract to handle uniqueness.
While functionally correct, this logic:

  • Obscures the intent behind the revert

  • Makes the root cause less obvious to developers or integrators

  • Can lead to confusion when reading transaction failure reasons

Impact

  • Makes debugging and code auditing harder

  • Poor developer experience and user feedback in case of mint collisions

Tools Used

  • Manual Code Review

Recommendations

Add an explicit validation at the top of mintEgg().

Updates

Lead Judging Commences

m3dython Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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