Expected behavior: Any non-king can start/continue the game by calling claimThrone() with at least claimFee. The call should set currentKing = msg.sender, update lastClaimTime, add to the pot/fees, and increase claimFee(if applicable).
Actual behavior: claimThrone() requires the caller to already be the current king. At deployment, currentKing == address(0), and no EOA/contract equals address(0). Thus the first (and every) claim reverts, the game never starts, and all downstream mechanics are unreachable.
Likelihood:
Occurs on every deployment immediately after construction: currentKing is defaulted to address(0) and cannot be matched by any caller.
Persists forever: No reachable state transition can set currentKing to a nonzero address, because every claimThrone() reverts. The only other assignment to currentKing is in resetGame(), which sets it back to address(0).
Impact:
Total denial of service for core functionality: no one can claim the throne and the game is unplayable.
All flows dead: declareWinner() (needs a king), withdrawWinnings() (no winnings ever accrue), and fee/pot accounting are never exercised.
Generality comes from the previous formal argument.
What this demonstrates: From a fresh deployment, a funded non-zero arbitrary address calls claimThrone with msg.value >= claimFee and reverts with the “already the king” message, currentKing remains address(0).
Steps to reproduce:
Deploy Game with any valid parameters.
Fund an arbitrary non-zero address.
Call claimThrone{value: game.claimFee()} from that address.
Observe revert: "Game: You are already the king. No need to re-claim." and currentKing == address(0).
Change the equality check so any non-king can claim. Only the current king is blocked from reclaiming.
Use a custom error error Game__AlreadyKing() : if (msg.sender == currentKing) revert AlreadyKing(); for gas and clarity.
Fixing this unlocks additional issues (e.g., event/accounting/spec mismatches). I will submit those separately as findings conditional on this fix.
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.