Commit cb62ae37 authored by clabby's avatar clabby

Add zero claim check

parent 54ece5fe
...@@ -38,7 +38,7 @@ FaultDisputeGame_Test:test_gameStart_succeeds() (gas: 10315) ...@@ -38,7 +38,7 @@ FaultDisputeGame_Test:test_gameStart_succeeds() (gas: 10315)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8237) FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8237)
FaultDisputeGame_Test:test_initialRootClaimData_succeeds() (gas: 19522) FaultDisputeGame_Test:test_initialRootClaimData_succeeds() (gas: 19522)
FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 8225) FaultDisputeGame_Test:test_rootClaim_succeeds() (gas: 8225)
FaultDisputeGame_Test:test_simpleAttack_succeeds() (gas: 129016) FaultDisputeGame_Test:test_simpleAttack_succeeds() (gas: 129033)
FaultDisputeGame_Test:test_version_succeeds() (gas: 9736) FaultDisputeGame_Test:test_version_succeeds() (gas: 9736)
FeeVault_Test:test_constructor_succeeds() (gas: 18185) FeeVault_Test:test_constructor_succeeds() (gas: 18185)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 352135) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 352135)
......
...@@ -132,6 +132,11 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone { ...@@ -132,6 +132,11 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone {
revert GameNotInProgress(); revert GameNotInProgress();
} }
// The zero hash is not a valid claim.
if (Claim.unwrap(pivot) == bytes32(0)) {
revert InvalidClaim();
}
// The only move that can be made against a root claim is an attack. This is because the // The only move that can be made against a root claim is an attack. This is because the
// root claim commits to the entire state; Therefore, the only valid defense is to do // root claim commits to the entire state; Therefore, the only valid defense is to do
// nothing if it is agreed with. // nothing if it is agreed with.
......
...@@ -39,6 +39,11 @@ error CannotDefendRootClaim(); ...@@ -39,6 +39,11 @@ error CannotDefendRootClaim();
*/ */
error ClaimAlreadyExists(); error ClaimAlreadyExists();
/**
* @notice Thrown when a given claim is invalid (0).
*/
error InvalidClaim();
/** /**
* @notice Thrown when an action that requires the game to be `IN_PROGRESS` is invoked when * @notice Thrown when an action that requires the game to be `IN_PROGRESS` is invoked when
* the game is not in progress. * the game is not in progress.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment