Incorrect valildation blocks players to claim the throne
Incorrect validation in claimThrone()
prevents any participant from joining the game and becoming a King, effectively blocking gameplay and rendering the game logic meaningless.
After a game is initialized, the value of currentKing
is initially set to address(0)
. However, the second require statement — require(msg.sender == currentKing, ...)
— enforces that only the current king can claim the throne. Since currentKing
is address(0)
at the start, this condition effectively requires msg.sender
to be the zero address, which is not feasible and incompatible with normal gameplay. As a result, no participant can ever claim the throne, rendering the game logic blocked and meaningless.
Likelihood: High
Impact:
Incorrect validation blocks players to claim the throne and become a kings.
Noone can claim the throne, which blocks the game nad makes it meaningless.
Manual review
Foundry
Fix the validation within second require statement in claimThrone()
:
This adjustment ensures that the game's requirements for claiming the throne are properly enforced and the core logic is correctly implemented. Only an address different from the current king will be allowed to claim the throne and become the new king. Most importantly, this change removes the critical blocker that previously prevented new players from participating in the game.
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.