Description
Normal Behavior:
Any player except for the current king should be able to claim the throne by paying the required fee. The new king replaces the previous one, the fee increases for the next claim, and the competition continues.
Issue:
The claimThrone()
function incorrectly requires that the caller is the current king. This means only the current king (or initially, no one) is ever allowed to claim. This prevents all normal gameplay, as no one (other than the king) can ever become king, making the game unplayable.
As a result, only the current king can claim again and again, defeating the purpose of the game.
Likelihood:
This will occur every time a player who is not the current king attempts to call claimThrone()
.
Since currentKing
is initialized to address(0)
, only the first claim is allowed. After that, only the same address can claim again; all others are blocked.
In a deployed contract, the game cannot progress past the first claim.
Impact:
No new players can join the game after the first claim.
The game's competitive mechanic is entirely broken, making the dApp/game non-functional and causing user funds to be potentially stuck.
Replace the faulty comparison so that only addresses not currently the king can claim.
This will ensure any player except the current king can claim, restoring intended game flow.
Thoroughly review all require checks and re-test with various users.
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.