The first defined member for the enum Status is "NICE", that means that any variable of type Status will have its default value "NICE". This is a problem because we let
some addresses to "collectPresent" if Santa's never called "checkList" & "checkTwice" functions for them. The mappings s_theListCheckedOnce, s_theListCheckedTwice will have default value of "NICE" for every address.
The problem is that any address which was never checked by Santa (by calling checkList & checkTwice OR by calling ONLY checkList) is able to collectPresent successfully as they are NICE by default. Because for the enum type in Solidity, the default value is its first member.
If you add these tests to the SantaListTest.sol they will pass, but they shouldn't:
Random addresses who has never been "checked"(checkList & checkTwice) by Santa are allowed to get a present - 1 SANTA (NFT) from the SantasList contract.
Manual inspection & Foundry testing
Reorder the enum Status values like that:
enum Status {
NOT_CHECKED_TWICE
NICE,
EXTRA_NICE,
NAUGHTY
}
OR the protocol states that there are UNKNOWN addresses, in the context of that it makes more sense to add a new value of "UNKNOWN" to the Status enum like:
enum Status {
UNKNOWN,
NICE,
EXTRA_NICE,
NAUGHTY,
NOT_CHECKED_TWICE
}
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.