From 1430998d6e0e53d6286787ec9bb3dd2fbd19c107 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Thu, 3 Oct 2024 11:51:12 -0400 Subject: [PATCH] --wip-- --- .../scripts/deploy/Deploy.s.sol | 4 +- .../scripts/fpac/FPACOPS.s.sol | 242 --------------- .../scripts/fpac/FPACOPS2.s.sol | 287 ------------------ 3 files changed, 3 insertions(+), 530 deletions(-) delete mode 100644 packages/contracts-bedrock/scripts/fpac/FPACOPS.s.sol delete mode 100644 packages/contracts-bedrock/scripts/fpac/FPACOPS2.s.sol diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index 75504a043f263..4d4fb5c34674a 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -182,7 +182,7 @@ contract Deploy is Deployer { AnchorStateRegistry: getAddress("AnchorStateRegistry"), OptimismMintableERC20Factory: getAddress("OptimismMintableERC20Factory"), OptimismPortal: getAddress("OptimismPortal"), - OptimismPortal2: getAddress("OptimismPortal"), + OptimismPortal2: getAddress("OptimismPortal2"), SystemConfig: getAddress("SystemConfig"), L1ERC721Bridge: getAddress("L1ERC721Bridge"), ProtocolVersions: getAddress("ProtocolVersions"), @@ -434,6 +434,8 @@ contract Deploy is Deployer { Types.ContractSet memory contracts = _implsUnstrict(); ChainAssertions.checkL1CrossDomainMessenger({ _contracts: contracts, _vm: vm, _isProxy: false }); + + console.log("OptimismPortal2 address", getAddress("OptimismPortal2")); ChainAssertions.checkOptimismPortal2({ _contracts: contracts, _cfg: cfg, _isProxy: false }); ChainAssertions.checkOptimismMintableERC20Factory({ _contracts: contracts, _isProxy: false }); // TODO: interop version of this? diff --git a/packages/contracts-bedrock/scripts/fpac/FPACOPS.s.sol b/packages/contracts-bedrock/scripts/fpac/FPACOPS.s.sol deleted file mode 100644 index 21da41e12d5e4..0000000000000 --- a/packages/contracts-bedrock/scripts/fpac/FPACOPS.s.sol +++ /dev/null @@ -1,242 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.15; - -// Scripts -import { StdAssertions } from "forge-std/StdAssertions.sol"; -import "scripts/deploy/Deploy.s.sol"; - -// Libraries -import "src/dispute/lib/Types.sol"; - -// Interfaces -import { IProxy } from "src/universal/interfaces/IProxy.sol"; -import { IMIPS } from "src/cannon/interfaces/IMIPS.sol"; -import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol"; -import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; -import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"; -import { IPermissionedDisputeGame } from "src/dispute/interfaces/IPermissionedDisputeGame.sol"; - -/// @notice Deploys the Fault Proof Alpha Chad contracts. -contract FPACOPS is Deploy, StdAssertions { - //////////////////////////////////////////////////////////////// - // ENTRYPOINTS // - //////////////////////////////////////////////////////////////// - - function deployFPAC(address _proxyAdmin, address _finalSystemOwner, address _superchainConfigProxy) public { - console.log("Deploying a fresh FPAC system and OptimismPortal2 implementation."); - - prankDeployment("ProxyAdmin", msg.sender); - prankDeployment("FinalSystemOwner", msg.sender); - prankDeployment("SuperchainConfigProxy", _superchainConfigProxy); - - // Deploy the proxies. - deployERC1967Proxy("DisputeGameFactoryProxy"); - deployERC1967Proxy("DelayedWETHProxy"); - deployERC1967Proxy("AnchorStateRegistryProxy"); - - // Deploy implementations. - deployDisputeGameFactory(); - deployDelayedWETH(); - deployAnchorStateRegistry(); - deployPreimageOracle(); - deployMips(); - - // Deploy the new `OptimismPortal` implementation. - deployOptimismPortal2(); - - // Initialize the proxies. - initializeDisputeGameFactoryProxy(); - initializeDelayedWETHProxy(); - initializeAnchorStateRegistryProxy(); - - // Deploy the Cannon Fault game implementation and set it as game ID = 0. - setCannonFaultGameImplementation({ _allowUpgrade: false }); - // Deploy the Permissioned Cannon Fault game implementation and set it as game ID = 1. - setPermissionedCannonFaultGameImplementation({ _allowUpgrade: false }); - - // Transfer ownership of the DisputeGameFactory to the FinalSystemOwner, and transfer the administrative rights - // of the DisputeGameFactoryProxy to the ProxyAdmin. - transferDGFOwnershipFinal({ _proxyAdmin: _proxyAdmin, _finalSystemOwner: _finalSystemOwner }); - transferWethOwnershipFinal({ _proxyAdmin: _proxyAdmin, _finalSystemOwner: _finalSystemOwner }); - transferAnchorStateOwnershipFinal({ _proxyAdmin: _proxyAdmin }); - - // Run post-deployment assertions. - postDeployAssertions({ _proxyAdmin: _proxyAdmin, _finalSystemOwner: _finalSystemOwner }); - - // Print overview - printConfigReview(); - } - - //////////////////////////////////////////////////////////////// - // HELPERS // - //////////////////////////////////////////////////////////////// - - /// @notice Initializes the DisputeGameFactoryProxy with the DisputeGameFactory. - function initializeDisputeGameFactoryProxy() internal broadcast { - console.log("Initializing DisputeGameFactoryProxy with DisputeGameFactory."); - - address dgfProxy = mustGetAddress("DisputeGameFactoryProxy"); - IProxy(payable(dgfProxy)).upgradeToAndCall( - mustGetAddress("DisputeGameFactory"), abi.encodeCall(IDisputeGameFactory.initialize, msg.sender) - ); - - // Set the initialization bonds for the FaultDisputeGame and PermissionedDisputeGame. - IDisputeGameFactory dgf = IDisputeGameFactory(dgfProxy); - dgf.setInitBond(GameTypes.CANNON, 0.08 ether); - dgf.setInitBond(GameTypes.PERMISSIONED_CANNON, 0.08 ether); - } - - function initializeDelayedWETHProxy() internal broadcast { - console.log("Initializing DelayedWETHProxy with DelayedWETH."); - - address wethProxy = mustGetAddress("DelayedWETHProxy"); - address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy"); - IProxy(payable(wethProxy)).upgradeToAndCall( - mustGetAddress("DelayedWETH"), - abi.encodeCall(IDelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy))) - ); - } - - function initializeAnchorStateRegistryProxy() internal broadcast { - console.log("Initializing AnchorStateRegistryProxy with AnchorStateRegistry."); - address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy"); - ISuperchainConfig superchainConfig = ISuperchainConfig(superchainConfigProxy); - - IAnchorStateRegistry.StartingAnchorRoot[] memory roots = new IAnchorStateRegistry.StartingAnchorRoot[](2); - roots[0] = IAnchorStateRegistry.StartingAnchorRoot({ - gameType: GameTypes.CANNON, - outputRoot: OutputRoot({ - root: Hash.wrap(cfg.faultGameGenesisOutputRoot()), - l2BlockNumber: cfg.faultGameGenesisBlock() - }) - }); - roots[1] = IAnchorStateRegistry.StartingAnchorRoot({ - gameType: GameTypes.PERMISSIONED_CANNON, - outputRoot: OutputRoot({ - root: Hash.wrap(cfg.faultGameGenesisOutputRoot()), - l2BlockNumber: cfg.faultGameGenesisBlock() - }) - }); - - address asrProxy = mustGetAddress("AnchorStateRegistryProxy"); - IProxy(payable(asrProxy)).upgradeToAndCall( - mustGetAddress("AnchorStateRegistry"), - abi.encodeCall(IAnchorStateRegistry.initialize, (roots, superchainConfig)) - ); - } - - /// @notice Transfers admin rights of the `DisputeGameFactoryProxy` to the `ProxyAdmin` and sets the - /// `DisputeGameFactory` owner to the `FinalSystemOwner`. - function transferDGFOwnershipFinal(address _proxyAdmin, address _finalSystemOwner) internal broadcast { - IDisputeGameFactory dgf = IDisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy")); - - // Transfer the ownership of the DisputeGameFactory to the FinalSystemOwner. - dgf.transferOwnership(_finalSystemOwner); - - // Transfer the admin rights of the DisputeGameFactoryProxy to the ProxyAdmin. - IProxy prox = IProxy(payable(address(dgf))); - prox.changeAdmin(_proxyAdmin); - } - - /// @notice Transfers admin rights of the `DelayedWETHProxy` to the `ProxyAdmin` and sets the - /// `DelayedWETH` owner to the `FinalSystemOwner`. - function transferWethOwnershipFinal(address _proxyAdmin, address _finalSystemOwner) internal broadcast { - IDelayedWETH weth = IDelayedWETH(mustGetAddress("DelayedWETHProxy")); - - // Transfer the ownership of the DelayedWETH to the FinalSystemOwner. - weth.transferOwnership(_finalSystemOwner); - - // Transfer the admin rights of the DelayedWETHProxy to the ProxyAdmin. - IProxy prox = IProxy(payable(address(weth))); - prox.changeAdmin(_proxyAdmin); - } - - /// @notice Transfers admin rights of the `AnchorStateRegistryProxy` to the `ProxyAdmin`. - function transferAnchorStateOwnershipFinal(address _proxyAdmin) internal broadcast { - IAnchorStateRegistry asr = IAnchorStateRegistry(mustGetAddress("AnchorStateRegistryProxy")); - - // Transfer the admin rights of the AnchorStateRegistryProxy to the ProxyAdmin. - IProxy prox = IProxy(payable(address(asr))); - prox.changeAdmin(_proxyAdmin); - } - - /// @notice Checks that the deployed system is configured correctly. - function postDeployAssertions(address _proxyAdmin, address _finalSystemOwner) internal view { - Types.ContractSet memory contracts = _proxiesUnstrict(); - contracts.OptimismPortal2 = mustGetAddress("OptimismPortal2"); - - // Ensure that `useFaultProofs` is set to `true`. - assertTrue(cfg.useFaultProofs()); - - // Ensure the contracts are owned by the correct entities. - address dgfProxyAddr = mustGetAddress("DisputeGameFactoryProxy"); - IDisputeGameFactory dgfProxy = IDisputeGameFactory(dgfProxyAddr); - assertEq(address(uint160(uint256(vm.load(dgfProxyAddr, Constants.PROXY_OWNER_ADDRESS)))), _proxyAdmin); - ChainAssertions.checkDisputeGameFactory(contracts, _finalSystemOwner, true); - address wethProxyAddr = mustGetAddress("DelayedWETHProxy"); - assertEq(address(uint160(uint256(vm.load(wethProxyAddr, Constants.PROXY_OWNER_ADDRESS)))), _proxyAdmin); - ChainAssertions.checkDelayedWETH(contracts, cfg, true, _finalSystemOwner); - - // Check the config elements in the deployed contracts. - ChainAssertions.checkOptimismPortal2(contracts, cfg, false); - - IPreimageOracle oracle = IPreimageOracle(mustGetAddress("PreimageOracle")); - assertEq(oracle.minProposalSize(), cfg.preimageOracleMinProposalSize()); - assertEq(oracle.challengePeriod(), cfg.preimageOracleChallengePeriod()); - - IMIPS mips = IMIPS(mustGetAddress("Mips")); - assertEq(address(mips.oracle()), address(oracle)); - - // Check the AnchorStateRegistry configuration. - IAnchorStateRegistry asr = IAnchorStateRegistry(mustGetAddress("AnchorStateRegistryProxy")); - (Hash root1, uint256 l2BlockNumber1) = asr.anchors(GameTypes.CANNON); - (Hash root2, uint256 l2BlockNumber2) = asr.anchors(GameTypes.PERMISSIONED_CANNON); - assertEq(root1.raw(), cfg.faultGameGenesisOutputRoot()); - assertEq(root2.raw(), cfg.faultGameGenesisOutputRoot()); - assertEq(l2BlockNumber1, cfg.faultGameGenesisBlock()); - assertEq(l2BlockNumber2, cfg.faultGameGenesisBlock()); - - // Check the FaultDisputeGame configuration. - IFaultDisputeGame gameImpl = IFaultDisputeGame(payable(address(dgfProxy.gameImpls(GameTypes.CANNON)))); - assertEq(gameImpl.maxGameDepth(), cfg.faultGameMaxDepth()); - assertEq(gameImpl.splitDepth(), cfg.faultGameSplitDepth()); - assertEq(gameImpl.clockExtension().raw(), cfg.faultGameClockExtension()); - assertEq(gameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration()); - assertEq(gameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate())); - assertEq(address(gameImpl.weth()), wethProxyAddr); - assertEq(address(gameImpl.anchorStateRegistry()), address(asr)); - assertEq(address(gameImpl.vm()), address(mips)); - - // Check the security override yoke configuration. - IPermissionedDisputeGame soyGameImpl = - IPermissionedDisputeGame(payable(address(dgfProxy.gameImpls(GameTypes.PERMISSIONED_CANNON)))); - assertEq(soyGameImpl.proposer(), cfg.l2OutputOracleProposer()); - assertEq(soyGameImpl.challenger(), cfg.l2OutputOracleChallenger()); - assertEq(soyGameImpl.maxGameDepth(), cfg.faultGameMaxDepth()); - assertEq(soyGameImpl.splitDepth(), cfg.faultGameSplitDepth()); - assertEq(soyGameImpl.clockExtension().raw(), cfg.faultGameClockExtension()); - assertEq(soyGameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration()); - assertEq(soyGameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate())); - assertEq(address(soyGameImpl.weth()), wethProxyAddr); - assertEq(address(soyGameImpl.anchorStateRegistry()), address(asr)); - assertEq(address(soyGameImpl.vm()), address(mips)); - } - - /// @notice Prints a review of the fault proof configuration section of the deploy config. - function printConfigReview() internal view { - console.log(unicode"📖 FaultDisputeGame Config Overview (chainid: %d)", block.chainid); - console.log(" 0. Use Fault Proofs: %s", cfg.useFaultProofs() ? "true" : "false"); - console.log(" 1. Absolute Prestate: %x", cfg.faultGameAbsolutePrestate()); - console.log(" 2. Max Depth: %d", cfg.faultGameMaxDepth()); - console.log(" 3. Output / Execution split Depth: %d", cfg.faultGameSplitDepth()); - console.log(" 4. Clock Extension (seconds): %d", cfg.faultGameClockExtension()); - console.log(" 5. Max Clock Duration (seconds): %d", cfg.faultGameMaxClockDuration()); - console.log(" 6. L2 Genesis block number: %d", cfg.faultGameGenesisBlock()); - console.log(" 7. L2 Genesis output root: %x", uint256(cfg.faultGameGenesisOutputRoot())); - console.log(" 8. Proof Maturity Delay (seconds): ", cfg.proofMaturityDelaySeconds()); - console.log(" 9. Dispute Game Finality Delay (seconds): ", cfg.disputeGameFinalityDelaySeconds()); - console.log(" 10. Respected Game Type: ", cfg.respectedGameType()); - console.log(" 11. Preimage Oracle Min Proposal Size (bytes): ", cfg.preimageOracleMinProposalSize()); - console.log(" 12. Preimage Oracle Challenge Period (seconds): ", cfg.preimageOracleChallengePeriod()); - } -} diff --git a/packages/contracts-bedrock/scripts/fpac/FPACOPS2.s.sol b/packages/contracts-bedrock/scripts/fpac/FPACOPS2.s.sol deleted file mode 100644 index d16282cd4e490..0000000000000 --- a/packages/contracts-bedrock/scripts/fpac/FPACOPS2.s.sol +++ /dev/null @@ -1,287 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.15; - -// Scripts -import { StdAssertions } from "forge-std/StdAssertions.sol"; -import "scripts/deploy/Deploy.s.sol"; - -// Libraries -import "src/dispute/lib/Types.sol"; - -// Interfaces -import { IProxy } from "src/universal/interfaces/IProxy.sol"; -import { IMIPS } from "src/cannon/interfaces/IMIPS.sol"; -import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol"; -import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; -import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"; -import { IPermissionedDisputeGame } from "src/dispute/interfaces/IPermissionedDisputeGame.sol"; - -/// @notice Deploys new implementations of the FaultDisputeGame contract and its dependencies -/// assuming that the DisputeGameFactory contract does not need to be modified. Assumes -/// that the System Owner will update the DisputeGameFactory to point to these new -/// contracts at a later point in time. -contract FPACOPS2 is Deploy, StdAssertions { - //////////////////////////////////////////////////////////////// - // ENTRYPOINTS // - //////////////////////////////////////////////////////////////// - - /// @notice Deploys an updated FP system with new FaultDisputeGame contracts and new - /// DelayedWETH contracts. Deploys a new implementation of the - /// AnchorStateRegistry. Does not deploy a new DisputeGameFactory. System - /// Owner is responsible for updating implementations later. - /// @param _proxyAdmin Address of the ProxyAdmin contract to transfer ownership to. - /// @param _finalSystemOwner Address of the SystemOwner. - /// @param _superchainConfigProxy Address of the SuperchainConfig proxy contract. - /// @param _disputeGameFactoryProxy Address of the DisputeGameFactory proxy contract. - /// @param _anchorStateRegistryProxy Address of the AnchorStateRegistry proxy contract. - function deployFPAC2( - address _proxyAdmin, - address _finalSystemOwner, - address _superchainConfigProxy, - address _disputeGameFactoryProxy, - address _anchorStateRegistryProxy - ) - public - { - console.log("Deploying updated FP contracts."); - - // Prank required deployments. - prankDeployment("ProxyAdmin", msg.sender); - prankDeployment("FinalSystemOwner", msg.sender); - prankDeployment("SuperchainConfigProxy", _superchainConfigProxy); - prankDeployment("DisputeGameFactoryProxy", _disputeGameFactoryProxy); - prankDeployment("AnchorStateRegistryProxy", _anchorStateRegistryProxy); - - // Deploy the proxies. - deployERC1967Proxy("DelayedWETHProxy"); - deployERC1967Proxy("PermissionedDelayedWETHProxy"); - - // Deploy implementations. - deployDelayedWETH(); - deployAnchorStateRegistry(); - deployPreimageOracle(); - deployMips(); - - // Initialize the proxies. - initializeDelayedWETHProxy(); - initializePermissionedDelayedWETHProxy(); - - // Deploy the new game implementations. - deployCannonDisputeGame(); - deployPermissionedDisputeGame(); - - // Transfer ownership of DelayedWETH to ProxyAdmin. - transferWethOwnershipFinal({ _proxyAdmin: _proxyAdmin, _finalSystemOwner: _finalSystemOwner }); - transferPermissionedWETHOwnershipFinal({ _proxyAdmin: _proxyAdmin, _finalSystemOwner: _finalSystemOwner }); - - // Run post-deployment assertions. - postDeployAssertions({ _proxyAdmin: _proxyAdmin, _finalSystemOwner: _finalSystemOwner }); - - // Print overview. - printConfigReview(); - } - - //////////////////////////////////////////////////////////////// - // HELPERS // - //////////////////////////////////////////////////////////////// - - /// @notice Deploys the standard Cannon version of the FaultDisputeGame. - function deployCannonDisputeGame() internal broadcast { - console.log("Deploying CannonFaultDisputeGame implementation"); - - DeployUtils.create2AndSave({ - _save: this, - _name: "FaultDisputeGame", - _nick: "CannonFaultDisputeGame", - _args: DeployUtils.encodeConstructor( - abi.encodeCall( - IFaultDisputeGame.__constructor__, - ( - GameTypes.CANNON, - loadMipsAbsolutePrestate(), - cfg.faultGameMaxDepth(), - cfg.faultGameSplitDepth(), - Duration.wrap(uint64(cfg.faultGameClockExtension())), - Duration.wrap(uint64(cfg.faultGameMaxClockDuration())), - IBigStepper(mustGetAddress("Mips")), - IDelayedWETH(mustGetAddress("DelayedWETHProxy")), - IAnchorStateRegistry(mustGetAddress("AnchorStateRegistryProxy")), - cfg.l2ChainID() - ) - ) - ), - _salt: _implSalt() - }); - } - - /// @notice Deploys the PermissionedDisputeGame. - function deployPermissionedDisputeGame() internal broadcast { - console.log("Deploying PermissionedDisputeGame implementation"); - - DeployUtils.create2AndSave({ - _save: this, - _name: "PermissionedDisputeGame", - _args: DeployUtils.encodeConstructor( - abi.encodeCall( - IPermissionedDisputeGame.__constructor__, - ( - GameTypes.PERMISSIONED_CANNON, - loadMipsAbsolutePrestate(), - cfg.faultGameMaxDepth(), - cfg.faultGameSplitDepth(), - Duration.wrap(uint64(cfg.faultGameClockExtension())), - Duration.wrap(uint64(cfg.faultGameMaxClockDuration())), - IBigStepper(mustGetAddress("Mips")), - IDelayedWETH(mustGetAddress("PermissionedDelayedWETHProxy")), - IAnchorStateRegistry(mustGetAddress("AnchorStateRegistryProxy")), - cfg.l2ChainID(), - cfg.l2OutputOracleProposer(), - cfg.l2OutputOracleChallenger() - ) - ) - ), - _salt: _implSalt() - }); - } - - /// @notice Initializes the DelayedWETH proxy. - function initializeDelayedWETHProxy() internal broadcast { - console.log("Initializing DelayedWETHProxy with DelayedWETH."); - - address wethProxy = mustGetAddress("DelayedWETHProxy"); - address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy"); - IProxy(payable(wethProxy)).upgradeToAndCall( - mustGetAddress("DelayedWETH"), - abi.encodeCall(IDelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy))) - ); - } - - /// @notice Initializes the permissioned DelayedWETH proxy. - function initializePermissionedDelayedWETHProxy() internal broadcast { - console.log("Initializing permissioned DelayedWETHProxy with DelayedWETH."); - - address wethProxy = mustGetAddress("PermissionedDelayedWETHProxy"); - address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy"); - IProxy(payable(wethProxy)).upgradeToAndCall( - mustGetAddress("DelayedWETH"), - abi.encodeCall(IDelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy))) - ); - } - - /// @notice Transfers admin rights of the `DelayedWETHProxy` to the `ProxyAdmin` and sets the - /// `DelayedWETH` owner to the `FinalSystemOwner`. - function transferWethOwnershipFinal(address _proxyAdmin, address _finalSystemOwner) internal broadcast { - console.log("Transferring ownership of DelayedWETHProxy"); - - IDelayedWETH weth = IDelayedWETH(mustGetAddress("DelayedWETHProxy")); - - // Transfer the ownership of the DelayedWETH to the FinalSystemOwner. - weth.transferOwnership(_finalSystemOwner); - - // Transfer the admin rights of the DelayedWETHProxy to the ProxyAdmin. - IProxy prox = IProxy(payable(address(weth))); - prox.changeAdmin(_proxyAdmin); - } - - /// @notice Transfers admin rights of the permissioned `DelayedWETHProxy` to the `ProxyAdmin` - /// and sets the `DelayedWETH` owner to the `FinalSystemOwner`. - function transferPermissionedWETHOwnershipFinal( - address _proxyAdmin, - address _finalSystemOwner - ) - internal - broadcast - { - console.log("Transferring ownership of permissioned DelayedWETHProxy"); - - IDelayedWETH weth = IDelayedWETH(mustGetAddress("PermissionedDelayedWETHProxy")); - - // Transfer the ownership of the DelayedWETH to the FinalSystemOwner. - weth.transferOwnership(_finalSystemOwner); - - // Transfer the admin rights of the DelayedWETHProxy to the ProxyAdmin. - IProxy prox = IProxy(payable(address(weth))); - prox.changeAdmin(_proxyAdmin); - } - - /// @notice Checks that the deployed system is configured correctly. - function postDeployAssertions(address _proxyAdmin, address _finalSystemOwner) internal view { - Types.ContractSet memory contracts = _proxiesUnstrict(); - - // Ensure that `useFaultProofs` is set to `true`. - assertTrue(cfg.useFaultProofs()); - - // Verify that the DGF is owned by the ProxyAdmin. - address dgfProxyAddr = mustGetAddress("DisputeGameFactoryProxy"); - assertEq(address(uint160(uint256(vm.load(dgfProxyAddr, Constants.PROXY_OWNER_ADDRESS)))), _proxyAdmin); - - // Verify that DelayedWETH is owned by the ProxyAdmin. - address wethProxyAddr = mustGetAddress("DelayedWETHProxy"); - assertEq(address(uint160(uint256(vm.load(wethProxyAddr, Constants.PROXY_OWNER_ADDRESS)))), _proxyAdmin); - - // Verify that permissioned DelayedWETH is owned by the ProxyAdmin. - address soyWethProxyAddr = mustGetAddress("PermissionedDelayedWETHProxy"); - assertEq(address(uint160(uint256(vm.load(soyWethProxyAddr, Constants.PROXY_OWNER_ADDRESS)))), _proxyAdmin); - - // Run standard assertions for DGF and DelayedWETH. - ChainAssertions.checkDisputeGameFactory(contracts, _finalSystemOwner, true); - ChainAssertions.checkDelayedWETH(contracts, cfg, true, _finalSystemOwner); - ChainAssertions.checkPermissionedDelayedWETH(contracts, cfg, true, _finalSystemOwner); - - // Verify PreimageOracle configuration. - IPreimageOracle oracle = IPreimageOracle(mustGetAddress("PreimageOracle")); - assertEq(oracle.minProposalSize(), cfg.preimageOracleMinProposalSize()); - assertEq(oracle.challengePeriod(), cfg.preimageOracleChallengePeriod()); - - // Verify MIPS configuration. - IMIPS mips = IMIPS(mustGetAddress("Mips")); - assertEq(address(mips.oracle()), address(oracle)); - - // Grab ASR - IAnchorStateRegistry asr = IAnchorStateRegistry(mustGetAddress("AnchorStateRegistryProxy")); - - // Verify FaultDisputeGame configuration. - address gameAddr = mustGetAddress("CannonFaultDisputeGame"); - IFaultDisputeGame gameImpl = IFaultDisputeGame(payable(gameAddr)); - assertEq(gameImpl.maxGameDepth(), cfg.faultGameMaxDepth()); - assertEq(gameImpl.splitDepth(), cfg.faultGameSplitDepth()); - assertEq(gameImpl.clockExtension().raw(), cfg.faultGameClockExtension()); - assertEq(gameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration()); - assertEq(gameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate())); - assertEq(address(gameImpl.weth()), wethProxyAddr); - assertEq(address(gameImpl.anchorStateRegistry()), address(asr)); - assertEq(address(gameImpl.vm()), address(mips)); - - // Verify security override yoke configuration. - address soyGameAddr = mustGetAddress("PermissionedDisputeGame"); - IPermissionedDisputeGame soyGameImpl = IPermissionedDisputeGame(payable(soyGameAddr)); - assertEq(soyGameImpl.proposer(), cfg.l2OutputOracleProposer()); - assertEq(soyGameImpl.challenger(), cfg.l2OutputOracleChallenger()); - assertEq(soyGameImpl.maxGameDepth(), cfg.faultGameMaxDepth()); - assertEq(soyGameImpl.splitDepth(), cfg.faultGameSplitDepth()); - assertEq(soyGameImpl.clockExtension().raw(), cfg.faultGameClockExtension()); - assertEq(soyGameImpl.maxClockDuration().raw(), cfg.faultGameMaxClockDuration()); - assertEq(soyGameImpl.absolutePrestate().raw(), bytes32(cfg.faultGameAbsolutePrestate())); - assertEq(address(soyGameImpl.weth()), soyWethProxyAddr); - assertEq(address(soyGameImpl.anchorStateRegistry()), address(asr)); - assertEq(address(soyGameImpl.vm()), address(mips)); - } - - /// @notice Prints a review of the fault proof configuration section of the deploy config. - function printConfigReview() internal view { - console.log(unicode"📖 FaultDisputeGame Config Overview (chainid: %d)", block.chainid); - console.log(" 0. Use Fault Proofs: %s", cfg.useFaultProofs() ? "true" : "false"); - console.log(" 1. Absolute Prestate: %x", cfg.faultGameAbsolutePrestate()); - console.log(" 2. Max Depth: %d", cfg.faultGameMaxDepth()); - console.log(" 3. Output / Execution split Depth: %d", cfg.faultGameSplitDepth()); - console.log(" 4. Clock Extension (seconds): %d", cfg.faultGameClockExtension()); - console.log(" 5. Max Clock Duration (seconds): %d", cfg.faultGameMaxClockDuration()); - console.log(" 6. L2 Genesis block number: %d", cfg.faultGameGenesisBlock()); - console.log(" 7. L2 Genesis output root: %x", uint256(cfg.faultGameGenesisOutputRoot())); - console.log(" 8. Proof Maturity Delay (seconds): ", cfg.proofMaturityDelaySeconds()); - console.log(" 9. Dispute Game Finality Delay (seconds): ", cfg.disputeGameFinalityDelaySeconds()); - console.log(" 10. Respected Game Type: ", cfg.respectedGameType()); - console.log(" 11. Preimage Oracle Min Proposal Size (bytes): ", cfg.preimageOracleMinProposalSize()); - console.log(" 12. Preimage Oracle Challenge Period (seconds): ", cfg.preimageOracleChallengePeriod()); - } -}