Santa's List

AI First Flight #3
Beginner FriendlyFoundry
EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

`SantasList::checkTwice` function do not function as intended, it could not set user to a new status, which cause user stuck with their `s_theListCheckedOnce` status

SantasList::checkTwice function do not function as intended, it could not set user to a new status, which cause user stuck with their s_theListCheckedOnce status

Description

  • SantasList::checkTwice function should able to changes an address to a new Status! But now if santa makes a mistake on the first check, they can never fix it and the person will be stuck with that status. This is especially bad if they are marked as naughty by mistake.

@> function checkTwice(address person, Status status) external onlySanta {
@> if (s_theListCheckedOnce[person] != status) {
revert SantasList__SecondCheckDoesntMatchFirst();
}
s_theListCheckedTwice[person] = status;
emit CheckedTwice(person, status);
}

Risk

Likelihood: High

  • Every time Santa try to set a different status as first time, this SantasList::checkTwice function will revert.

Impact: High

  • SantasList::checkTwice function should able to changes an address to a new Status! But now if santa makes a mistake on the first check, they can never fix it and the person will be stuck with that status. This is especially bad if they are marked as naughty by mistake.

Proof of Concept

  1. Santa set user to NAUGHTY

  2. Santa set user to NICE

  3. Check SantasList::checkTwice function will revert

function testCantCheckTwiceDifferentStatus() public {
vm.startPrank(santa);
santasList.checkList(user, SantasList.Status.NAUGHTY);
vm.expectRevert();
santasList.checkTwice(user, SantasList.Status.NICE);
vm.stopPrank();
}

Recommended Mitigation

Remove the check and revert code of first time status.

function checkTwice(address person, Status status) external onlySanta {
- if (s_theListCheckedOnce[person] != status) {
- revert SantasList__SecondCheckDoesntMatchFirst();
- }
s_theListCheckedTwice[person] = status;
emit CheckedTwice(person, status);
}
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 23 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!