First, player1
claims the throne, and if no one calls declareWinner()
, the game will not end. This leads to player2
being able to call claimThrone()
even a whole day after the gracePeriod
finished.
But before running the test, you need to correct this issue in claimThrone()
:
Then, add one of these tests to Game.t.sol
:
When someone tries to claim the throne two days after the game starts.
This test will pass because no one called declareWinner()
:
But this test will fail and throw "Game has already ended. Reset to play again."
because someone called declareWinner()
:
run:
forge test --match-test testclaimThrone2 -vv
You can update the gameEnded
flag inside claimThrone()
,
or check if the gracePeriod
has already ended or not inside claimThrone()
.
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.