player1
claims the throne half a day after the game starts, so there should be only half a day left to call declareWinner()
.
However, after 0.75 days (three-quarters of a day), when player1
tries to declare the winner, they're surprised that the game has not ended yet.
But before running the test, you need to correct this issue in claimThrone()
:
Add this test to Game.t.sol
:
This will throw:
"Grace period has not expired yet."
Use the fixed startGame
timestamp instead of lastClaimTime
to check if the grace period has passed:
This ensures the game ends relative to when it started not based on throne claims.
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.