Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: low
Invalid

Lack of mechanism to update `totalClaims` after deployment

Summary

The current implementation does not provide a mechanism to update the totalClaims variable after deployment. Although a comment suggests that totalClaims could be modified within the resetGame function if needed, no actual code exists to support this functionality when the need arises.

Description

A comment was found in resetGame function which states that "totalClaims is cumulative across rounds, not reset here, but could be if desired." However, there's no further code implementation which enables the future desire to reset the totalClaims.

function resetGame() external onlyOwner gameEndedOnly {
currentKing = address(0);
lastClaimTime = block.timestamp;
pot = 0;
claimFee = initialClaimFee;
gracePeriod = initialGracePeriod;
gameEnded = false;
gameRound = gameRound + 1;
<@@> // totalClaims is cumulative across rounds, not reset here, but could be if desired.
emit GameReset(gameRound, block.timestamp);
}

Risk

Likelihood:

  • Shall there's a need to reset the totalClaims in the future, the owner won't be able to do such changes as no code implementation that enables the update of totalClaims

Impact:

  • Owner can only use the cumulative totalClaims for analytics purpose and won't be able to reset this value for new analytics study.

Recommended Mitigation

To add code implementation for future need to reset totalClaims as proposed below:

- function resetGame() external onlyOwner gameEndedOnly {
+ function resetGame(bool resetTotalClaims) external onlyOwner gameEndedOnly {
currentKing = address(0);
lastClaimTime = block.timestamp;
pot = 0;
claimFee = initialClaimFee;
gracePeriod = initialGracePeriod;
gameEnded = false;
gameRound = gameRound + 1;
// totalClaims is cumulative across rounds, not reset here, but could be if desired.
+ if (resetToTalClaims) {
+ totalClaims = 0;
+ }
emit GameReset(gameRound, block.timestamp);
}
Updates

Appeal created

inallhonesty Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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