The declareWinner()
function contains a logic error where it zeroes the pot
variable before emitting the GameEnded
event. This causes the event to always emit 0 as the prize amount instead of the actual winnings, breaking off-chain monitoring and making it impossible to track the true prize amounts won in each game round.
The issue occurs because the pot
is reset to 0 before being used in the event emission:
Key issues:
pot
is used to track prize amount in the event
pot = 0
happens before emit GameEnded()
The event always emits 0 as the prize amount
Off-chain systems cannot determine actual winnings
Likelihood: High - This bug occurs every single time a winner is declared. It's deterministic and unavoidable.
Impact: Low - While funds are correctly assigned to pendingWinnings
, all external monitoring, analytics, and UI systems receive incorrect data.
Low severity because:
Off-chain monitoring systems show incorrect prize amounts (always 0)
No actual funds are at risk (internal accounting is correct)
This test demonstrates how the GameEnded
event always emits 0 as the prize amount instead of the actual pot value, while internal accounting remains correct:
Move the pot = 0
assignment after the event emission:
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.