Commit 7789e6af authored by Maurelian's avatar Maurelian Committed by GitHub

feat: Add OPCM to deployImplementations (#12287)

* feat: Move deployImplementations up to align with order of usage

* feat: Add OPCM to deployImplementations

* fix: compiler warning
parent 0a40d050
...@@ -32,6 +32,7 @@ import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; ...@@ -32,6 +32,7 @@ import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol"; import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { IMIPS } from "src/cannon/interfaces/IMIPS.sol"; import { IMIPS } from "src/cannon/interfaces/IMIPS.sol";
import { OPContractsManager } from "src/L1/OPContractsManager.sol";
library ChainAssertions { library ChainAssertions {
Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
...@@ -566,4 +567,24 @@ library ChainAssertions { ...@@ -566,4 +567,24 @@ library ChainAssertions {
"Storage value is not 1 at the given slot and offset" "Storage value is not 1 at the given slot and offset"
); );
} }
/// @notice Asserts that the SuperchainConfig is setup correctly
function checkOPContractsManager(Types.ContractSet memory _contracts, bool _isProxy) internal view {
OPContractsManager opcm = OPContractsManager(_contracts.OPContractsManager);
console.log(
"Running chain assertions on the OPContractsManager %s at %s",
_isProxy ? "proxy" : "implementation",
address(opcm)
);
require(address(opcm) != address(0), "CHECK-OPCM-10");
// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(opcm), _slot: 0, _offset: 0 });
// These values are immutable so are shared by the proxy and implementation
require(address(opcm.superchainConfig()) == address(_contracts.SuperchainConfig), "CHECK-OPCM-30");
require(address(opcm.protocolVersions()) == address(_contracts.ProtocolVersions), "CHECK-OPCM-40");
// TODO: Add assertions for blueprints and setters?
}
} }
...@@ -167,7 +167,8 @@ contract Deploy is Deployer { ...@@ -167,7 +167,8 @@ contract Deploy is Deployer {
SystemConfig: getAddress("SystemConfigProxy"), SystemConfig: getAddress("SystemConfigProxy"),
L1ERC721Bridge: getAddress("L1ERC721BridgeProxy"), L1ERC721Bridge: getAddress("L1ERC721BridgeProxy"),
ProtocolVersions: getAddress("ProtocolVersionsProxy"), ProtocolVersions: getAddress("ProtocolVersionsProxy"),
SuperchainConfig: getAddress("SuperchainConfigProxy") SuperchainConfig: getAddress("SuperchainConfigProxy"),
OPContractsManager: getAddress("OPContractsManagerProxy")
}); });
} }
...@@ -187,7 +188,8 @@ contract Deploy is Deployer { ...@@ -187,7 +188,8 @@ contract Deploy is Deployer {
SystemConfig: getAddress("SystemConfig"), SystemConfig: getAddress("SystemConfig"),
L1ERC721Bridge: getAddress("L1ERC721Bridge"), L1ERC721Bridge: getAddress("L1ERC721Bridge"),
ProtocolVersions: getAddress("ProtocolVersions"), ProtocolVersions: getAddress("ProtocolVersions"),
SuperchainConfig: getAddress("SuperchainConfig") SuperchainConfig: getAddress("SuperchainConfig"),
OPContractsManager: getAddress("OPContractsManager")
}); });
} }
...@@ -355,46 +357,6 @@ contract Deploy is Deployer { ...@@ -355,46 +357,6 @@ contract Deploy is Deployer {
ChainAssertions.checkSuperchainConfig({ _contracts: contracts, _cfg: cfg, _isPaused: false, _isProxy: false }); ChainAssertions.checkSuperchainConfig({ _contracts: contracts, _cfg: cfg, _isPaused: false, _isProxy: false });
} }
/// @notice Deploy all of the OP Chain specific contracts
function deployOpChain() public {
console.log("Deploying OP Chain");
deployAddressManager();
deployProxyAdmin();
transferAddressManagerOwnership(); // to the ProxyAdmin
// Ensure that the requisite contracts are deployed
mustGetAddress("SuperchainConfigProxy");
mustGetAddress("AddressManager");
mustGetAddress("ProxyAdmin");
deployERC1967Proxy("OptimismPortalProxy");
deployERC1967Proxy("SystemConfigProxy");
deployL1StandardBridgeProxy();
deployL1CrossDomainMessengerProxy();
deployERC1967Proxy("OptimismMintableERC20FactoryProxy");
deployERC1967Proxy("L1ERC721BridgeProxy");
// Both the DisputeGameFactory and L2OutputOracle proxies are deployed regardless of whether fault proofs is
// enabled to prevent a nastier refactor to the deploy scripts. In the future, the L2OutputOracle will be
// removed. If fault proofs are not enabled, the DisputeGameFactory proxy will be unused.
deployERC1967Proxy("DisputeGameFactoryProxy");
deployERC1967Proxy("DelayedWETHProxy");
deployERC1967Proxy("PermissionedDelayedWETHProxy");
deployERC1967Proxy("AnchorStateRegistryProxy");
deployAnchorStateRegistry();
initializeOpChain();
setAlphabetFaultGameImplementation({ _allowUpgrade: false });
setFastFaultGameImplementation({ _allowUpgrade: false });
setCannonFaultGameImplementation({ _allowUpgrade: false });
setPermissionedCannonFaultGameImplementation({ _allowUpgrade: false });
transferDisputeGameFactoryOwnership();
transferDelayedWETHOwnership();
}
/// @notice Deploy all of the implementations /// @notice Deploy all of the implementations
function deployImplementations(bool _isInterop) public { function deployImplementations(bool _isInterop) public {
require(_isInterop == cfg.useInterop(), "Deploy: Interop setting mismatch."); require(_isInterop == cfg.useInterop(), "Deploy: Interop setting mismatch.");
...@@ -434,6 +396,8 @@ contract Deploy is Deployer { ...@@ -434,6 +396,8 @@ contract Deploy is Deployer {
save("DelayedWETH", address(dio.delayedWETHImpl())); save("DelayedWETH", address(dio.delayedWETHImpl()));
save("PreimageOracle", address(dio.preimageOracleSingleton())); save("PreimageOracle", address(dio.preimageOracleSingleton()));
save("Mips", address(dio.mipsSingleton())); save("Mips", address(dio.mipsSingleton()));
save("OPContractsManagerProxy", address(dio.opcmProxy()));
save("OPContractsManager", address(dio.opcmImpl()));
Types.ContractSet memory contracts = _impls(); Types.ContractSet memory contracts = _impls();
ChainAssertions.checkL1CrossDomainMessenger({ _contracts: contracts, _vm: vm, _isProxy: false }); ChainAssertions.checkL1CrossDomainMessenger({ _contracts: contracts, _vm: vm, _isProxy: false });
...@@ -463,6 +427,46 @@ contract Deploy is Deployer { ...@@ -463,6 +427,46 @@ contract Deploy is Deployer {
} }
} }
/// @notice Deploy all of the OP Chain specific contracts
function deployOpChain() public {
console.log("Deploying OP Chain");
deployAddressManager();
deployProxyAdmin();
transferAddressManagerOwnership(); // to the ProxyAdmin
// Ensure that the requisite contracts are deployed
mustGetAddress("SuperchainConfigProxy");
mustGetAddress("AddressManager");
mustGetAddress("ProxyAdmin");
deployERC1967Proxy("OptimismPortalProxy");
deployERC1967Proxy("SystemConfigProxy");
deployL1StandardBridgeProxy();
deployL1CrossDomainMessengerProxy();
deployERC1967Proxy("OptimismMintableERC20FactoryProxy");
deployERC1967Proxy("L1ERC721BridgeProxy");
// Both the DisputeGameFactory and L2OutputOracle proxies are deployed regardless of whether fault proofs is
// enabled to prevent a nastier refactor to the deploy scripts. In the future, the L2OutputOracle will be
// removed. If fault proofs are not enabled, the DisputeGameFactory proxy will be unused.
deployERC1967Proxy("DisputeGameFactoryProxy");
deployERC1967Proxy("DelayedWETHProxy");
deployERC1967Proxy("PermissionedDelayedWETHProxy");
deployERC1967Proxy("AnchorStateRegistryProxy");
deployAnchorStateRegistry();
initializeOpChain();
setAlphabetFaultGameImplementation({ _allowUpgrade: false });
setFastFaultGameImplementation({ _allowUpgrade: false });
setCannonFaultGameImplementation({ _allowUpgrade: false });
setPermissionedCannonFaultGameImplementation({ _allowUpgrade: false });
transferDisputeGameFactoryOwnership();
transferDelayedWETHOwnership();
}
/// @notice Initialize all of the proxies in an OP Chain by upgrading to the correct proxy and calling the /// @notice Initialize all of the proxies in an OP Chain by upgrading to the correct proxy and calling the
/// initialize function /// initialize function
function initializeOpChain() public { function initializeOpChain() public {
......
...@@ -18,5 +18,6 @@ library Types { ...@@ -18,5 +18,6 @@ library Types {
address L1ERC721Bridge; address L1ERC721Bridge;
address ProtocolVersions; address ProtocolVersions;
address SuperchainConfig; address SuperchainConfig;
address OPContractsManager;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment