[H-2] The Game::claimThrone
function will always revert if called by a player who is not the current king, leading to a loss of control over the game.
The Game::claimThrone
function checks if the caller is the current king using the Game::currentKing
variable. If not, it will revert with a message indicating that the player is not the current king. This ensures that only the current king can claim the throne.
Likelihood: High
Reason 1 : A player wants to enter the game by calling claimThrone
function and pay the claimFee
.
Impact: High
Impact 1: No one can enter the game, since the Game::currentKing
variable starts at address(0)
.
(Proof of code)
The following unit test will demonstrate how the function reverts when called by a player who is not the Game::currentKing
and Game::currentKing
value is address(0)
:
Replace the strict equality with a more robust comparison, such as:
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.