Last Man Standing

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

Game Incentives Broken Due to Missing Previous King Compensation

Description

In the claimThrone() function, the intended behavior is to reward the previous king with a portion of the fee when a new king claims the throne. However, no such transfer occurs — the amount (previousKingReward) is hardcoded to zero:

This results in no ETH being sent to the dethroned king, violating the game's fairness .

uint256 previousKingPayout = 0; //! previous king get nothing
uint256 currentPlatformFee = 0; // ! its also zero

Risk :

  • Medium

Likelihood:

  • This occurs every time a new player successfully calls claimThrone() and becomes the king.

  • The previous king is always denied the expected compensation, which can be easily observed on-chain and exploited to game the system.

Impact:

  • Violates game fairness. (no incentive to be king).

  • Reduces trust in the system for real users.

  • Enables malicious frontrunning behavior — attackers can grief by repeatedly stealing the throne without loss.

Proof of Concept

  • Assume player 1 is the currentKing

  • player2 came and claim the throne

  • there is no tracking of sharing portion to previous king its hardcoded to zero;


Further issues :


  • Previous king receives nothing:

    • previousKingPayout = 0, and no transfer is made.

    • This breaks the incentive loop that is core to the throne game design.

  • Platform receives nothing:

    • currentPlatformFee = 0, and is added to the platform balance.

    • The code contains a dead check:

      if (currentPlatformFee > (sentAmount - previousKingPayout)) { currentPlatformFee = sentAmount - previousKingPayout; }

      * Since both variables are `0`, this check **never triggers** and is **meaningless**.
  • Pot receives all the ETH:

    • amountToPot = sentAmount - currentPlatformFee → always equals full sentAmount.

    • This causes the pot to grow unnaturally fast with no real fee deductions.


Recommended Mitigation

  • Add logic to give incentives to the previous king

  • Remve Hardcoded currentPlatFormFee


Updates

Appeal created

inallhonesty Lead Judge 30 days 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.