Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Signing up using ether doesn't update participation status

Summary

When a user signs up by depositing ethers, their participation status is not updated.

Vulnerability Details

A user can signup using ether by directly sending ether to ChristmasDinner contract. This would trigger the receive() function. It takes the deposit amount and updates the deposit mapping, but it does not update the participation status.

receive() external payable {
etherBalance[msg.sender] += msg.value;
emit NewSignup(msg.sender, msg.value, true);
}

Impact

This would let the host not being able to prepare properly for the exact number of participants.

Tools Used

Manual, VSCode

Recommendations

Make the following changes in receive() function

receive() external payable {
+ participant[msg.sender] = true;
etherBalance[msg.sender] += msg.value;
emit NewSignup(msg.sender, msg.value, true);
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

receive does not update participation status

Support

FAQs

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

Give us feedback!