The application fails to properly account for the default value of SantasList::Status
enum in SantasList::collectPresent
, SantasList::checkTwice
, SantasList::getNaughtyOrNiceTwice
and SantasList::getNaughtyOrNiceOnce
.
The default value of an enum is it's first member
Thus, for the case of SantasList::Status
enum, it's default value is NICE
.
This leads:
Both SantasList::getNaughtyOrNiceOnce
and SantasList::getNaughtyOrNiceTwice
to return NICE
for persons not present in SantasList::s_theListCheckedOnce
and SantasList::s_theListCheckedTwice
respectively
The first call to SantasList::collectPresent
at past christmass 2023 block time by any caller that has not been SantasList::checkList
-ed and SantasList::checkTwice
-d to mint a token instead of reverting
In the terminal run the following commands:
forge test --mt testCollectPresentNotChecked
forge test --mt testCheckListInexistentUser
inexistent users can mint SantasList ERC721 tokens come christmass 2023 block time on their first call to SantasList::collectPresent
.
SantasList::getNaughtyOrNiceOnce
and SantasList::getNaughtyOrNiceTwice
will mislead the caller into believing that, inexistent users have been marked as NICE
.
Manual review
in src/SantasList::Status
add the following member as indicated in the below code comment.
In Solidity the first element of an enum is the default value. In Santa's List, the means each person is mapped by default to 'NICE'.
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.