Game.sol
No one is able to claim the throne due logical errorA critical logical error in the Game.sol::claimThrone
function prevents any user from successfully claiming the throne effectively making the game unplayable.
This condition allows only the current king to proceed, which is the opposite of the intended logic. According to the game rules, the current king should NOT be allowed to reclaim the throne. The check should prevent re-claims by the same address, not enforce them.
As a result:
When the contract is first deployed (currentKing == address(0)
), any attempt to claim the throne fails because the user is not the king.
Even when the throne has not been claimed yet, no address can ever succeed, because the check only allows the current king to proceed, which defeats the purpose.
Likelihood: HIGH
Every time when someone is trying to claim the throne. Even when the king has never been set to a player
Impact: HIGH
Makes the Game unplayable for everyone.
This require stateme checks whether the user is a king, if so than only proceeds to further execution which is totally opposite of what protocol has intended to which not letting king to re claim the throne. In this case, it will revert with the error. Paste the following code inside the Game.t.sol
Apply this changes to overcome the issue inside the Game.sol::claimThrone
function.
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.