claimThrone should be able to be called by any user, EXCEPT the current king
The current behaviour is the inverse, where ONLY the current king can call claimThrone
Likelihood: High
This happens for every user every time they call claimThrone
Initially the currentKing is the zero-address, meaning no one can call claimThrone
Impact: High
This function is a core functionality of the contract
Without this function, the whole game becomes unusable, resulting in no-one being able to claim the throne and become a winner
The only way to fix this after deployment is to redeploy the contract, which is a major inconvenience and a waste of gas
To validate the issue, we can run the following test (with the default setup as per Game.t.sol)
logs
As shown in the logs, the throne is never claimed, and the function is reverted with "Game: You are already the king. No need to re-claim"
The issue involves a simple fix by reverting the == check in the require statement to !=. This will correctly check to ensure the caller is not the current king.
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.