Last Man Standing

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

Inconsistent Grace Period After Reset

Description:
The owner can update gracePeriod mid-round, but only gracePeriod (not initialGracePeriod) is changed. After resetGame(), gracePeriod reverts to the old initialGracePeriod, ignoring the owner’s update.

Impact:

  • Confusing UX: Players see a changed grace period one round but revert the next, breaking expectations.

  • Owner Frustration: Cannot permanently change grace period across rounds.

Proof of Concept: Add the following test to the 'Game.t.sol':

function testResetGracePeriod() public {
// Owner updates gracePeriod to 2 days
vm.prank(deployer);
game.updateGracePeriod(2 days);
assertEq(game.gracePeriod(), 2 days);
// Would need to fix the contract first (incorrect king validation logic), but this demonstrates the vulnerability
// player1 becomes king
vm.prank(player1);
game.claimThrone{value: INITIAL_CLAIM_FEE}();
// Simulate end of game
vm.warp(block.timestamp + 3 days);
// Declare and reset
game.declareWinner();
vm.prank(deployer);
game.resetGame();
// Grace period has reverted to original 1 day
assertEq(game.gracePeriod(), 1 days);
}

Mitigation:
Also update initialGracePeriod:

function updateGracePeriod(uint256 _newGracePeriod) external onlyOwner {
require(_newGracePeriod > 0, "Game: New grace period must be greater than zero.");
+ initialGracePeriod = _newGracePeriod;
emit GracePeriodUpdated(_newGracePeriod);
}
Updates

Appeal created

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

Grace period upgrade is not persistent after reset.

Support

FAQs

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

Give us feedback!