The function contains a flawed assertion: require(msg.sender == currentKing, "...");
. This condition is logically inverted.
Impact:
This bug prevents any player from successfully claiming the throne when the game starts. At initialization, currentKing
is set to address(0)
. Since no player can have the address 0x0
, the condition msg.sender == currentKing
will never be true, causing the transaction to revert with the message "Game: You are already the king. No need to re-claim." This effectively locks the game at launch, making it impossible for anyone to become the first king.
Admin deploys the contract.
Player player1
calls the claimThrone
function.
Transaction reverts due to the incorrect require statement.
The condition should be corrected to ensure that a player cannot claim the throne if they are already the king. The fix is to use !=
instead of ==
:
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.