The claimThrone()
function is intended to allow a player to become the currentKing
by sending a fee. However, the function incorrectly requires that the caller (msg.sender
) must already be the currentKing
. When the game starts, currentKing
is initialized to address(0)
. Since no user can have this address, this check will always fail for the first player attempting to start the game.
A player should be able to claim the throne by sending the required claimFee
.
However, the access control in claimThrone()
is implemented incorrectly, preventing anyone from starting the game.
Likelihood:
The faulty require
statement is evaluated on every initial call to claimThrone()
.
This condition will always fail for the first player, making it a certainty that the game cannot be started.
Impact:
The core gameplay mechanic is fundamentally broken.
The contract's primary function is unusable, rendering the entire game unplayable.
The following test demonstrates that a player cannot claim the throne when the game starts.
The test will revert because currentKing
is address(0)
by default, and msg.sender
(player1
) is not address(0)
. The require(msg.sender == currentKing)
check fails, but with a misleading error message.
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.