Describe the normal behavior in one or more sentences
In a "King of the Hill" game, any player should be able to challenge the current king by sending ETH to become the new king, while the current king should be prevented from reclaiming the throne unnecessarily.
Explain the specific issue or problem in one or more sentences
The claimThrone()
function in the Game
contract contains logic that only allows the current king to claim the throne (msg.sender == currentKing
). However, since the contract initializes with currentKing = address(0)
and no user can ever have msg.sender == address(0)
, the function will always revert for every player from the very first call. This makes the entire contract completely non-functional from deployment.
Affected Function: claimThrone()
in the Game
contract
Likelihood:
This bug occurs on every single call to claimThrone()
from the moment the contract is deployed, making it 100% reproducible with zero exceptions
The contract initializes with currentKing = address(0)
and no user can ever have this address as msg.sender
, making the bug mathematically impossible to avoid
Impact:
Complete contract failure - the protocol is entirely non-functional from deployment and no user can ever interact with its core functionality.
Total economic loss for deployers and complete waste of deployment costs, as the contract serves no purpose and generates zero revenue
The test demonstrates that the contract is completely non-functional from deployment. Since currentKing
initializes to address(0)
and no user can ever have msg.sender == address(0)
, the require statement will always fail for every player attempting to claim the throne.
The test demonstrates that the contract is completely non-functional from deployment. Since currentKing
initializes to address(0)
and no user can ever have msg.sender == address(0)
, the require statement will always fail for every player attempting to claim the throne.
Change the boolean logic in the require statement to allow players other than the current king to claim the throne:
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.