All users are by default has NICE
status, so they can collect rewards without actually being added by the Santa.
SantasList
uses enum values for status NICE, EXTRA_NICE, NAUGHTY, NOT_CHECKED_TWICE
.
As per current implementation,
0 represents NICE.
1 represents EXTRA_NICE
2 represents NAUGHTY
3 represents NOT_CHECKED_TWICE
These enum values are used as a mapping from address to status in the contract.
A user who is not in the list, Mapping will assign them first value, which is NICE.
enum order is not correct as per use case, due to which it makes the anybody a NICE
status, due to that they can collectPresent
which they are not supposed to collect.
In existing test suite, add the following function -
now run forge test --match-test testCheckListWhoIsNotInList -vv
in the terminal and it will show results as follows
Anybody can claim the reward alloted for NICE
status
Foundry, Manual Review
reverse the enum order the way it's assigned to solve the issue.
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.