The default status of the persons is ǸICE
which, unless Santa is checking them, will make them eligible for a present.
In Solidity, the default mapping is the default value of that type. The default value of an Enum is 0 so in the case of the SantasList
contract, the two mappings s_theListCheckedOnce
and s_theListCheckedTwice
will have Status.NICE
as the default mapping.
If Santa doesn't manage to check everybody till Christmas, unchecked people could still get a present.
Also the existing test still passes if we comment out the lines used to check the user:
High as unchecked people and, in the worst case, naughty people could get a present.
Manual code review
Change the order of the Enum values. NOT_CHECKED_TWICE
could be renamed to NOT_CHECKED
as it's more meaningful.
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.