The searchForEgg()
function in EggHuntGame.sol
calls eggNFT.mintEgg(msg.sender, eggCounter)
without verifying its return value. This can lead to false assumptions that the NFT was successfully minted, even if the call silently fails.
In the current implementation of searchForEgg()
:
The mintEgg()
function in EggstravaganzaNFT.sol
returns a boolean to indicate success. Ignoring this return value means that the game may:
Increment eggCounter
and update eggsFound
Emit the EggFound
event
But fail to mint the NFT
This creates a mismatch between the on-chain state and actual token ownership. A player may appear to have found an egg, but not actually own the corresponding NFT.
Silent failure: If mintEgg()
fails (e.g., if gameContract
is not properly set), the contract will act as if the mint succeeded.
Broken accounting: The internal eggCounter
and eggsFound
values can be inconsistent with real NFT ownership.
Event inconsistency: EggFound
events may be emitted even when no NFT was minted.
Manual Code Review
Check the return value of mintEgg()
and revert if it fails:
Returns a boolean value that isn't utilized by its caller
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.