Last Man Standing

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

Insufficient Increment in claimFee for Very Small Initial Values Causing Fee Stagnation

Root + Impact

Description

  • The claimFee is designed to increase by a fixed percentage (feeIncreasePercentage) after each successful throne claim to incentivize progressively higher stakes.

  • However, when the initial claimFee is set to a very small value (e.g., below 100 / feeIncreasePercentage wei), the calculated fee increment (claimFee * feeIncreasePercentage) / 100 evaluates to zero due to integer division rounding.

  • As a result, the claimFee remains constant across claims, breaking the intended progressive increase mechanic.

// Increment calculation in claimThrone()
@》claimFee = claimFee + (claimFee * feeIncreasePercentage) / 100;

Risk

Likelihood:

  • This issue only manifests if the initial claimFee is configured with a very small value, which is unlikely under typical deployment parameters.

Impact:

  • The stagnation of the claimFee breaks the game's economic design by allowing players to claim the throne repeatedly at a fixed minimal cost, potentially impacting user incentives and gameplay fairness.

Proof of Concept

Deploy the contract with an initial claimFee of 1 wei and a feeIncreasePercentage of 10.

After a player successfully calls claimThrone() by sending 1 wei, observe that the claimFee remains 1 wei due to rounding of the increment to zero.

function testClaimFeeDoesNotIncreaseDueToRounding() public {
vm.startPrank(player1);
uint256 feeBefore = game.claimFee();
console2.log("",feeBefore);
// Player1 claims throne by sending 1 wei (minimum claimFee)
game.claimThrone{value: 1}();
uint256 feeAfter = game.claimFee();
console2.log("",feeAfter);
// Because (1 * 10)/100 = 0 (integer division), feeAfter == feeBefore expected
assertEq(feeAfter, feeBefore, "claimFee should not increase due to rounding");
vm.stopPrank();
}

Recommended Mitigation

Implement a minimum increment logic to guarantee the claimFee increases by at least 1 wei per claim:

Alternatively, enforce a reasonable lower bound on the initial claimFee during contract deployment to prevent values that would cause zero increments.

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 2 months ago

Appeal created

inallhonesty Lead Judge about 2 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.