Skip to content

Commit

Permalink
OPCM: DepolyOPChain additional testing checks. (ethereum-optimism#12355)
Browse files Browse the repository at this point in the history
* OPCM: DepolyOPChain additional testing checks.

* fix: absolute prestate.

* fix: adding to assertions.

* fix: maxClockDuration check added.
  • Loading branch information
blmalone authored and samlaf committed Nov 10, 2024
1 parent da20f6a commit 904429b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/contracts-bedrock/scripts/DeployOPChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ contract DeployOPChainOutput is BaseDeployIO {
require(address(game.weth()) == address(delayedWETHPermissionedGameProxy()), "DPG-40");
require(address(game.anchorStateRegistry()) == address(anchorStateRegistryProxy()), "DPG-50");
require(game.l2ChainId() == _doi.l2ChainId(), "DPG-60");
require(game.l2BlockNumber() == 0, "DPG-70");
require(Duration.unwrap(game.clockExtension()) == 10800, "DPG-80");
require(Duration.unwrap(game.maxClockDuration()) == 302400, "DPG-110");
require(game.splitDepth() == 30, "DPG-90");
require(game.maxGameDepth() == 73, "DPG-100");
}

function assertValidAnchorStateRegistryProxy(DeployOPChainInput) internal {
Expand All @@ -405,6 +410,10 @@ contract DeployOPChainOutput is BaseDeployIO {
require(
address(anchorStateRegistryProxy().disputeGameFactory()) == address(disputeGameFactoryProxy()), "ANCHORP-30"
);

(Hash actualRoot,) = anchorStateRegistryProxy().anchors(GameTypes.PERMISSIONED_CANNON);
bytes32 expectedRoot = 0xdead000000000000000000000000000000000000000000000000000000000000;
require(Hash.unwrap(actualRoot) == expectedRoot, "ANCHORP-40");
}

function assertValidAnchorStateRegistryImpl(DeployOPChainInput) internal view {
Expand Down
13 changes: 13 additions & 0 deletions packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,19 @@ contract DeployOPChain_Test is DeployOPChain_TestBase {
assertEq(doo.disputeGameFactoryProxy().initBonds(GameTypes.CANNON), 0, "2700");
assertEq(doo.disputeGameFactoryProxy().initBonds(GameTypes.PERMISSIONED_CANNON), 0, "2800");

(Hash actualRoot,) = doo.anchorStateRegistryProxy().anchors(GameTypes.PERMISSIONED_CANNON);
assertEq(Hash.unwrap(actualRoot), 0xdead000000000000000000000000000000000000000000000000000000000000, "2900");
assertEq(doo.permissionedDisputeGame().l2BlockNumber(), 0, "3000");
assertEq(
Claim.unwrap(doo.permissionedDisputeGame().absolutePrestate()),
0x038512e02c4c3f7bdaec27d00edf55b7155e0905301e1a88083e4e0a6764d54c,
"3100"
);
assertEq(Duration.unwrap(doo.permissionedDisputeGame().clockExtension()), 10800, "3200");
assertEq(Duration.unwrap(doo.permissionedDisputeGame().maxClockDuration()), 302400, "3300");
assertEq(doo.permissionedDisputeGame().splitDepth(), 30, "3400");
assertEq(doo.permissionedDisputeGame().maxGameDepth(), 73, "3500");

// Most architecture assertions are handled within the OP Contracts Manager itself and therefore
// we only assert on the things that are not visible onchain.
// TODO add these assertions: AddressManager, Proxy, ProxyAdmin, etc.
Expand Down

0 comments on commit 904429b

Please sign in to comment.