Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: medium
Invalid

Horses can be not happy without existing

Description

If both Huff and Solidity files, there is no check if a horse exists before reading the mapping in isHappyHorse. As a result, all non-existing horses are considered not happy instead of reverting with an error.

Impact

Confusion with returned data.
Unexpected logic for the protocol.

Proof of Concept

Foundry PoC
function testFeedNonCreatedHorseIsNotHappy() public {
skip(2 days);
uint nonCreatedHorseID = 100;
// will succeed even if the horse doesn't exist!
assertEq(horseStore.isHappyHorse(nonCreatedHorseID), false);
}

Recommended Mitigation

Add a check in both contracts to ensure that a horse exists before returning its happiness status. A simple check is to call ownerOf with the tokenId; this function will revert if the token is not minted.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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