Skip to content

Commit

Permalink
remove blacklist check in getAnchorRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
wildmolasses committed Feb 6, 2025
1 parent 192e511 commit 02d5a02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ contract AnchorStateRegistry is Initializable, ISemver {
return (startingAnchorRoot.root, startingAnchorRoot.l2BlockNumber);
}

if (isGameBlacklisted(anchorGame)) {
revert AnchorStateRegistry_AnchorGameBlacklisted();
}

// Otherwise, return the anchor root.
return (Hash.wrap(anchorGame.rootClaim().raw()), anchorGame.l2BlockNumber());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ contract AnchorStateRegistry_GetAnchorRoot_Test is AnchorStateRegistry_Init {
assertEq(root.raw(), gameProxy.rootClaim().raw());
assertEq(l2BlockNumber, gameProxy.l2BlockNumber());
}
}

contract AnchorStateRegistry_GetAnchorRoot_TestFail is AnchorStateRegistry_Init {
/// @notice Tests that getAnchorRoot will revert if the anchor game is blacklisted.
function test_getAnchorRoot_blacklistedGame_fails() public {
/// @notice Tests that getAnchorRoot returns even if the anchor game is blacklisted.
function test_getAnchorRoot_blacklistedGame_succeeds() public {
// Mock the game to be resolved.
vm.mockCall(address(gameProxy), abi.encodeCall(gameProxy.resolvedAt, ()), abi.encode(block.timestamp));
vm.warp(block.timestamp + optimismPortal2.disputeGameFinalityDelaySeconds() + 1);
Expand All @@ -116,8 +114,11 @@ contract AnchorStateRegistry_GetAnchorRoot_TestFail is AnchorStateRegistry_Init
abi.encodeCall(optimismPortal2.disputeGameBlacklist, (gameProxy)),
abi.encode(true)
);
vm.expectRevert(IAnchorStateRegistry.AnchorStateRegistry_AnchorGameBlacklisted.selector);
anchorStateRegistry.getAnchorRoot();

// Get the anchor root.
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.getAnchorRoot();
assertEq(root.raw(), gameProxy.rootClaim().raw());
assertEq(l2BlockNumber, gameProxy.l2BlockNumber());
}
}

Expand Down

0 comments on commit 02d5a02

Please sign in to comment.