Skip to content

Commit 3d73ef3

Browse files
address wildmolasses comments
1 parent 6891d32 commit 3d73ef3

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

packages/contracts-bedrock/test/dispute/AnchorStateRegistry.t.sol

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,11 @@ contract AnchorStateRegistry_TryUpdateAnchorState_Test is AnchorStateRegistry_In
286286
IFaultDisputeGame anchorGame = anchorStateRegistry.anchorGame();
287287
assertEq(address(anchorGame), address(gameProxy));
288288
}
289-
}
290289

291-
contract AnchorStateRegistry_TryUpdateAnchorState_TestFail is AnchorStateRegistry_Init {
292-
/// @notice Tests that tryUpdateAnchorState will revert if the game is valid and the game block
290+
/// @notice Tests that tryUpdateAnchorState will not update the anchor state if the game block
293291
/// number is less than or equal to the current anchor root block number.
294292
/// @param _l2BlockNumber The L2 block number to use for the game.
295-
function testFuzz_tryUpdateAnchorState_validOlderState_fails(uint256 _l2BlockNumber) public {
293+
function testFuzz_tryUpdateAnchorState_validOlderStateNoUpdate_succeeds(uint256 _l2BlockNumber) public {
296294
// Grab block number of the existing anchor root.
297295
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.getAnchorRoot();
298296

@@ -324,9 +322,10 @@ contract AnchorStateRegistry_TryUpdateAnchorState_TestFail is AnchorStateRegistr
324322
assertEq(updatedRoot.raw(), root.raw());
325323
}
326324

327-
/// @notice Tests that tryUpdateAnchorState will revert if the game is not registered.
325+
/// @notice Tests that tryUpdateAnchorState will not update the anchor state if the game is not
326+
/// registered.
328327
/// @param _l2BlockNumber The L2 block number to use for the game.
329-
function testFuzz_tryUpdateAnchorState_notFactoryRegisteredGame_fails(uint256 _l2BlockNumber) public {
328+
function testFuzz_tryUpdateAnchorState_notFactoryRegisteredGameNoUpdate_succeeds(uint256 _l2BlockNumber) public {
330329
// Grab block number of the existing anchor root.
331330
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.getAnchorRoot();
332331

@@ -367,10 +366,10 @@ contract AnchorStateRegistry_TryUpdateAnchorState_TestFail is AnchorStateRegistr
367366
assertEq(updatedRoot.raw(), root.raw());
368367
}
369368

370-
/// @notice Tests that tryUpdateAnchorState will revert if the game is valid and the game status
369+
/// @notice Tests that tryUpdateAnchorState will not update the anchor state if the game status
371370
/// is CHALLENGER_WINS.
372371
/// @param _l2BlockNumber The L2 block number to use for the game.
373-
function testFuzz_tryUpdateAnchorState_challengerWins_fails(uint256 _l2BlockNumber) public {
372+
function testFuzz_tryUpdateAnchorState_challengerWinsNoUpdate_succeeds(uint256 _l2BlockNumber) public {
374373
// Grab block number of the existing anchor root.
375374
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.getAnchorRoot();
376375

@@ -402,10 +401,10 @@ contract AnchorStateRegistry_TryUpdateAnchorState_TestFail is AnchorStateRegistr
402401
assertEq(updatedRoot.raw(), root.raw());
403402
}
404403

405-
/// @notice Tests that tryUpdateAnchorState will revert if the game is valid and the game status
404+
/// @notice Tests that tryUpdateAnchorState will not update the anchor state if the game status
406405
/// is IN_PROGRESS.
407406
/// @param _l2BlockNumber The L2 block number to use for the game.
408-
function testFuzz_tryUpdateAnchorState_inProgress_fails(uint256 _l2BlockNumber) public {
407+
function testFuzz_tryUpdateAnchorState_inProgressNoUpdate_succeeds(uint256 _l2BlockNumber) public {
409408
// Grab block number of the existing anchor root.
410409
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.getAnchorRoot();
411410

@@ -437,10 +436,10 @@ contract AnchorStateRegistry_TryUpdateAnchorState_TestFail is AnchorStateRegistr
437436
assertEq(updatedRoot.raw(), root.raw());
438437
}
439438

440-
/// @notice Tests that tryUpdateAnchorState will revert if the game is valid and the game type
439+
/// @notice Tests that tryUpdateAnchorState will not update the anchor state if the game type
441440
/// is not the respected game type.
442441
/// @param _l2BlockNumber The L2 block number to use for the game.
443-
function testFuzz_tryUpdateAnchorState_notRespectedGameType_fails(uint256 _l2BlockNumber) public {
442+
function testFuzz_tryUpdateAnchorState_notRespectedGameTypeNoUpdate_succeeds(uint256 _l2BlockNumber) public {
444443
// Grab block number of the existing anchor root.
445444
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.anchors(gameProxy.gameType());
446445

@@ -468,10 +467,10 @@ contract AnchorStateRegistry_TryUpdateAnchorState_TestFail is AnchorStateRegistr
468467
assertEq(updatedRoot.raw(), root.raw());
469468
}
470469

471-
/// @notice Tests that tryUpdateAnchorState will revert if the game is valid and the game is
470+
/// @notice Tests that tryUpdateAnchorState will not update the anchor state if the game is
472471
/// blacklisted.
473472
/// @param _l2BlockNumber The L2 block number to use for the game.
474-
function testFuzz_tryUpdateAnchorState_blacklistedGame_fails(uint256 _l2BlockNumber) public {
473+
function testFuzz_tryUpdateAnchorState_blacklistedGameNoUpdate_succeeds(uint256 _l2BlockNumber) public {
475474
// Grab block number of the existing anchor root.
476475
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.getAnchorRoot();
477476

@@ -510,10 +509,10 @@ contract AnchorStateRegistry_TryUpdateAnchorState_TestFail is AnchorStateRegistr
510509
assertEq(updatedRoot.raw(), root.raw());
511510
}
512511

513-
/// @notice Tests that tryUpdateAnchorState will revert if the game is valid and the game is
512+
/// @notice Tests that tryUpdateAnchorState will not update the anchor state if the game is
514513
/// retired.
515514
/// @param _l2BlockNumber The L2 block number to use for the game.
516-
function testFuzz_tryUpdateAnchorState_retiredGame_fails(uint256 _l2BlockNumber) public {
515+
function testFuzz_tryUpdateAnchorState_retiredGameNoUpdate_succeeds(uint256 _l2BlockNumber) public {
517516
// Grab block number of the existing anchor root.
518517
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.getAnchorRoot();
519518

@@ -561,9 +560,6 @@ contract AnchorStateRegistry_SetAnchorState_Test is AnchorStateRegistry_Init {
561560
// Mock the l2BlockNumber call.
562561
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.l2BlockNumber, ()), abi.encode(_l2BlockNumber));
563562

564-
// Mock the l2BlockNumber call.
565-
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.l2BlockNumber, ()), abi.encode(_l2BlockNumber));
566-
567563
// Mock the DEFENDER_WINS state.
568564
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.status, ()), abi.encode(GameStatus.DEFENDER_WINS));
569565

@@ -732,9 +728,6 @@ contract AnchorStateRegistry_SetAnchorState_TestFail is AnchorStateRegistry_Init
732728
// Mock the l2BlockNumber call.
733729
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.l2BlockNumber, ()), abi.encode(_l2BlockNumber));
734730

735-
// Mock the l2BlockNumber call.
736-
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.l2BlockNumber, ()), abi.encode(_l2BlockNumber));
737-
738731
// Mock the DEFENDER_WINS state.
739732
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.status, ()), abi.encode(GameStatus.DEFENDER_WINS));
740733

@@ -772,9 +765,6 @@ contract AnchorStateRegistry_SetAnchorState_TestFail is AnchorStateRegistry_Init
772765
// Mock the l2BlockNumber call.
773766
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.l2BlockNumber, ()), abi.encode(_l2BlockNumber));
774767

775-
// Mock the l2BlockNumber call.
776-
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.l2BlockNumber, ()), abi.encode(_l2BlockNumber));
777-
778768
// Mock the DEFENDER_WINS state.
779769
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.status, ()), abi.encode(GameStatus.DEFENDER_WINS));
780770

0 commit comments

Comments
 (0)