Last Man Standing

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

Missing Previous King Payout Breaks Reward Mechanism in `claimThrone()`

Root + Impact

Description

The function comment states: "If there's a previous king, a small portion of the new claim fee is sent to them." However, the implementation doesn't actually pay out to the previous king.

Risk

Likelihood:

  • This will always happen whenever a new player claims the throne after someone else — the previous king is never rewarded.

  • The issue is systemic and tied directly to how the claim logic is structured, meaning it affects every throne transition.

Impact:

  • Breaks the core reward system of the contract — players are not incentivized to become king if they don’t earn anything after being dethroned.

  • Damages user trust and game dynamics; may cause players to abandon the game or never participate at all.

Proof of Concept

The following Foundry test demonstrates that the previous king does not receive any payout when a new player claims the throne:

function testMissingPreviousKingPayout() public {
// First player claims the throne
vm.startPrank(player1);
uint256 player1InitialBalance = player1.balance;
game.claimThrone{value: INITIAL_CLAIM_FEE}();
uint256 player1BalanceAfterClaim = player1.balance;
vm.stopPrank();
// Verify player1's balance decreased by the claim fee
assertEq(
player1InitialBalance - player1BalanceAfterClaim,
INITIAL_CLAIM_FEE,
"Player1 balance should decrease by claim fee"
);
// Get the updated claim fee for the next player
uint256 nextClaimFee = game.claimFee();
// Second player claims the throne
vm.startPrank(player2);
uint256 player1BalanceBeforeSecondClaim = player1.balance;
game.claimThrone{value: nextClaimFee}();
uint256 player1BalanceAfterSecondClaim = player1.balance;
vm.stopPrank();
// Previous king (player1) should have received a portion of player2's claim fee
// But in reality, no payout happens
assertEq(
player1BalanceAfterSecondClaim,
player1BalanceBeforeSecondClaim,
"Previous king should not have received any payout"
);
// If previous king payout was implemented correctly, player1's balance would have increased
// But it remains unchanged, proving the payout logic is missing
}
Updates

Appeal created

inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

Missing Previous King Payout Functionality

Support

FAQs

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