Since Status.NICE
is the first element in the SantasList::Status
enumerator it is the equivalent to zero (0
), thereby allowing any address not in the list to be considered Status::NICE
.
Solidity uses zero as defaults for a two things cause the SantasList::collectPresent()
function to allow any address
that has not been checked to collect a Status.NICE
present. This is because each item in the SantasList::Status
is compiled to uint
value starting with 0
, so Status.NICE == 0
. Additionally, when a value is not present in a mapping
the result will be zero (0
) as well. So this conditional will be true for every address
that is not in either mapping
.
This can be verified with by adding the following test case to SantasListTest.t.sol
:
Anyone can create as many addresses as they want and collect as many NFTs as they want.
Manual Review and Foundry
Reordering the elements in the SantasList::Status
so that Status::NOT_CHECKED_TWICE
is the first item and therefore is zero (0
):
Then testing addresses that have not been checked yet will become the same as if they had been added to both lists with the status of Status::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.