The updateGracePeriod
function currently validates only that _newGracePeriod
is greater than zero. However, it lacks additional safeguards to ensure that changes to the grace period do not negatively impact fairness for players who have already participated or are in the process of claiming thrones.
The updateGracePeriod
function is restricted to the contract owner, ensuring only authorized access. However, it performs minimal validation, only checking that the new grace period value is greater than zero. This lack of comprehensive checks gives the owner significant freedom to set a new grace period that may disadvantage the currentKing. Such a change could unfairly prevent the currentKing from claiming the cumulative pot they might have otherwise won if the original grace period remained unchanged.
Likelihood:
While the function is restricted to the contract owner, the absence of strict constraints on how the grace period can be changed introduces a risk of misuse, whether intentional or accidental. If the owner does not fully consider the game’s state, they could update the grace period in a way that unfairly impacts active players. This risk increases if the contract is not governed by a transparent and timely pre-alert communication prior to any changes.
Impact:
Changing the grace period arbitrarily can significantly alter game dynamics, particularly disadvantaging the currentKing who may be close to winning the cumulative pot. Such changes can undermine player trust, create perceptions of unfairness, and potentially result in financial losses for affected players. This could also lead to reputational damage for the project and reduce user participation.
In test/Game.t.sol
, add the following test:
In terminal, run forge test --match-test test_audit_updateGracePeriodAfffectsCurrentKing -vvv
will generate the following results:
Consider to Implement additional safeguards in the updateGracePeriod
function to prevent arbitrary or unfair changes that could impact active game play such as:
add delay timeframe for the new grade period to take effect
implement pot value boundaries to prevent further update of grade period to ensure fairness to the current king
delegate the authority to a decentralized governance mechanism
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.