The SantasList
smart contract has a significant logical flaw in the checkTwice
function. This function enforces a rule that a user's status during the second check must match their status from the first check, not accommodating for legitimate status changes (upgrades or downgrades) between the two checks. This rigid design flaw prevents the system from recognizing and rewarding users whose behaviors have improved or declined.
The issue arises from the checkTwice function's implementation. It includes a conditional statement that reverts the transaction if the status assigned during the second check (s_theListCheckedTwice) does not match the status from the first check (s_theListCheckedOnce). This condition overlooks legitimate scenarios where a user's behavior might warrant a change in status, such as upgrading from 'NICE' to 'EXTRA_NICE' or vice versa.
Inflexible Status Update: Users whose behavior merits a change in status between the two checks are unfairly locked into their initial categorization, denying them the opportunity to either receive enhanced rewards or face appropriate consequences for their actions.
The following test uses the santa's address to set the users second status to EXTRA_NICE after updating to NICE. When run, the function will revert and this test will pass, demonstrating that a user cannot upgrade:
Terminal:
Foundry
Modify the checkTwice function to allow for status changes between the first and second checks.
Let the collectPresent
function handle the system's rules to see if a user should receive rewards.
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.