The game is designed around the core mechanic of players claiming the throne from one another. The claimThrone()
function is the only entry point for a user to become the "King".
However, a critical logical error in a require
statement within this function makes it impossible for any player to ever become the king. The check incorrectly requires the caller (msg.sender
) to already be the current king, which is an impossible condition for any new claimant, including the very first one when the king is address(0)
. This flaw completely bricks the contract from the moment of deployment, making the entire game unusable.
Likelihood: High
This error is triggered by the very first attempt of any player to interact with the game's core function. It is a guaranteed failure condition in every game round.
Impact: Critical
Complete Denial of Service: The contract's primary functionality is permanently broken. No game can ever be started or played.
Contract is Unusable: The contract fails to fulfill its fundamental purpose. All other functions related to the game's lifecycle (declareWinner
, resetGame
, etc.) are unreachable because a king can never be established.
Gas Waste for All Users: Any user attempting to play the game by calling claimThrone()
will have their transaction reverted, causing them to lose gas for no reason.
The following Foundry test demonstrates that even the very first player's attempt to claim the throne fails, proving the game is unplayable from the start.
To run this test:
Create a file named GameUnplayable.t.sol
in your test
directory.
Paste the code above.
Run forge test --match-path test/GameUnplayable.t.sol
. The test will [PASS], confirming the revert
.
The logical check must be inverted from ==
to !=
to allow a new player to claim the throne, while preventing the current king from reclaiming it from themselves.
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.