The claimThrone()
function fails to validate whether the grace period has expired before allowing new throne claims. This creates a critical vulnerability where legitimate winners can have their victory stolen by late claimants.
The current claimThrone()
implementation only checks:
The function lacks validation that block.timestamp < lastClaimTime + gracePeriod
, allowing throne claims even after the current king should have already won.
Alice claims throne: Calls claimThrone()
and becomes currentKing
at timestamp 1000
Grace period passes: Grace period of 3600
seconds expires at timestamp 4600
Alice is rightful winner: According to game rules, Alice should win the pot
No winner declaration: No one calls declareWinner()
Bob steals victory: At timestamp 4700
, Bob calls claimThrone()
and successfully becomes the new king
Alice loses rightfully won prize: Alice's legitimate victory window is bypassed
Legitimate winners lose rightfully earned prizes to late attackers
Fundamental game mechanics are broken - grace periods become meaningless
Change this line in claimThore()
for sucessful test run
Put this into Game.t.sol
file and run forge test --mt testEnterTheGameAfterGracePeriod -vvv
in the terminal
Add grace period validation to the claimThrone()
function to prevent claims after expiration:
This ensures that:
Once the grace period expires, no new throne claims are possible
declareWinner()
must be called to properly end the game
Legitimate winners cannot have their victories stolen
Game rules are consistently enforced
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.