declareWinner function resets the pot to zero before emitting the GameEnded event, resulting in the event always logging a pot value of zero regardless of the actual winnings transferred.In the declareWinner() function, the GameEnded event is emitted after the pot has already been assigned to the winner and reset to zero. This causes the emitted pot value to always be 0, which is misleading and does not reflect the actual value awarded.
Likelihood:
The issue occurs deterministically every time the game ends.
Impact:
Users and systems that rely on these logs will collect wrong information
Add this test to GameTest.t.sol
Output traces:
Reorder the statements in declareWinner so that the GameEnded event is emitted before resetting the pot:
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.