Last Man Standing

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

[M-1] Precision Truncation May Lead to Platform Fee Loss and Pot Misallocation

Root + Impact

[M-1] Precision Truncation May Lead to Platform Fee Loss and Pot Misallocation

Description

In the claimThrone() function, the platform fee is calculated as:

currentPlatformFee = (sentAmount * platformFeePercentage) / 100;

This calculation involves integer division in Solidity. If sentAmount is very small (e.g., 1 wei), and platformFeePercentage is low (e.g., 1%), the result will truncate to 0 due to Solidity’s lack of decimals, causing:

1.platformFeesBalance to receive zero even though a fee is expected.

2.amountToPot to misrepresent what remains after fee deduction.

3.Event logs and game state to become inconsistent with economic expectations.

4.This becomes particularly relevant if the owner sets a low claimFee, or a user intentionally sends the minimum ETH possible to manipulate this logic.

Impact:

1.Users can circumvent platform fees by exploiting small-value claims.

2.Over time, the platform may lose significant value in micro-farming scenarios or sybil loops.

3.Fee percentage logic becomes non-deterministic at low scales, harming auditability.

Proof of Concept

1.Assume platformFeePercentage = 1 (1%)

2.Assume claimFee = 1 wei

3.A user sends 1 wei in claimThrone()

currentPlatformFee = (1 * 1) / 100 = 0; // Truncated!
No fee is collected, and entire 1 wei goes to the pot. This breaks the intended economics.

Recommended Mitigation

Enforce Minimum Claim Value:

require(msg.value >= MIN_CLAIM_THRESHOLD, "Game: Claim fee too low.");
Updates

Appeal created

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Precision loss in fee calc

Support

FAQs

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

Give us feedback!