Normally, the claimThrone()
function should allow any user who is not the current king to claim the throne by meeting the required conditions (e.g., sending enough ETH, etc.).
However, the condition require(msg.sender == currentKing)
is incorrectly implemented. This logic only allows the current king to reclaim the throne, defeating the purpose of a game mechanic where others compete to become the new king. The check should instead prevent the current king from reclaiming their own throne.
Likelihood:
This will always occur when any user tries to claim the throne and they are not the current king.
The contract logic enforces a false precondition that contradicts the intended functionality.
Impact:
No new user can ever claim the throne, rendering the core mechanic of the game useless.
The contract becomes entirely non-functional in its intended context, potentially locking up funds and making it unusable.
The following Foundry test demonstrates that new players are unable to claim the throne due to the incorrect logic in the require
statement.
To fix the logic error and restore the correct behavior of the game, update the require
condition to reject the current king and allow new players to claim the throne.
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.