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

`HorseStore.huff:: macro HORSE_HAPPY_IF_FED_WITHIN` stores the storage slot rather than the value

Summary

The value is not stored for the HORSE_HAPPY_IF_FED_WITHIN macro function instead it stores the storage pointer which is 0 ==> slot 0.

Vulnerability Details

#define macro HORSE_HAPPY_IF_FED_WITHIN() = takes (0) returns (0) {
[HORSE_HAPPY_IF_FED_WITHIN_CONST] // [HORSE_HAPPY_IF_FED_WITHIN]
0x00 mstore
0x20 0x00 return
}

Impact

Since the value is set to 0 which is the 0th slot storage pointer rather than the supposed 24-hour timestamp in seconds when you feed a horse, the horseIdToFedTimeStamp[horseId] is set to the block.timestamp when you feed it but checking that the horse has indeed been fed will reveal a misleading result because we compare 0 to 24 hours in seconds which will return false telling us the horse has not been fed rather than the opposite.

Tools Used

Manual review

Recommendations

Fix the macro function to store the value to compare against 0x0000000000000000000000000000000000000000000000000000000000015180 instead of 0.

Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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