Christmas Dinner

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

ETH payer can not be participant. As `recieve` function is not updating the participants list.

Summary:

`ChristmasDinner::recieve` function is not updating participants list for that users who pays ETH to participate in dinner. The Reecieve function is not following doccumentation, as it is not handling user signup properly.
```javascript
receive() external payable {
@> etherBalance[msg.sender] += msg.value;
emit NewSignup(msg.sender, msg.value, true);
}
```

Impact:

ETH payer will assume that thay are not participants, will pay ETh again and again to participate.

Proof of concept:

Add this to `ChristmasDinnerTest.t.sol`.
Code:
```javascript
function testRecieveFunctionDoesNotUpdatingParticipants() public {
address participant = makeAddr("User");
vm.deal(participant, 10e18);
vm.prank(participant);
(bool sent, ) = address(cd).call{value: 1e18}("");
require(sent);
assertEq(cd.getParticipationStatus(participant), false);
}
```

Recommendations:

The `recieve` function shold be like mentioned below.
```diff
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 11 months 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.