diff --git a/packages/contracts-bedrock/scripts/DeployOPChain.s.sol b/packages/contracts-bedrock/scripts/DeployOPChain.s.sol index f88469b7ead5..ca5d1151a9d9 100644 --- a/packages/contracts-bedrock/scripts/DeployOPChain.s.sol +++ b/packages/contracts-bedrock/scripts/DeployOPChain.s.sol @@ -247,35 +247,6 @@ contract DeployOPChainOutput is BaseDeployIO { // forgefmt: disable-end } - function checkOutput(DeployOPChainInput _doi) public { - // With 16 addresses, we'd get a stack too deep error if we tried to do this inline as a - // single call to `Solarray.addresses`. So we split it into two calls. - address[] memory addrs1 = Solarray.addresses( - address(_opChainProxyAdmin), - address(_addressManager), - address(_l1ERC721BridgeProxy), - address(_systemConfigProxy), - address(_optimismMintableERC20FactoryProxy), - address(_l1StandardBridgeProxy), - address(_l1CrossDomainMessengerProxy) - ); - address[] memory addrs2 = Solarray.addresses( - address(_optimismPortalProxy), - address(_disputeGameFactoryProxy), - address(_anchorStateRegistryProxy), - address(_anchorStateRegistryImpl), - // address(_faultDisputeGame), - address(_permissionedDisputeGame), - address(_delayedWETHPermissionedGameProxy) - ); - // TODO: Eventually switch from Permissioned to Permissionless. Add this address back in. - // address(_delayedWETHPermissionlessGameProxy) - - DeployUtils.assertValidContractAddresses(Solarray.extend(addrs1, addrs2)); - - assertValidDeploy(_doi); - } - function opChainProxyAdmin() public view returns (IProxyAdmin) { DeployUtils.assertValidContractAddress(address(_opChainProxyAdmin)); return _opChainProxyAdmin; @@ -360,27 +331,130 @@ contract DeployOPChainOutput is BaseDeployIO { // DeployUtils.assertValidContractAddress(address(_delayedWETHPermissionlessGameProxy)); return _delayedWETHPermissionlessGameProxy; } +} - // -------- Deployment Assertions -------- +contract DeployOPChain is Script { + // -------- Core Deployment Methods -------- - function assertValidDeploy(DeployOPChainInput _doi) internal { - assertValidAnchorStateRegistryImpl(_doi); - assertValidAnchorStateRegistryProxy(_doi); - assertValidDelayedWETH(_doi); - assertValidDisputeGameFactory(_doi); - assertValidL1CrossDomainMessenger(_doi); - assertValidL1ERC721Bridge(_doi); - assertValidL1StandardBridge(_doi); - assertValidOptimismMintableERC20Factory(_doi); - assertValidOptimismPortal(_doi); - assertValidPermissionedDisputeGame(_doi); - assertValidSystemConfig(_doi); - assertValidAddressManager(_doi); - assertValidOPChainProxyAdmin(_doi); - } - - function assertValidPermissionedDisputeGame(DeployOPChainInput _doi) internal { - IPermissionedDisputeGame game = permissionedDisputeGame(); + function run(DeployOPChainInput _doi, DeployOPChainOutput _doo) public { + OPContractsManager opcmProxy = _doi.opcmProxy(); + + OPContractsManager.Roles memory roles = OPContractsManager.Roles({ + opChainProxyAdminOwner: _doi.opChainProxyAdminOwner(), + systemConfigOwner: _doi.systemConfigOwner(), + batcher: _doi.batcher(), + unsafeBlockSigner: _doi.unsafeBlockSigner(), + proposer: _doi.proposer(), + challenger: _doi.challenger() + }); + OPContractsManager.DeployInput memory deployInput = OPContractsManager.DeployInput({ + roles: roles, + basefeeScalar: _doi.basefeeScalar(), + blobBasefeeScalar: _doi.blobBaseFeeScalar(), + l2ChainId: _doi.l2ChainId(), + startingAnchorRoots: _doi.startingAnchorRoots(), + saltMixer: _doi.saltMixer(), + gasLimit: _doi.gasLimit(), + disputeGameType: _doi.disputeGameType(), + disputeAbsolutePrestate: _doi.disputeAbsolutePrestate(), + disputeMaxGameDepth: _doi.disputeMaxGameDepth(), + disputeSplitDepth: _doi.disputeSplitDepth(), + disputeClockExtension: _doi.disputeClockExtension(), + disputeMaxClockDuration: _doi.disputeMaxClockDuration() + }); + + vm.broadcast(msg.sender); + OPContractsManager.DeployOutput memory deployOutput = opcmProxy.deploy(deployInput); + + vm.label(address(deployOutput.opChainProxyAdmin), "opChainProxyAdmin"); + vm.label(address(deployOutput.addressManager), "addressManager"); + vm.label(address(deployOutput.l1ERC721BridgeProxy), "l1ERC721BridgeProxy"); + vm.label(address(deployOutput.systemConfigProxy), "systemConfigProxy"); + vm.label(address(deployOutput.optimismMintableERC20FactoryProxy), "optimismMintableERC20FactoryProxy"); + vm.label(address(deployOutput.l1StandardBridgeProxy), "l1StandardBridgeProxy"); + vm.label(address(deployOutput.l1CrossDomainMessengerProxy), "l1CrossDomainMessengerProxy"); + vm.label(address(deployOutput.optimismPortalProxy), "optimismPortalProxy"); + vm.label(address(deployOutput.disputeGameFactoryProxy), "disputeGameFactoryProxy"); + vm.label(address(deployOutput.anchorStateRegistryProxy), "anchorStateRegistryProxy"); + vm.label(address(deployOutput.anchorStateRegistryImpl), "anchorStateRegistryImpl"); + // vm.label(address(deployOutput.faultDisputeGame), "faultDisputeGame"); + vm.label(address(deployOutput.permissionedDisputeGame), "permissionedDisputeGame"); + vm.label(address(deployOutput.delayedWETHPermissionedGameProxy), "delayedWETHPermissionedGameProxy"); + // TODO: Eventually switch from Permissioned to Permissionless. + // vm.label(address(deployOutput.delayedWETHPermissionlessGameProxy), "delayedWETHPermissionlessGameProxy"); + + _doo.set(_doo.opChainProxyAdmin.selector, address(deployOutput.opChainProxyAdmin)); + _doo.set(_doo.addressManager.selector, address(deployOutput.addressManager)); + _doo.set(_doo.l1ERC721BridgeProxy.selector, address(deployOutput.l1ERC721BridgeProxy)); + _doo.set(_doo.systemConfigProxy.selector, address(deployOutput.systemConfigProxy)); + _doo.set( + _doo.optimismMintableERC20FactoryProxy.selector, address(deployOutput.optimismMintableERC20FactoryProxy) + ); + _doo.set(_doo.l1StandardBridgeProxy.selector, address(deployOutput.l1StandardBridgeProxy)); + _doo.set(_doo.l1CrossDomainMessengerProxy.selector, address(deployOutput.l1CrossDomainMessengerProxy)); + _doo.set(_doo.optimismPortalProxy.selector, address(deployOutput.optimismPortalProxy)); + _doo.set(_doo.disputeGameFactoryProxy.selector, address(deployOutput.disputeGameFactoryProxy)); + _doo.set(_doo.anchorStateRegistryProxy.selector, address(deployOutput.anchorStateRegistryProxy)); + _doo.set(_doo.anchorStateRegistryImpl.selector, address(deployOutput.anchorStateRegistryImpl)); + // _doo.set(_doo.faultDisputeGame.selector, address(deployOutput.faultDisputeGame)); + _doo.set(_doo.permissionedDisputeGame.selector, address(deployOutput.permissionedDisputeGame)); + _doo.set(_doo.delayedWETHPermissionedGameProxy.selector, address(deployOutput.delayedWETHPermissionedGameProxy)); + // TODO: Eventually switch from Permissioned to Permissionless. + // _doo.set( + // _doo.delayedWETHPermissionlessGameProxy.selector, + // address(deployOutput.delayedWETHPermissionlessGameProxy) + // ); + + checkOutput(_doi, _doo); + } + + function checkOutput(DeployOPChainInput _doi, DeployOPChainOutput _doo) public { + // With 16 addresses, we'd get a stack too deep error if we tried to do this inline as a + // single call to `Solarray.addresses`. So we split it into two calls. + address[] memory addrs1 = Solarray.addresses( + address(_doo.opChainProxyAdmin()), + address(_doo.addressManager()), + address(_doo.l1ERC721BridgeProxy()), + address(_doo.systemConfigProxy()), + address(_doo.optimismMintableERC20FactoryProxy()), + address(_doo.l1StandardBridgeProxy()), + address(_doo.l1CrossDomainMessengerProxy()) + ); + address[] memory addrs2 = Solarray.addresses( + address(_doo.optimismPortalProxy()), + address(_doo.disputeGameFactoryProxy()), + address(_doo.anchorStateRegistryProxy()), + address(_doo.anchorStateRegistryImpl()), + address(_doo.permissionedDisputeGame()), + // address(_doo.faultDisputeGame()), + address(_doo.delayedWETHPermissionedGameProxy()) + ); + // TODO: Eventually switch from Permissioned to Permissionless. Add this address back in. + // address(_delayedWETHPermissionlessGameProxy) + + DeployUtils.assertValidContractAddresses(Solarray.extend(addrs1, addrs2)); + assertValidDeploy(_doi, _doo); + } + + // -------- Deployment Assertions -------- + function assertValidDeploy(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + assertValidAnchorStateRegistryImpl(_doi, _doo); + assertValidAnchorStateRegistryProxy(_doi, _doo); + assertValidDelayedWETH(_doi, _doo); + assertValidDisputeGameFactory(_doi, _doo); + assertValidL1CrossDomainMessenger(_doi, _doo); + assertValidL1ERC721Bridge(_doi, _doo); + assertValidL1StandardBridge(_doi, _doo); + assertValidOptimismMintableERC20Factory(_doi, _doo); + assertValidOptimismPortal(_doi, _doo); + assertValidPermissionedDisputeGame(_doi, _doo); + assertValidSystemConfig(_doi, _doo); + assertValidAddressManager(_doi, _doo); + assertValidOPChainProxyAdmin(_doi, _doo); + } + + function assertValidPermissionedDisputeGame(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + IPermissionedDisputeGame game = _doo.permissionedDisputeGame(); require(GameType.unwrap(game.gameType()) == GameType.unwrap(GameTypes.PERMISSIONED_CANNON), "DPG-10"); // This hex string is the absolutePrestate of the latest op-program release, see where the @@ -395,8 +469,8 @@ contract DeployOPChainOutput is BaseDeployIO { (address mips,) = opcm.implementations(opcm.latestRelease(), "MIPS"); require(game.vm() == IBigStepper(mips), "DPG-30"); - require(address(game.weth()) == address(delayedWETHPermissionedGameProxy()), "DPG-40"); - require(address(game.anchorStateRegistry()) == address(anchorStateRegistryProxy()), "DPG-50"); + require(address(game.weth()) == address(_doo.delayedWETHPermissionedGameProxy()), "DPG-40"); + require(address(game.anchorStateRegistry()) == address(_doo.anchorStateRegistryProxy()), "DPG-50"); require(game.l2ChainId() == _doi.l2ChainId(), "DPG-60"); require(game.l2BlockNumber() == 0, "DPG-70"); require(Duration.unwrap(game.clockExtension()) == 10800, "DPG-80"); @@ -405,38 +479,43 @@ contract DeployOPChainOutput is BaseDeployIO { require(game.maxGameDepth() == 73, "DPG-100"); } - function assertValidAnchorStateRegistryProxy(DeployOPChainInput) internal { + function assertValidAnchorStateRegistryProxy(DeployOPChainInput, DeployOPChainOutput _doo) internal { // First we check the proxy as itself. - IProxy proxy = IProxy(payable(address(anchorStateRegistryProxy()))); + IProxy proxy = IProxy(payable(address(_doo.anchorStateRegistryProxy()))); vm.prank(address(0)); address admin = proxy.admin(); - require(admin == address(opChainProxyAdmin()), "ANCHORP-10"); + require(admin == address(_doo.opChainProxyAdmin()), "ANCHORP-10"); // Then we check the proxy as ASR. - DeployUtils.assertInitialized({ _contractAddress: address(anchorStateRegistryProxy()), _slot: 0, _offset: 0 }); + DeployUtils.assertInitialized({ + _contractAddress: address(_doo.anchorStateRegistryProxy()), + _slot: 0, + _offset: 0 + }); vm.prank(address(0)); address impl = proxy.implementation(); - require(impl == address(anchorStateRegistryImpl()), "ANCHORP-20"); + require(impl == address(_doo.anchorStateRegistryImpl()), "ANCHORP-20"); require( - address(anchorStateRegistryProxy().disputeGameFactory()) == address(disputeGameFactoryProxy()), "ANCHORP-30" + address(_doo.anchorStateRegistryProxy().disputeGameFactory()) == address(_doo.disputeGameFactoryProxy()), + "ANCHORP-30" ); - (Hash actualRoot,) = anchorStateRegistryProxy().anchors(GameTypes.PERMISSIONED_CANNON); + (Hash actualRoot,) = _doo.anchorStateRegistryProxy().anchors(GameTypes.PERMISSIONED_CANNON); bytes32 expectedRoot = 0xdead000000000000000000000000000000000000000000000000000000000000; require(Hash.unwrap(actualRoot) == expectedRoot, "ANCHORP-40"); } - function assertValidAnchorStateRegistryImpl(DeployOPChainInput) internal { - IAnchorStateRegistry registry = anchorStateRegistryImpl(); + function assertValidAnchorStateRegistryImpl(DeployOPChainInput, DeployOPChainOutput _doo) internal { + IAnchorStateRegistry registry = _doo.anchorStateRegistryImpl(); DeployUtils.assertInitialized({ _contractAddress: address(registry), _slot: 0, _offset: 0 }); - require(address(registry.disputeGameFactory()) == address(disputeGameFactoryProxy()), "ANCHORI-10"); + require(address(registry.disputeGameFactory()) == address(_doo.disputeGameFactoryProxy()), "ANCHORI-10"); } - function assertValidSystemConfig(DeployOPChainInput _doi) internal { - ISystemConfig systemConfig = systemConfigProxy(); + function assertValidSystemConfig(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + ISystemConfig systemConfig = _doo.systemConfigProxy(); DeployUtils.assertInitialized({ _contractAddress: address(systemConfig), _slot: 0, _offset: 0 }); @@ -462,37 +541,38 @@ contract DeployOPChainOutput is BaseDeployIO { systemConfig.batchInbox() == _doi.opcmProxy().chainIdToBatchInboxAddress(_doi.l2ChainId()), "SYSCON-150" ); - require(systemConfig.l1CrossDomainMessenger() == address(l1CrossDomainMessengerProxy()), "SYSCON-160"); - require(systemConfig.l1ERC721Bridge() == address(l1ERC721BridgeProxy()), "SYSCON-170"); - require(systemConfig.l1StandardBridge() == address(l1StandardBridgeProxy()), "SYSCON-180"); - require(systemConfig.disputeGameFactory() == address(disputeGameFactoryProxy()), "SYSCON-190"); - require(systemConfig.optimismPortal() == address(optimismPortalProxy()), "SYSCON-200"); + require(systemConfig.l1CrossDomainMessenger() == address(_doo.l1CrossDomainMessengerProxy()), "SYSCON-160"); + require(systemConfig.l1ERC721Bridge() == address(_doo.l1ERC721BridgeProxy()), "SYSCON-170"); + require(systemConfig.l1StandardBridge() == address(_doo.l1StandardBridgeProxy()), "SYSCON-180"); + require(systemConfig.disputeGameFactory() == address(_doo.disputeGameFactoryProxy()), "SYSCON-190"); + require(systemConfig.optimismPortal() == address(_doo.optimismPortalProxy()), "SYSCON-200"); require( - systemConfig.optimismMintableERC20Factory() == address(optimismMintableERC20FactoryProxy()), "SYSCON-210" + systemConfig.optimismMintableERC20Factory() == address(_doo.optimismMintableERC20FactoryProxy()), + "SYSCON-210" ); (address gasPayingToken,) = systemConfig.gasPayingToken(); require(gasPayingToken == Constants.ETHER, "SYSCON-220"); } - function assertValidL1CrossDomainMessenger(DeployOPChainInput _doi) internal { - IL1CrossDomainMessenger messenger = l1CrossDomainMessengerProxy(); + function assertValidL1CrossDomainMessenger(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + IL1CrossDomainMessenger messenger = _doo.l1CrossDomainMessengerProxy(); DeployUtils.assertInitialized({ _contractAddress: address(messenger), _slot: 0, _offset: 20 }); require(address(messenger.OTHER_MESSENGER()) == Predeploys.L2_CROSS_DOMAIN_MESSENGER, "L1xDM-10"); require(address(messenger.otherMessenger()) == Predeploys.L2_CROSS_DOMAIN_MESSENGER, "L1xDM-20"); - require(address(messenger.PORTAL()) == address(optimismPortalProxy()), "L1xDM-30"); - require(address(messenger.portal()) == address(optimismPortalProxy()), "L1xDM-40"); + require(address(messenger.PORTAL()) == address(_doo.optimismPortalProxy()), "L1xDM-30"); + require(address(messenger.portal()) == address(_doo.optimismPortalProxy()), "L1xDM-40"); require(address(messenger.superchainConfig()) == address(_doi.opcmProxy().superchainConfig()), "L1xDM-50"); bytes32 xdmSenderSlot = vm.load(address(messenger), bytes32(uint256(204))); require(address(uint160(uint256(xdmSenderSlot))) == Constants.DEFAULT_L2_SENDER, "L1xDM-60"); } - function assertValidL1StandardBridge(DeployOPChainInput _doi) internal { - IL1StandardBridge bridge = l1StandardBridgeProxy(); - IL1CrossDomainMessenger messenger = l1CrossDomainMessengerProxy(); + function assertValidL1StandardBridge(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + IL1StandardBridge bridge = _doo.l1StandardBridgeProxy(); + IL1CrossDomainMessenger messenger = _doo.l1CrossDomainMessengerProxy(); DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 }); @@ -503,34 +583,34 @@ contract DeployOPChainOutput is BaseDeployIO { require(address(bridge.superchainConfig()) == address(_doi.opcmProxy().superchainConfig()), "L1SB-50"); } - function assertValidOptimismMintableERC20Factory(DeployOPChainInput) internal { - IOptimismMintableERC20Factory factory = optimismMintableERC20FactoryProxy(); + function assertValidOptimismMintableERC20Factory(DeployOPChainInput, DeployOPChainOutput _doo) internal { + IOptimismMintableERC20Factory factory = _doo.optimismMintableERC20FactoryProxy(); DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 }); - require(factory.BRIDGE() == address(l1StandardBridgeProxy()), "MERC20F-10"); - require(factory.bridge() == address(l1StandardBridgeProxy()), "MERC20F-20"); + require(factory.BRIDGE() == address(_doo.l1StandardBridgeProxy()), "MERC20F-10"); + require(factory.bridge() == address(_doo.l1StandardBridgeProxy()), "MERC20F-20"); } - function assertValidL1ERC721Bridge(DeployOPChainInput _doi) internal { - IL1ERC721Bridge bridge = l1ERC721BridgeProxy(); + function assertValidL1ERC721Bridge(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + IL1ERC721Bridge bridge = _doo.l1ERC721BridgeProxy(); DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 }); require(address(bridge.OTHER_BRIDGE()) == Predeploys.L2_ERC721_BRIDGE, "L721B-10"); require(address(bridge.otherBridge()) == Predeploys.L2_ERC721_BRIDGE, "L721B-20"); - require(address(bridge.MESSENGER()) == address(l1CrossDomainMessengerProxy()), "L721B-30"); - require(address(bridge.messenger()) == address(l1CrossDomainMessengerProxy()), "L721B-40"); + require(address(bridge.MESSENGER()) == address(_doo.l1CrossDomainMessengerProxy()), "L721B-30"); + require(address(bridge.messenger()) == address(_doo.l1CrossDomainMessengerProxy()), "L721B-40"); require(address(bridge.superchainConfig()) == address(_doi.opcmProxy().superchainConfig()), "L721B-50"); } - function assertValidOptimismPortal(DeployOPChainInput _doi) internal { - IOptimismPortal2 portal = optimismPortalProxy(); + function assertValidOptimismPortal(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + IOptimismPortal2 portal = _doo.optimismPortalProxy(); ISuperchainConfig superchainConfig = ISuperchainConfig(address(_doi.opcmProxy().superchainConfig())); - require(address(portal.disputeGameFactory()) == address(disputeGameFactoryProxy()), "PORTAL-10"); - require(address(portal.systemConfig()) == address(systemConfigProxy()), "PORTAL-20"); + require(address(portal.disputeGameFactory()) == address(_doo.disputeGameFactoryProxy()), "PORTAL-10"); + require(address(portal.systemConfig()) == address(_doo.systemConfigProxy()), "PORTAL-20"); require(address(portal.superchainConfig()) == address(superchainConfig), "PORTAL-30"); require(portal.guardian() == superchainConfig.guardian(), "PORTAL-40"); require(portal.paused() == superchainConfig.paused(), "PORTAL-50"); @@ -541,158 +621,85 @@ contract DeployOPChainOutput is BaseDeployIO { require(vm.load(address(portal), bytes32(uint256(61))) == bytes32(0)); } - function assertValidDisputeGameFactory(DeployOPChainInput _doi) internal { - IDisputeGameFactory factory = disputeGameFactoryProxy(); + function assertValidDisputeGameFactory(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + IDisputeGameFactory factory = _doo.disputeGameFactoryProxy(); DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 }); require( - address(factory.gameImpls(GameTypes.PERMISSIONED_CANNON)) == address(permissionedDisputeGame()), "DF-10" + address(factory.gameImpls(GameTypes.PERMISSIONED_CANNON)) == address(_doo.permissionedDisputeGame()), + "DF-10" ); require(factory.owner() == address(_doi.opChainProxyAdminOwner()), "DF-20"); } - function assertValidDelayedWETH(DeployOPChainInput _doi) internal { - IDelayedWETH permissioned = delayedWETHPermissionedGameProxy(); + function assertValidDelayedWETH(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + IDelayedWETH permissioned = _doo.delayedWETHPermissionedGameProxy(); require(permissioned.owner() == address(_doi.opChainProxyAdminOwner()), "DWETH-10"); IProxy proxy = IProxy(payable(address(permissioned))); vm.prank(address(0)); address admin = proxy.admin(); - require(admin == address(opChainProxyAdmin()), "DWETH-20"); + require(admin == address(_doo.opChainProxyAdmin()), "DWETH-20"); } - function assertValidAddressManager(DeployOPChainInput) internal view { - require(addressManager().owner() == address(opChainProxyAdmin()), "AM-10"); + function assertValidAddressManager(DeployOPChainInput, DeployOPChainOutput _doo) internal view { + require(_doo.addressManager().owner() == address(_doo.opChainProxyAdmin()), "AM-10"); } - function assertValidOPChainProxyAdmin(DeployOPChainInput _doi) internal { - IProxyAdmin admin = opChainProxyAdmin(); + function assertValidOPChainProxyAdmin(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal { + IProxyAdmin admin = _doo.opChainProxyAdmin(); require(admin.owner() == _doi.opChainProxyAdminOwner(), "OPCPA-10"); require( - admin.getProxyImplementation(address(l1CrossDomainMessengerProxy())) - == DeployUtils.assertResolvedDelegateProxyImplementationSet("OVM_L1CrossDomainMessenger", addressManager()), + admin.getProxyImplementation(address(_doo.l1CrossDomainMessengerProxy())) + == DeployUtils.assertResolvedDelegateProxyImplementationSet( + "OVM_L1CrossDomainMessenger", _doo.addressManager() + ), "OPCPA-20" ); - require(address(admin.addressManager()) == address(addressManager()), "OPCPA-30"); + require(address(admin.addressManager()) == address(_doo.addressManager()), "OPCPA-30"); require( - admin.getProxyImplementation(address(l1StandardBridgeProxy())) - == DeployUtils.assertL1ChugSplashImplementationSet(address(l1StandardBridgeProxy())), + admin.getProxyImplementation(address(_doo.l1StandardBridgeProxy())) + == DeployUtils.assertL1ChugSplashImplementationSet(address(_doo.l1StandardBridgeProxy())), "OPCPA-40" ); require( - admin.getProxyImplementation(address(l1ERC721BridgeProxy())) - == DeployUtils.assertERC1967ImplementationSet(address(l1ERC721BridgeProxy())), + admin.getProxyImplementation(address(_doo.l1ERC721BridgeProxy())) + == DeployUtils.assertERC1967ImplementationSet(address(_doo.l1ERC721BridgeProxy())), "OPCPA-50" ); require( - admin.getProxyImplementation(address(optimismPortalProxy())) - == DeployUtils.assertERC1967ImplementationSet(address(optimismPortalProxy())), + admin.getProxyImplementation(address(_doo.optimismPortalProxy())) + == DeployUtils.assertERC1967ImplementationSet(address(_doo.optimismPortalProxy())), "OPCPA-60" ); require( - admin.getProxyImplementation(address(systemConfigProxy())) - == DeployUtils.assertERC1967ImplementationSet(address(systemConfigProxy())), + admin.getProxyImplementation(address(_doo.systemConfigProxy())) + == DeployUtils.assertERC1967ImplementationSet(address(_doo.systemConfigProxy())), "OPCPA-70" ); require( - admin.getProxyImplementation(address(optimismMintableERC20FactoryProxy())) - == DeployUtils.assertERC1967ImplementationSet(address(optimismMintableERC20FactoryProxy())), + admin.getProxyImplementation(address(_doo.optimismMintableERC20FactoryProxy())) + == DeployUtils.assertERC1967ImplementationSet(address(_doo.optimismMintableERC20FactoryProxy())), "OPCPA-80" ); require( - admin.getProxyImplementation(address(disputeGameFactoryProxy())) - == DeployUtils.assertERC1967ImplementationSet(address(disputeGameFactoryProxy())), + admin.getProxyImplementation(address(_doo.disputeGameFactoryProxy())) + == DeployUtils.assertERC1967ImplementationSet(address(_doo.disputeGameFactoryProxy())), "OPCPA-90" ); require( - admin.getProxyImplementation(address(delayedWETHPermissionedGameProxy())) - == DeployUtils.assertERC1967ImplementationSet(address(delayedWETHPermissionedGameProxy())), + admin.getProxyImplementation(address(_doo.delayedWETHPermissionedGameProxy())) + == DeployUtils.assertERC1967ImplementationSet(address(_doo.delayedWETHPermissionedGameProxy())), "OPCPA-100" ); require( - admin.getProxyImplementation(address(anchorStateRegistryProxy())) - == DeployUtils.assertERC1967ImplementationSet(address(anchorStateRegistryProxy())), + admin.getProxyImplementation(address(_doo.anchorStateRegistryProxy())) + == DeployUtils.assertERC1967ImplementationSet(address(_doo.anchorStateRegistryProxy())), "OPCPA-110" ); } -} - -contract DeployOPChain is Script { - // -------- Core Deployment Methods -------- - - function run(DeployOPChainInput _doi, DeployOPChainOutput _doo) public { - OPContractsManager opcmProxy = _doi.opcmProxy(); - - OPContractsManager.Roles memory roles = OPContractsManager.Roles({ - opChainProxyAdminOwner: _doi.opChainProxyAdminOwner(), - systemConfigOwner: _doi.systemConfigOwner(), - batcher: _doi.batcher(), - unsafeBlockSigner: _doi.unsafeBlockSigner(), - proposer: _doi.proposer(), - challenger: _doi.challenger() - }); - OPContractsManager.DeployInput memory deployInput = OPContractsManager.DeployInput({ - roles: roles, - basefeeScalar: _doi.basefeeScalar(), - blobBasefeeScalar: _doi.blobBaseFeeScalar(), - l2ChainId: _doi.l2ChainId(), - startingAnchorRoots: _doi.startingAnchorRoots(), - saltMixer: _doi.saltMixer(), - gasLimit: _doi.gasLimit(), - disputeGameType: _doi.disputeGameType(), - disputeAbsolutePrestate: _doi.disputeAbsolutePrestate(), - disputeMaxGameDepth: _doi.disputeMaxGameDepth(), - disputeSplitDepth: _doi.disputeSplitDepth(), - disputeClockExtension: _doi.disputeClockExtension(), - disputeMaxClockDuration: _doi.disputeMaxClockDuration() - }); - - vm.broadcast(msg.sender); - OPContractsManager.DeployOutput memory deployOutput = opcmProxy.deploy(deployInput); - - vm.label(address(deployOutput.opChainProxyAdmin), "opChainProxyAdmin"); - vm.label(address(deployOutput.addressManager), "addressManager"); - vm.label(address(deployOutput.l1ERC721BridgeProxy), "l1ERC721BridgeProxy"); - vm.label(address(deployOutput.systemConfigProxy), "systemConfigProxy"); - vm.label(address(deployOutput.optimismMintableERC20FactoryProxy), "optimismMintableERC20FactoryProxy"); - vm.label(address(deployOutput.l1StandardBridgeProxy), "l1StandardBridgeProxy"); - vm.label(address(deployOutput.l1CrossDomainMessengerProxy), "l1CrossDomainMessengerProxy"); - vm.label(address(deployOutput.optimismPortalProxy), "optimismPortalProxy"); - vm.label(address(deployOutput.disputeGameFactoryProxy), "disputeGameFactoryProxy"); - vm.label(address(deployOutput.anchorStateRegistryProxy), "anchorStateRegistryProxy"); - vm.label(address(deployOutput.anchorStateRegistryImpl), "anchorStateRegistryImpl"); - // vm.label(address(deployOutput.faultDisputeGame), "faultDisputeGame"); - vm.label(address(deployOutput.permissionedDisputeGame), "permissionedDisputeGame"); - vm.label(address(deployOutput.delayedWETHPermissionedGameProxy), "delayedWETHPermissionedGameProxy"); - // TODO: Eventually switch from Permissioned to Permissionless. - // vm.label(address(deployOutput.delayedWETHPermissionlessGameProxy), "delayedWETHPermissionlessGameProxy"); - - _doo.set(_doo.opChainProxyAdmin.selector, address(deployOutput.opChainProxyAdmin)); - _doo.set(_doo.addressManager.selector, address(deployOutput.addressManager)); - _doo.set(_doo.l1ERC721BridgeProxy.selector, address(deployOutput.l1ERC721BridgeProxy)); - _doo.set(_doo.systemConfigProxy.selector, address(deployOutput.systemConfigProxy)); - _doo.set( - _doo.optimismMintableERC20FactoryProxy.selector, address(deployOutput.optimismMintableERC20FactoryProxy) - ); - _doo.set(_doo.l1StandardBridgeProxy.selector, address(deployOutput.l1StandardBridgeProxy)); - _doo.set(_doo.l1CrossDomainMessengerProxy.selector, address(deployOutput.l1CrossDomainMessengerProxy)); - _doo.set(_doo.optimismPortalProxy.selector, address(deployOutput.optimismPortalProxy)); - _doo.set(_doo.disputeGameFactoryProxy.selector, address(deployOutput.disputeGameFactoryProxy)); - _doo.set(_doo.anchorStateRegistryProxy.selector, address(deployOutput.anchorStateRegistryProxy)); - _doo.set(_doo.anchorStateRegistryImpl.selector, address(deployOutput.anchorStateRegistryImpl)); - // _doo.set(_doo.faultDisputeGame.selector, address(deployOutput.faultDisputeGame)); - _doo.set(_doo.permissionedDisputeGame.selector, address(deployOutput.permissionedDisputeGame)); - _doo.set(_doo.delayedWETHPermissionedGameProxy.selector, address(deployOutput.delayedWETHPermissionedGameProxy)); - // TODO: Eventually switch from Permissioned to Permissionless. - // _doo.set( - // _doo.delayedWETHPermissionlessGameProxy.selector, - // address(deployOutput.delayedWETHPermissionlessGameProxy) - // ); - - _doo.checkOutput(_doi); - } // -------- Utilities --------