The participant mapping is not updated when user deposits native ETH to the contract to sign up as participant.
When a user sends ETH to the contract via the receive() function, their etherBalance is updated, and a NewSignup event is emitted. However, the participant mapping is not updated, which tracks whether a user is considered a participant. If the same user later deposits tokens using the deposit() function or native ETH using the receive(), the NewSignup event is emitted again because the participant mapping still shows false.
Add the following test to the ChristmasDinnerTest contract:
Although user1 becomes participant after depositing ETH, the NewSignup event is also emited after the user deposits some token (WETH, WBTC or USDC).
The NewSignup event is emitted twice for the same user - once for ETH deposit via receive() and again for tokens via deposit() or ETH with receive(). This is misleading and can confuse users or data analytics tools that rely on event logs.
The user is effectively treated as a participant for ETH but not for tokens unless they explicitly deposit tokens. This inconsistency could cause issues in other parts of the contract.
Manual review
Foundry
Add a check and update the participant mapping in the receive() function when the user sends ETH.
Also, when the user is already a participant emit GenerousAdditionalContribution event.
This way, the user is correctly marked as a participant regardless of the deposit method.
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.