Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Incorrect require Statement Prevents Throne Claiming in `Game.sol::claimThrone` function


The `claimThrone()` function incorrectly uses the following check:
```javascript
require(msg.sender == currentKing, "Game: You are already the king. No need to re-claim.");
```
- This logic enforces that only the current king can call `claimThrone()`,
which defeats the purpose of the game where new players are supposed to challenge the king** by sending more ETH.
The message suggests that it’s meant to prevent the same address from reclaiming the throne,
but the logic does the opposite: it **only allows the current king to re-claim.
- This breaks the game by not letting new challengers participate.


Risk


Impact:

1. Game Dynamics: Breaks player competition by locking the throne
2. Funds Stuck: No one can increase the pot, game is frozen
3. User Frustration: Players cannot participate even with higher bid

Proof of Concept

```javascript
// Assume currentKing is Alice
address currentKing = alice;
// Bob (a new player) tries to claim the throne
claimThrone{value: 2 ether}(); // from Bob's address
// This fails because Bob != currentKing
require(msg.sender == currentKing, "Game: You are already the king.");
```
-> Expected behavior: Bob should be allowed to claim the throne if he sends more ETH than the current king.
-> Actual behavior: Only Alice can call the function, defeating the purpose of competitive king-of-the-hill dynamics.

Recommended Mitigation

```diff
function claimThrone() external payable gameNotEnded nonReentrant {
require(msg.value >= claimFee, "Game: Insufficient ETH sent to claim the throne.");
- require(msg.sender == currentKing, "Game: You are already the king. No need to re-claim.");
+ require(msg.sender != currentKing, "Game: You are already the king. No need to re-claim.");
// remaining code
```
Updates

Appeal created

inallhonesty Lead Judge 17 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Game::claimThrone `msg.sender == currentKing` check is busted

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.