Eggstravaganza

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

Return value of `EggstravaganzaNFT::mintEgg` is ignored in the `EggHuntGame::searchForEgg` function

Description: The EggstravaganzaNFT::mintEgg function returns a boolean but in the EggHuntGame::searchForEgg function it's not taken into account at all.

// src/EggHuntGame.sol
function searchForEgg() external {
...
eggNFT.mintEgg(msg.sender, eggCounter);
...
}
// src/EggstravaganzaNFT.sol
function mintEgg(address to, uint256 tokenId) external returns (bool) {
require(msg.sender == gameContract, "Unauthorized minter");
_mint(to, tokenId);
totalSupply += 1;
return true;
}

Recommended Mitigation: There are two mitigations:

  1. The return value from EggstravaganzaNFT::mintEgg should be checked and handled in the EggHuntGame::searchForEgg function.

  2. If it's not needed, the return value of EggstravaganzaNFT::mintEgg can be removed.

Updates

Lead Judging Commences

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

Unused return value

Returns a boolean value that isn't utilized by its caller

Support

FAQs

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