The claimThrone() function in Game.sol includes a misleading comment that suggests the previous king should receive a portion of the new claim fee:
However, there is no implementation of this logic in the function. The variable previousKingPayout is declared and initialized to 0 but is never updated or used in any payout logic. As a result, the previous king receives nothing when dethroned.
Economic imbalance: Previous kings receive no compensation, reducing game incentives.
User dissatisfaction: Players expect a payout based on the comment but do not receive any ETH.
Misleading documentation: Comments and function behavior are inconsistent, which can erode trust and create confusion.
In claimThrone():
No logic exists to send ETH or credit the dethroned king.
Introduce a configurable parameter, e.g., previousKingFeePercentage, and implement the payout logic:
Also, ensure previousKingFeePercentage is initialized properly in the constructor and has an appropriate modifier for updating (e.g., onlyOwner).
N/A
Manual code review.
To validate the missing payout to the previous king, the following test function can be added to GameTest.sol:
This test validates that the dethroned player (player1) receives no payout, which confirms the missing logic and helps illustrate the bug in a reproducible environment.
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.