game.revealDeadline
is not reset in function _determineWinner
when game.currentTurn < game.totalTurns
. One player can call revealMove
immediately after calling the 2nd commitMove
when block.timestamp < game.revealDeadline
.
playerA create a game by createGameWithEth
with 0.01Ether of bet, total 3 turns and 10 minutes
of timeoutInterval.
playerA joins this game.
playerB joins this game.
playerA commits a move at the first turn.
playerB commits a move at the first turn. Assume that the current block.timestamp is time0
. Then game.revealDeadline = time0 + 10 minutes
playerA reveal the move of the first turn.
palyerB reveal the move of the first turn. Then game goes to the 2nd turn.
playerA commits the 2nd move(Rock) when the current block.timestamp
is less than game.revealDeadline
.
playerA sends a transaction for revealing the 2nd move when the current block.timestamp
is less than game.revealDeadline
.
At the same time, playerB sees this transaction in the mempool. playerB commits the 2nd move(Paper) and reveals it. Then playerB wins the 2nd turn.
Frontrunning revealMove is possible at the 2nd turn or subsequent turns, which causes unfair plays.
Manual Review
forge test --mt testFrontRunRevealing -vvvv
The value of game.revealDeadline
must be reset in function _determineWinner
:
Attack allows a player to reveal their move for the next turn before the opponent commits
Attack allows a player to reveal their move for the next turn before the opponent commits
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.