Description:
The commitMove
mechanism relies on keccak256(abi.encodePacked(move, salt))
to conceal a player's move until the reveal phase. However, the contract does not enforce or validate that the salt
is unique per game or per turn. If a player reuses a salt that was revealed in a previous game, an attacker can reconstruct the commit off-chain and predict the move before the reveal.
A malicious opponent can detect repeated commit
hashes by comparing them with previous publicly revealed moves and salts.
This breaks the secrecy and fairness of the commit-reveal scheme.
Allows front-running and unfair strategic advantage to a player who monitors the chain.
➡️ This demonstrates that any previously revealed salt
and move
combination can be used to predict future plays if reused.
forge test --mt test_ReusedSaltCanBePredicted -vvvv
Enforce that each commit is unique per game and per turn using a mapping(bytes32 => bool) usedCommits
.
Reject reused commit hashes:
Recommend salts with high entropy (e.g., keccak256(abi.encodePacked(msg.sender, block.timestamp, nonce))
) on the frontend.
This ensures that even if a player accidentally reuses their salt, the contract logic prevents it and preserves fairness.
The contract does not enforce salt uniqueness
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.