The expected behavior is that a player can claim the throne as long as they are not the current king, allowing the game to progress normally.
The issue is that the condition require(msg.sender == currentKing, ...)
forces the caller to be the current king to proceed, which contradicts the intended logic. This causes the function to revert when the caller is not the king. Moreover, the revert message does not match the condition, causing confusion.
Likelihood:
Occurs whenever a player tries to claim the throne and is not the current king, which is the normal use case.
Occurs immediately after deployment when currentKing
is the zero address, preventing anyone from claiming the throne initially.
Impact:
Blocks normal game progression by preventing legitimate throne claims.
Confuses users and developers due to contradictory revert messages and faulty logic.
Could cause a denial of service on the game’s core functionality, effectively freezing part of the contract.
This PoC demonstrates that, starting from the initial state where no king is set, any attempt to claim the throne reverts due to the faulty require condition, effectively blocking gameplay.
Changing the condition to require that the caller is not already the current king ensures that the function only reverts when a player tries to claim the throne they already hold, enabling normal gameplay progression.
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.