Last Man Standing

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

Redundant Defensive Check for Platform Fee

Unnecessary check for platform fee in claimThrone method, reduces clarity

Description

  • The contract checks if the platform fee exceeds the available amount after previous king payout, but platformFeePercentage is already validated to be ≤ 100 and previousKingPayout is always zero.

  • This check is unnecessary and adds confusion.

// src/Game.sol
@>if (currentPlatformFee > (sentAmount - previousKingPayout)) { //@> Redundant check
currentPlatformFee = sentAmount - previousKingPayout;
}

Risk

Likelihood:

  • This occurs every time claimThrone() is called.

  • The check never triggers due to input validation.

Impact:

  • No functional impact, but reduces code clarity and maintainability.

Proof of Concept

// platformFeePercentage is always ≤ 100, so currentPlatformFee never exceeds sentAmount

Recommended Mitigation

Remove the redundant check.

- @>if (currentPlatformFee > (sentAmount - previousKingPayout)) { //@> Redundant check
- currentPlatformFee = sentAmount - previousKingPayout;
- }
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.