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

Uninitialized lastFedTimeStamp on Minting Leads to Incorrect Happiness Status

Summary

The lack of initialization for lastFedTimeStamp upon minting a new horse could lead to confusion for users who might expect a newly minted horse to be happy by default.

Vulnerability Details

The mintHorse function does not set the lastFedTimeStamp for newly minted horses.

Impact

Newly minted horses are incorrectly considered unhappy until they are fed for the first time, which could mislead users and affect the user experience.

Tools Used

Manual

Recommendations

To address the issue, the mintHorse function should be modified to set the lastFedTimeStamp for the newly minted horse to the current block.timestamp. This ensures that a newly minted horse is considered happy from the moment of its creation until the HORSE_HAPPY_IF_FED_WITHIN duration has passed without being fed.

Here is the updated mintHorse function:

function mintHorse() external {
uint256 newHorseId = totalSupply();
_safeMint(msg.sender, newHorseId);
horseIdToFedTimeStamp[newHorseId] = block.timestamp;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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