Commit 0a40d050 authored by Maurelian's avatar Maurelian Committed by GitHub

feat: Replace deployImplementations with call to DeployImplementations.run()

 (#12260)

* feat: Rename setupSuperchain to deploySuperchain

* feat: Replace deployImplementations with call to DeployImplementations.run()

* feat: Add implsUnstrict() to get all impl addresses

* feat: Remove deployL1xDM and move its ChainAssertion to deployImplementations

* feat: Remove deployOptimismPortal2 and move its assertion to deplyImpls

* feat: Remove deployOptimismMintableFactory and move its assertion to deplyImpl

* fix: test file name

* fix: Incorrect implementation contract name in _implUnstrict()

* feat: Add checkSystemConfigInterop

* feat: Move unused deploySuperchainConfig to DeployOwnership

* feat: Delete deployOptimismPortalInterop

* feat: Delete unused FP deploy functions

Preimage Oracle
DelayedWeth
DGF

A ChainAssertion was also added for the PreimageOracle

* feat: Delete deploySystemConfig

* feat: remove superfluous Unstrict suffix from contract getters

* feat: Improve reason string in checkSystemConfigI

* feat: Add missing chainAssertions

* feat: Require interop flag sanity

* feat: limit fuzz runs in CI on this test
parent 289f0748
...@@ -9,6 +9,7 @@ import { console2 as console } from "forge-std/console2.sol"; ...@@ -9,6 +9,7 @@ import { console2 as console } from "forge-std/console2.sol";
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol"; import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Deployer } from "scripts/deploy/Deployer.sol"; import { Deployer } from "scripts/deploy/Deployer.sol";
import { ISystemConfigV0 } from "scripts/interfaces/ISystemConfigV0.sol"; import { ISystemConfigV0 } from "scripts/interfaces/ISystemConfigV0.sol";
import { ISystemConfigInterop } from "src/L1/interfaces/ISystemConfigInterop.sol";
// Libraries // Libraries
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
...@@ -29,6 +30,8 @@ import { ProtocolVersion, IProtocolVersions } from "src/L1/interfaces/IProtocolV ...@@ -29,6 +30,8 @@ import { ProtocolVersion, IProtocolVersions } from "src/L1/interfaces/IProtocolV
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol"; import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; 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 { IMIPS } from "src/cannon/interfaces/IMIPS.sol";
library ChainAssertions { library ChainAssertions {
Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
...@@ -134,6 +137,32 @@ library ChainAssertions { ...@@ -134,6 +137,32 @@ library ChainAssertions {
} }
} }
/// @notice Asserts that the SystemConfigInterop is setup correctly
function checkSystemConfigInterop(
Types.ContractSet memory _contracts,
DeployConfig _cfg,
bool _isProxy
)
internal
view
{
ISystemConfigInterop config = ISystemConfigInterop(_contracts.SystemConfig);
console.log(
"Running chain assertions on the SystemConfigInterop %s at %s",
_isProxy ? "proxy" : "implementation",
address(config)
);
checkSystemConfig(_contracts, _cfg, _isProxy);
if (_isProxy) {
// TODO: this is not being set in the deployment, nor is a config value.
// Update this when it has an entry in hardhat.json
require(config.dependencyManager() == address(0), "CHECK-SCFGI-10");
} else {
require(config.dependencyManager() == address(0), "CHECK-SCFGI-20");
}
}
/// @notice Asserts that the L1CrossDomainMessenger is setup correctly /// @notice Asserts that the L1CrossDomainMessenger is setup correctly
function checkL1CrossDomainMessenger(Types.ContractSet memory _contracts, Vm _vm, bool _isProxy) internal view { function checkL1CrossDomainMessenger(Types.ContractSet memory _contracts, Vm _vm, bool _isProxy) internal view {
IL1CrossDomainMessenger messenger = IL1CrossDomainMessenger(_contracts.L1CrossDomainMessenger); IL1CrossDomainMessenger messenger = IL1CrossDomainMessenger(_contracts.L1CrossDomainMessenger);
...@@ -215,6 +244,23 @@ library ChainAssertions { ...@@ -215,6 +244,23 @@ library ChainAssertions {
require(factory.owner() == _expectedOwner, "CHECK-DG-20"); require(factory.owner() == _expectedOwner, "CHECK-DG-20");
} }
/// @notice Asserts that the PreimageOracle is setup correctly
function checkPreimageOracle(IPreimageOracle _oracle, DeployConfig _cfg) internal view {
console.log("Running chain assertions on the PreimageOracle %s at %s", address(_oracle));
require(address(_oracle) != address(0), "CHECK-PIO-10");
require(_oracle.minProposalSize() == _cfg.preimageOracleMinProposalSize(), "CHECK-PIO-30");
require(_oracle.challengePeriod() == _cfg.preimageOracleChallengePeriod(), "CHECK-PIO-40");
}
/// @notice Asserts that the MIPs contract is setup correctly
function checkMIPS(IMIPS _mips, IPreimageOracle _oracle) internal view {
console.log("Running chain assertions on the MIPS %s at %s", address(_mips));
require(address(_mips) != address(0), "CHECK-MIPS-10");
require(_mips.oracle() == _oracle, "CHECK-MIPS-20");
}
/// @notice Asserts that the DelayedWETH is setup correctly /// @notice Asserts that the DelayedWETH is setup correctly
function checkDelayedWETH( function checkDelayedWETH(
Types.ContractSet memory _contracts, Types.ContractSet memory _contracts,
......
...@@ -18,6 +18,12 @@ import { Process } from "scripts/libraries/Process.sol"; ...@@ -18,6 +18,12 @@ import { Process } from "scripts/libraries/Process.sol";
import { ChainAssertions } from "scripts/deploy/ChainAssertions.sol"; import { ChainAssertions } from "scripts/deploy/ChainAssertions.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
import { DeploySuperchainInput, DeploySuperchain, DeploySuperchainOutput } from "scripts/DeploySuperchain.s.sol"; import { DeploySuperchainInput, DeploySuperchain, DeploySuperchainOutput } from "scripts/DeploySuperchain.s.sol";
import {
DeployImplementationsInput,
DeployImplementations,
DeployImplementationsInterop,
DeployImplementationsOutput
} from "scripts/DeployImplementations.s.sol";
// Contracts // Contracts
import { AddressManager } from "src/legacy/AddressManager.sol"; import { AddressManager } from "src/legacy/AddressManager.sol";
...@@ -52,6 +58,7 @@ import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol" ...@@ -52,6 +58,7 @@ import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"
import { IPermissionedDisputeGame } from "src/dispute/interfaces/IPermissionedDisputeGame.sol"; import { IPermissionedDisputeGame } from "src/dispute/interfaces/IPermissionedDisputeGame.sol";
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol"; import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
import { IMIPS } from "src/cannon/interfaces/IMIPS.sol";
import { IMIPS2 } from "src/cannon/interfaces/IMIPS2.sol"; import { IMIPS2 } from "src/cannon/interfaces/IMIPS2.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol"; import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
...@@ -145,7 +152,7 @@ contract Deploy is Deployer { ...@@ -145,7 +152,7 @@ contract Deploy is Deployer {
} }
/// @notice Returns the proxy addresses, not reverting if any are unset. /// @notice Returns the proxy addresses, not reverting if any are unset.
function _proxiesUnstrict() internal view returns (Types.ContractSet memory proxies_) { function _proxies() internal view returns (Types.ContractSet memory proxies_) {
proxies_ = Types.ContractSet({ proxies_ = Types.ContractSet({
L1CrossDomainMessenger: getAddress("L1CrossDomainMessengerProxy"), L1CrossDomainMessenger: getAddress("L1CrossDomainMessengerProxy"),
L1StandardBridge: getAddress("L1StandardBridgeProxy"), L1StandardBridge: getAddress("L1StandardBridgeProxy"),
...@@ -164,6 +171,26 @@ contract Deploy is Deployer { ...@@ -164,6 +171,26 @@ contract Deploy is Deployer {
}); });
} }
/// @notice Returns the impl addresses, not reverting if any are unset.
function _impls() internal view returns (Types.ContractSet memory proxies_) {
proxies_ = Types.ContractSet({
L1CrossDomainMessenger: getAddress("L1CrossDomainMessenger"),
L1StandardBridge: getAddress("L1StandardBridge"),
L2OutputOracle: getAddress("L2OutputOracle"),
DisputeGameFactory: getAddress("DisputeGameFactory"),
DelayedWETH: getAddress("DelayedWETH"),
PermissionedDelayedWETH: getAddress("PermissionedDelayedWETH"),
AnchorStateRegistry: getAddress("AnchorStateRegistry"),
OptimismMintableERC20Factory: getAddress("OptimismMintableERC20Factory"),
OptimismPortal: getAddress("OptimismPortal"),
OptimismPortal2: getAddress("OptimismPortal2"),
SystemConfig: getAddress("SystemConfig"),
L1ERC721Bridge: getAddress("L1ERC721Bridge"),
ProtocolVersions: getAddress("ProtocolVersions"),
SuperchainConfig: getAddress("SuperchainConfig")
});
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// State Changing Helper Functions // // State Changing Helper Functions //
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
...@@ -251,14 +278,10 @@ contract Deploy is Deployer { ...@@ -251,14 +278,10 @@ contract Deploy is Deployer {
// Set up the Superchain if needed. // Set up the Superchain if needed.
if (_needsSuperchain) { if (_needsSuperchain) {
setupSuperchain(); deploySuperchain();
} }
if (cfg.useInterop()) { deployImplementations({ _isInterop: cfg.useInterop() });
deployImplementationsInterop();
} else {
deployImplementations();
}
// Deploy Current OPChain Contracts // Deploy Current OPChain Contracts
deployOpChain(); deployOpChain();
...@@ -296,10 +319,10 @@ contract Deploy is Deployer { ...@@ -296,10 +319,10 @@ contract Deploy is Deployer {
/// The Superchain system has 2 singleton contracts which lie outside of an OP Chain: /// The Superchain system has 2 singleton contracts which lie outside of an OP Chain:
/// 1. The SuperchainConfig contract /// 1. The SuperchainConfig contract
/// 2. The ProtocolVersions contract /// 2. The ProtocolVersions contract
function setupSuperchain() public { function deploySuperchain() public {
console.log("Setting up Superchain"); console.log("Setting up Superchain");
DeploySuperchain deploySuperchain = new DeploySuperchain(); DeploySuperchain ds = new DeploySuperchain();
(DeploySuperchainInput dsi, DeploySuperchainOutput dso) = deploySuperchain.etchIOContracts(); (DeploySuperchainInput dsi, DeploySuperchainOutput dso) = ds.etchIOContracts();
// Set the input values on the input contract. // Set the input values on the input contract.
// TODO: when DeployAuthSystem is done, finalSystemOwner should be replaced with the Foundation Upgrades Safe // TODO: when DeployAuthSystem is done, finalSystemOwner should be replaced with the Foundation Upgrades Safe
...@@ -311,7 +334,7 @@ contract Deploy is Deployer { ...@@ -311,7 +334,7 @@ contract Deploy is Deployer {
dsi.set(dsi.recommendedProtocolVersion.selector, ProtocolVersion.wrap(cfg.recommendedProtocolVersion())); dsi.set(dsi.recommendedProtocolVersion.selector, ProtocolVersion.wrap(cfg.recommendedProtocolVersion()));
// Run the deployment script. // Run the deployment script.
deploySuperchain.run(dsi, dso); ds.run(dsi, dso);
save("SuperchainProxyAdmin", address(dso.superchainProxyAdmin())); save("SuperchainProxyAdmin", address(dso.superchainProxyAdmin()));
save("SuperchainConfigProxy", address(dso.superchainConfigProxy())); save("SuperchainConfigProxy", address(dso.superchainConfigProxy()));
save("SuperchainConfig", address(dso.superchainConfigImpl())); save("SuperchainConfig", address(dso.superchainConfigImpl()));
...@@ -319,7 +342,7 @@ contract Deploy is Deployer { ...@@ -319,7 +342,7 @@ contract Deploy is Deployer {
save("ProtocolVersions", address(dso.protocolVersionsImpl())); save("ProtocolVersions", address(dso.protocolVersionsImpl()));
// First run assertions for the ProtocolVersions and SuperchainConfig proxy contracts. // First run assertions for the ProtocolVersions and SuperchainConfig proxy contracts.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxies();
ChainAssertions.checkProtocolVersions({ _contracts: contracts, _cfg: cfg, _isProxy: true }); ChainAssertions.checkProtocolVersions({ _contracts: contracts, _cfg: cfg, _isProxy: true });
ChainAssertions.checkSuperchainConfig({ _contracts: contracts, _cfg: cfg, _isProxy: true, _isPaused: false }); ChainAssertions.checkSuperchainConfig({ _contracts: contracts, _cfg: cfg, _isProxy: true, _isPaused: false });
...@@ -373,39 +396,71 @@ contract Deploy is Deployer { ...@@ -373,39 +396,71 @@ contract Deploy is Deployer {
} }
/// @notice Deploy all of the implementations /// @notice Deploy all of the implementations
function deployImplementations() public { function deployImplementations(bool _isInterop) public {
// TODO: Replace the actions in this function with a call to DeployImplementationsInterop.run() require(_isInterop == cfg.useInterop(), "Deploy: Interop setting mismatch.");
console.log("Deploying implementations"); console.log("Deploying implementations");
deployL1CrossDomainMessenger(); DeployImplementations di = new DeployImplementations();
deployOptimismMintableERC20Factory(); (DeployImplementationsInput dii, DeployImplementationsOutput dio) = di.etchIOContracts();
deploySystemConfig();
deployL1StandardBridge(); dii.set(dii.withdrawalDelaySeconds.selector, cfg.faultGameWithdrawalDelay());
deployL1ERC721Bridge(); dii.set(dii.minProposalSizeBytes.selector, cfg.preimageOracleMinProposalSize());
dii.set(dii.challengePeriodSeconds.selector, cfg.preimageOracleChallengePeriod());
dii.set(dii.proofMaturityDelaySeconds.selector, cfg.proofMaturityDelaySeconds());
dii.set(dii.disputeGameFinalityDelaySeconds.selector, cfg.disputeGameFinalityDelaySeconds());
string memory release = "dev";
dii.set(dii.release.selector, release);
dii.set(
dii.standardVersionsToml.selector, string.concat(vm.projectRoot(), "/test/fixtures/standard-versions.toml")
);
dii.set(dii.superchainConfigProxy.selector, mustGetAddress("SuperchainConfigProxy"));
dii.set(dii.protocolVersionsProxy.selector, mustGetAddress("ProtocolVersionsProxy"));
dii.set(dii.opcmProxyOwner.selector, cfg.finalSystemOwner());
// Fault proofs if (_isInterop) {
deployOptimismPortal2(); di = DeployImplementations(new DeployImplementationsInterop());
deployDisputeGameFactory(); }
deployDelayedWETH(); di.run(dii, dio);
deployPreimageOracle();
deployMips();
}
/// @notice Deploy all of the implementations save("L1CrossDomainMessenger", address(dio.l1CrossDomainMessengerImpl()));
function deployImplementationsInterop() public { save("OptimismMintableERC20Factory", address(dio.optimismMintableERC20FactoryImpl()));
// TODO: Replace the actions in this function with a call to DeployImplementationsInterop.run() save("SystemConfig", address(dio.systemConfigImpl()));
console.log("Deploying implementations"); save("L1StandardBridge", address(dio.l1StandardBridgeImpl()));
deployL1CrossDomainMessenger(); save("L1ERC721Bridge", address(dio.l1ERC721BridgeImpl()));
deployOptimismMintableERC20Factory();
deploySystemConfigInterop();
deployL1StandardBridge();
deployL1ERC721Bridge();
// Fault proofs // Fault proofs
deployOptimismPortalInterop(); save("OptimismPortal2", address(dio.optimismPortalImpl()));
deployDisputeGameFactory(); save("DisputeGameFactory", address(dio.disputeGameFactoryImpl()));
deployDelayedWETH(); save("DelayedWETH", address(dio.delayedWETHImpl()));
deployPreimageOracle(); save("PreimageOracle", address(dio.preimageOracleSingleton()));
deployMips(); save("Mips", address(dio.mipsSingleton()));
Types.ContractSet memory contracts = _impls();
ChainAssertions.checkL1CrossDomainMessenger({ _contracts: contracts, _vm: vm, _isProxy: false });
ChainAssertions.checkL1StandardBridge({ _contracts: contracts, _isProxy: false });
ChainAssertions.checkL1ERC721Bridge({ _contracts: contracts, _isProxy: false });
ChainAssertions.checkOptimismPortal2({ _contracts: contracts, _cfg: cfg, _isProxy: false });
ChainAssertions.checkOptimismMintableERC20Factory({ _contracts: contracts, _isProxy: false });
ChainAssertions.checkDisputeGameFactory({ _contracts: contracts, _expectedOwner: address(0), _isProxy: false });
ChainAssertions.checkDelayedWETH({
_contracts: contracts,
_cfg: cfg,
_isProxy: false,
_expectedOwner: address(0)
});
ChainAssertions.checkPreimageOracle({
_oracle: IPreimageOracle(address(dio.preimageOracleSingleton())),
_cfg: cfg
});
ChainAssertions.checkMIPS({
_mips: IMIPS(address(dio.mipsSingleton())),
_oracle: IPreimageOracle(address(dio.preimageOracleSingleton()))
});
if (_isInterop) {
ChainAssertions.checkSystemConfigInterop({ _contracts: contracts, _cfg: cfg, _isProxy: false });
} else {
ChainAssertions.checkSystemConfig({ _contracts: contracts, _cfg: cfg, _isProxy: false });
}
} }
/// @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
...@@ -582,43 +637,6 @@ contract Deploy is Deployer { ...@@ -582,43 +637,6 @@ contract Deploy is Deployer {
// Implementation Deployment Functions // // Implementation Deployment Functions //
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
/// @notice Deploy the SuperchainConfig contract
function deploySuperchainConfig() public broadcast {
ISuperchainConfig superchainConfig = ISuperchainConfig(
DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "SuperchainConfig",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISuperchainConfig.__constructor__, ()))
})
);
require(superchainConfig.guardian() == address(0));
bytes32 initialized = vm.load(address(superchainConfig), bytes32(0));
require(initialized != 0);
}
/// @notice Deploy the L1CrossDomainMessenger
function deployL1CrossDomainMessenger() public broadcast returns (address addr_) {
IL1CrossDomainMessenger messenger = IL1CrossDomainMessenger(
DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "L1CrossDomainMessenger",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IL1CrossDomainMessenger.__constructor__, ()))
})
);
// Override the `L1CrossDomainMessenger` contract to the deployed implementation. This is necessary
// to check the `L1CrossDomainMessenger` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.L1CrossDomainMessenger = address(messenger);
ChainAssertions.checkL1CrossDomainMessenger({ _contracts: contracts, _vm: vm, _isProxy: false });
addr_ = address(messenger);
}
/// @notice Deploy the OptimismPortal /// @notice Deploy the OptimismPortal
function deployOptimismPortal() public broadcast returns (address addr_) { function deployOptimismPortal() public broadcast returns (address addr_) {
if (cfg.useInterop()) { if (cfg.useInterop()) {
...@@ -635,66 +653,11 @@ contract Deploy is Deployer { ...@@ -635,66 +653,11 @@ contract Deploy is Deployer {
// Override the `OptimismPortal` contract to the deployed implementation. This is necessary // Override the `OptimismPortal` contract to the deployed implementation. This is necessary
// to check the `OptimismPortal` implementation alongside dependent contracts, which // to check the `OptimismPortal` implementation alongside dependent contracts, which
// are always proxies. // are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxies();
contracts.OptimismPortal = addr_; contracts.OptimismPortal = addr_;
ChainAssertions.checkOptimismPortal({ _contracts: contracts, _cfg: cfg, _isProxy: false }); ChainAssertions.checkOptimismPortal({ _contracts: contracts, _cfg: cfg, _isProxy: false });
} }
/// @notice Deploy the OptimismPortal2
function deployOptimismPortal2() public broadcast returns (address addr_) {
// Could also verify this inside DeployConfig but doing it here is a bit more reliable.
require(
uint32(cfg.respectedGameType()) == cfg.respectedGameType(), "Deploy: respectedGameType must fit into uint32"
);
addr_ = DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "OptimismPortal2",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IOptimismPortal2.__constructor__,
(cfg.proofMaturityDelaySeconds(), cfg.disputeGameFinalityDelaySeconds())
)
)
});
// Override the `OptimismPortal2` contract to the deployed implementation. This is necessary
// to check the `OptimismPortal2` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.OptimismPortal2 = addr_;
ChainAssertions.checkOptimismPortal2({ _contracts: contracts, _cfg: cfg, _isProxy: false });
}
/// @notice Deploy the OptimismPortalInterop contract
function deployOptimismPortalInterop() public broadcast returns (address addr_) {
// Could also verify this inside DeployConfig but doing it here is a bit more reliable.
require(
uint32(cfg.respectedGameType()) == cfg.respectedGameType(), "Deploy: respectedGameType must fit into uint32"
);
addr_ = DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "OptimismPortalInterop",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IOptimismPortalInterop.__constructor__,
(cfg.proofMaturityDelaySeconds(), cfg.disputeGameFinalityDelaySeconds())
)
)
});
save("OptimismPortal2", addr_);
// Override the `OptimismPortal2` contract to the deployed implementation. This is necessary
// to check the `OptimismPortal2` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.OptimismPortal2 = addr_;
ChainAssertions.checkOptimismPortal2({ _contracts: contracts, _cfg: cfg, _isProxy: false });
}
/// @notice Deploy the L2OutputOracle /// @notice Deploy the L2OutputOracle
function deployL2OutputOracle() public broadcast returns (address addr_) { function deployL2OutputOracle() public broadcast returns (address addr_) {
IL2OutputOracle oracle = IL2OutputOracle( IL2OutputOracle oracle = IL2OutputOracle(
...@@ -709,7 +672,7 @@ contract Deploy is Deployer { ...@@ -709,7 +672,7 @@ contract Deploy is Deployer {
// Override the `L2OutputOracle` contract to the deployed implementation. This is necessary // Override the `L2OutputOracle` contract to the deployed implementation. This is necessary
// to check the `L2OutputOracle` implementation alongside dependent contracts, which // to check the `L2OutputOracle` implementation alongside dependent contracts, which
// are always proxies. // are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxies();
contracts.L2OutputOracle = address(oracle); contracts.L2OutputOracle = address(oracle);
ChainAssertions.checkL2OutputOracle({ ChainAssertions.checkL2OutputOracle({
_contracts: contracts, _contracts: contracts,
...@@ -721,92 +684,6 @@ contract Deploy is Deployer { ...@@ -721,92 +684,6 @@ contract Deploy is Deployer {
addr_ = address(oracle); addr_ = address(oracle);
} }
/// @notice Deploy the OptimismMintableERC20Factory
function deployOptimismMintableERC20Factory() public broadcast returns (address addr_) {
IOptimismMintableERC20Factory factory = IOptimismMintableERC20Factory(
DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "OptimismMintableERC20Factory",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IOptimismMintableERC20Factory.__constructor__, ()))
})
);
// Override the `OptimismMintableERC20Factory` contract to the deployed implementation. This is necessary
// to check the `OptimismMintableERC20Factory` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.OptimismMintableERC20Factory = address(factory);
ChainAssertions.checkOptimismMintableERC20Factory({ _contracts: contracts, _isProxy: false });
addr_ = address(factory);
}
/// @notice Deploy the DisputeGameFactory
function deployDisputeGameFactory() public broadcast returns (address addr_) {
IDisputeGameFactory factory = IDisputeGameFactory(
DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "DisputeGameFactory",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IDisputeGameFactory.__constructor__, ()))
})
);
// Override the `DisputeGameFactory` contract to the deployed implementation. This is necessary to check the
// `DisputeGameFactory` implementation alongside dependent contracts, which are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.DisputeGameFactory = address(factory);
ChainAssertions.checkDisputeGameFactory({ _contracts: contracts, _expectedOwner: address(0), _isProxy: true });
addr_ = address(factory);
}
function deployDelayedWETH() public broadcast returns (address addr_) {
IDelayedWETH weth = IDelayedWETH(
DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "DelayedWETH",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IDelayedWETH.__constructor__, (cfg.faultGameWithdrawalDelay()))
)
})
);
// Override the `DelayedWETH` contract to the deployed implementation. This is necessary
// to check the `DelayedWETH` implementation alongside dependent contracts, which are
// always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.DelayedWETH = address(weth);
ChainAssertions.checkDelayedWETH({
_contracts: contracts,
_cfg: cfg,
_isProxy: false,
_expectedOwner: address(0)
});
addr_ = address(weth);
}
/// @notice Deploy the PreimageOracle
function deployPreimageOracle() public broadcast returns (address addr_) {
IPreimageOracle preimageOracle = IPreimageOracle(
DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "PreimageOracle",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IPreimageOracle.__constructor__,
(cfg.preimageOracleMinProposalSize(), cfg.preimageOracleChallengePeriod())
)
)
})
);
addr_ = address(preimageOracle);
}
/// @notice Deploy Mips VM. Deploys either MIPS or MIPS2 depending on the environment /// @notice Deploy Mips VM. Deploys either MIPS or MIPS2 depending on the environment
function deployMips() public broadcast returns (address addr_) { function deployMips() public broadcast returns (address addr_) {
addr_ = DeployUtils.create2AndSave({ addr_ = DeployUtils.create2AndSave({
...@@ -839,34 +716,6 @@ contract Deploy is Deployer { ...@@ -839,34 +716,6 @@ contract Deploy is Deployer {
addr_ = address(anchorStateRegistry); addr_ = address(anchorStateRegistry);
} }
/// @notice Deploy the SystemConfig
function deploySystemConfig() public broadcast returns (address addr_) {
addr_ = DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "SystemConfig",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfig.__constructor__, ()))
});
}
/// @notice Deploy the SystemConfigInterop contract
function deploySystemConfigInterop() public broadcast returns (address addr_) {
addr_ = DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "SystemConfigInterop",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfigInterop.__constructor__, ()))
});
save("SystemConfig", addr_);
// Override the `SystemConfig` contract to the deployed implementation. This is necessary
// to check the `SystemConfig` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.SystemConfig = addr_;
ChainAssertions.checkSystemConfig({ _contracts: contracts, _cfg: cfg, _isProxy: false });
}
/// @notice Deploy the L1StandardBridge /// @notice Deploy the L1StandardBridge
function deployL1StandardBridge() public broadcast returns (address addr_) { function deployL1StandardBridge() public broadcast returns (address addr_) {
IL1StandardBridge bridge = IL1StandardBridge( IL1StandardBridge bridge = IL1StandardBridge(
...@@ -881,7 +730,7 @@ contract Deploy is Deployer { ...@@ -881,7 +730,7 @@ contract Deploy is Deployer {
// Override the `L1StandardBridge` contract to the deployed implementation. This is necessary // Override the `L1StandardBridge` contract to the deployed implementation. This is necessary
// to check the `L1StandardBridge` implementation alongside dependent contracts, which // to check the `L1StandardBridge` implementation alongside dependent contracts, which
// are always proxies. // are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxies();
contracts.L1StandardBridge = address(bridge); contracts.L1StandardBridge = address(bridge);
ChainAssertions.checkL1StandardBridge({ _contracts: contracts, _isProxy: false }); ChainAssertions.checkL1StandardBridge({ _contracts: contracts, _isProxy: false });
...@@ -902,7 +751,7 @@ contract Deploy is Deployer { ...@@ -902,7 +751,7 @@ contract Deploy is Deployer {
// Override the `L1ERC721Bridge` contract to the deployed implementation. This is necessary // Override the `L1ERC721Bridge` contract to the deployed implementation. This is necessary
// to check the `L1ERC721Bridge` implementation alongside dependent contracts, which // to check the `L1ERC721Bridge` implementation alongside dependent contracts, which
// are always proxies. // are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxies();
contracts.L1ERC721Bridge = address(bridge); contracts.L1ERC721Bridge = address(bridge);
ChainAssertions.checkL1ERC721Bridge({ _contracts: contracts, _isProxy: false }); ChainAssertions.checkL1ERC721Bridge({ _contracts: contracts, _isProxy: false });
...@@ -957,11 +806,7 @@ contract Deploy is Deployer { ...@@ -957,11 +806,7 @@ contract Deploy is Deployer {
string memory version = IDisputeGameFactory(disputeGameFactoryProxy).version(); string memory version = IDisputeGameFactory(disputeGameFactoryProxy).version();
console.log("DisputeGameFactory version: %s", version); console.log("DisputeGameFactory version: %s", version);
ChainAssertions.checkDisputeGameFactory({ ChainAssertions.checkDisputeGameFactory({ _contracts: _proxies(), _expectedOwner: msg.sender, _isProxy: true });
_contracts: _proxiesUnstrict(),
_expectedOwner: msg.sender,
_isProxy: true
});
} }
function initializeDelayedWETH() public broadcast { function initializeDelayedWETH() public broadcast {
...@@ -981,7 +826,7 @@ contract Deploy is Deployer { ...@@ -981,7 +826,7 @@ contract Deploy is Deployer {
console.log("DelayedWETH version: %s", version); console.log("DelayedWETH version: %s", version);
ChainAssertions.checkDelayedWETH({ ChainAssertions.checkDelayedWETH({
_contracts: _proxiesUnstrict(), _contracts: _proxies(),
_cfg: cfg, _cfg: cfg,
_isProxy: true, _isProxy: true,
_expectedOwner: msg.sender _expectedOwner: msg.sender
...@@ -1005,7 +850,7 @@ contract Deploy is Deployer { ...@@ -1005,7 +850,7 @@ contract Deploy is Deployer {
console.log("DelayedWETH version: %s", version); console.log("DelayedWETH version: %s", version);
ChainAssertions.checkPermissionedDelayedWETH({ ChainAssertions.checkPermissionedDelayedWETH({
_contracts: _proxiesUnstrict(), _contracts: _proxies(),
_cfg: cfg, _cfg: cfg,
_isProxy: true, _isProxy: true,
_expectedOwner: msg.sender _expectedOwner: msg.sender
...@@ -1111,7 +956,7 @@ contract Deploy is Deployer { ...@@ -1111,7 +956,7 @@ contract Deploy is Deployer {
string memory version = config.version(); string memory version = config.version();
console.log("SystemConfig version: %s", version); console.log("SystemConfig version: %s", version);
ChainAssertions.checkSystemConfig({ _contracts: _proxiesUnstrict(), _cfg: cfg, _isProxy: true }); ChainAssertions.checkSystemConfig({ _contracts: _proxies(), _cfg: cfg, _isProxy: true });
} }
/// @notice Initialize the L1StandardBridge /// @notice Initialize the L1StandardBridge
...@@ -1146,7 +991,7 @@ contract Deploy is Deployer { ...@@ -1146,7 +991,7 @@ contract Deploy is Deployer {
string memory version = IL1StandardBridge(payable(l1StandardBridgeProxy)).version(); string memory version = IL1StandardBridge(payable(l1StandardBridgeProxy)).version();
console.log("L1StandardBridge version: %s", version); console.log("L1StandardBridge version: %s", version);
ChainAssertions.checkL1StandardBridge({ _contracts: _proxiesUnstrict(), _isProxy: true }); ChainAssertions.checkL1StandardBridge({ _contracts: _proxies(), _isProxy: true });
} }
/// @notice Initialize the L1ERC721Bridge /// @notice Initialize the L1ERC721Bridge
...@@ -1171,7 +1016,7 @@ contract Deploy is Deployer { ...@@ -1171,7 +1016,7 @@ contract Deploy is Deployer {
string memory version = bridge.version(); string memory version = bridge.version();
console.log("L1ERC721Bridge version: %s", version); console.log("L1ERC721Bridge version: %s", version);
ChainAssertions.checkL1ERC721Bridge({ _contracts: _proxiesUnstrict(), _isProxy: true }); ChainAssertions.checkL1ERC721Bridge({ _contracts: _proxies(), _isProxy: true });
} }
/// @notice Initialize the OptimismMintableERC20Factory /// @notice Initialize the OptimismMintableERC20Factory
...@@ -1192,7 +1037,7 @@ contract Deploy is Deployer { ...@@ -1192,7 +1037,7 @@ contract Deploy is Deployer {
string memory version = factory.version(); string memory version = factory.version();
console.log("OptimismMintableERC20Factory version: %s", version); console.log("OptimismMintableERC20Factory version: %s", version);
ChainAssertions.checkOptimismMintableERC20Factory({ _contracts: _proxiesUnstrict(), _isProxy: true }); ChainAssertions.checkOptimismMintableERC20Factory({ _contracts: _proxies(), _isProxy: true });
} }
/// @notice initializeL1CrossDomainMessenger /// @notice initializeL1CrossDomainMessenger
...@@ -1238,7 +1083,7 @@ contract Deploy is Deployer { ...@@ -1238,7 +1083,7 @@ contract Deploy is Deployer {
string memory version = messenger.version(); string memory version = messenger.version();
console.log("L1CrossDomainMessenger version: %s", version); console.log("L1CrossDomainMessenger version: %s", version);
ChainAssertions.checkL1CrossDomainMessenger({ _contracts: _proxiesUnstrict(), _vm: vm, _isProxy: true }); ChainAssertions.checkL1CrossDomainMessenger({ _contracts: _proxies(), _vm: vm, _isProxy: true });
} }
/// @notice Initialize the L2OutputOracle /// @notice Initialize the L2OutputOracle
...@@ -1270,7 +1115,7 @@ contract Deploy is Deployer { ...@@ -1270,7 +1115,7 @@ contract Deploy is Deployer {
console.log("L2OutputOracle version: %s", version); console.log("L2OutputOracle version: %s", version);
ChainAssertions.checkL2OutputOracle({ ChainAssertions.checkL2OutputOracle({
_contracts: _proxiesUnstrict(), _contracts: _proxies(),
_cfg: cfg, _cfg: cfg,
_l2OutputOracleStartingTimestamp: cfg.l2OutputOracleStartingTimestamp(), _l2OutputOracleStartingTimestamp: cfg.l2OutputOracleStartingTimestamp(),
_isProxy: true _isProxy: true
...@@ -1304,7 +1149,7 @@ contract Deploy is Deployer { ...@@ -1304,7 +1149,7 @@ contract Deploy is Deployer {
string memory version = portal.version(); string memory version = portal.version();
console.log("OptimismPortal version: %s", version); console.log("OptimismPortal version: %s", version);
ChainAssertions.checkOptimismPortal({ _contracts: _proxiesUnstrict(), _cfg: cfg, _isProxy: true }); ChainAssertions.checkOptimismPortal({ _contracts: _proxies(), _cfg: cfg, _isProxy: true });
} }
/// @notice Initialize the OptimismPortal2 /// @notice Initialize the OptimismPortal2
...@@ -1335,7 +1180,7 @@ contract Deploy is Deployer { ...@@ -1335,7 +1180,7 @@ contract Deploy is Deployer {
string memory version = portal.version(); string memory version = portal.version();
console.log("OptimismPortal2 version: %s", version); console.log("OptimismPortal2 version: %s", version);
ChainAssertions.checkOptimismPortal2({ _contracts: _proxiesUnstrict(), _cfg: cfg, _isProxy: true }); ChainAssertions.checkOptimismPortal2({ _contracts: _proxies(), _cfg: cfg, _isProxy: true });
} }
/// @notice Transfer ownership of the DisputeGameFactory contract to the final system owner /// @notice Transfer ownership of the DisputeGameFactory contract to the final system owner
...@@ -1350,7 +1195,7 @@ contract Deploy is Deployer { ...@@ -1350,7 +1195,7 @@ contract Deploy is Deployer {
console.log("DisputeGameFactory ownership transferred to final system owner at: %s", finalSystemOwner); console.log("DisputeGameFactory ownership transferred to final system owner at: %s", finalSystemOwner);
} }
ChainAssertions.checkDisputeGameFactory({ ChainAssertions.checkDisputeGameFactory({
_contracts: _proxiesUnstrict(), _contracts: _proxies(),
_expectedOwner: finalSystemOwner, _expectedOwner: finalSystemOwner,
_isProxy: true _isProxy: true
}); });
...@@ -1368,7 +1213,7 @@ contract Deploy is Deployer { ...@@ -1368,7 +1213,7 @@ contract Deploy is Deployer {
console.log("DelayedWETH ownership transferred to final system owner at: %s", finalSystemOwner); console.log("DelayedWETH ownership transferred to final system owner at: %s", finalSystemOwner);
} }
ChainAssertions.checkDelayedWETH({ ChainAssertions.checkDelayedWETH({
_contracts: _proxiesUnstrict(), _contracts: _proxies(),
_cfg: cfg, _cfg: cfg,
_isProxy: true, _isProxy: true,
_expectedOwner: finalSystemOwner _expectedOwner: finalSystemOwner
...@@ -1387,7 +1232,7 @@ contract Deploy is Deployer { ...@@ -1387,7 +1232,7 @@ contract Deploy is Deployer {
console.log("DelayedWETH ownership transferred to final system owner at: %s", finalSystemOwner); console.log("DelayedWETH ownership transferred to final system owner at: %s", finalSystemOwner);
} }
ChainAssertions.checkPermissionedDelayedWETH({ ChainAssertions.checkPermissionedDelayedWETH({
_contracts: _proxiesUnstrict(), _contracts: _proxies(),
_cfg: cfg, _cfg: cfg,
_isProxy: true, _isProxy: true,
_expectedOwner: finalSystemOwner _expectedOwner: finalSystemOwner
......
...@@ -11,6 +11,7 @@ import { ModuleManager } from "safe-contracts/base/ModuleManager.sol"; ...@@ -11,6 +11,7 @@ import { ModuleManager } from "safe-contracts/base/ModuleManager.sol";
import { GuardManager } from "safe-contracts/base/GuardManager.sol"; import { GuardManager } from "safe-contracts/base/GuardManager.sol";
import { Enum as SafeOps } from "safe-contracts/common/Enum.sol"; import { Enum as SafeOps } from "safe-contracts/common/Enum.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
import { Deployer } from "scripts/deploy/Deployer.sol"; import { Deployer } from "scripts/deploy/Deployer.sol";
import { LivenessGuard } from "src/safe/LivenessGuard.sol"; import { LivenessGuard } from "src/safe/LivenessGuard.sol";
...@@ -317,6 +318,22 @@ contract DeployOwnership is Deploy { ...@@ -317,6 +318,22 @@ contract DeployOwnership is Deploy {
console.log("Deployed and configured the Guardian Safe!"); console.log("Deployed and configured the Guardian Safe!");
} }
/// @notice Deploy the SuperchainConfig contract
function deploySuperchainConfig() public broadcast {
ISuperchainConfig superchainConfig = ISuperchainConfig(
DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "SuperchainConfig",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISuperchainConfig.__constructor__, ()))
})
);
require(superchainConfig.guardian() == address(0));
bytes32 initialized = vm.load(address(superchainConfig), bytes32(0));
require(initialized != 0);
}
/// @notice Configure the Guardian Safe with the DeputyGuardianModule. /// @notice Configure the Guardian Safe with the DeputyGuardianModule.
function configureGuardianSafe() public broadcast returns (address addr_) { function configureGuardianSafe() public broadcast returns (address addr_) {
addr_ = mustGetAddress("GuardianSafe"); addr_ = mustGetAddress("GuardianSafe");
......
...@@ -22,6 +22,7 @@ contract DeployVariations_Test is CommonTest { ...@@ -22,6 +22,7 @@ contract DeployVariations_Test is CommonTest {
} }
} }
/// forge-config: ci.fuzz.runs = 512
/// @dev It should be possible to enable Fault Proofs with any mix of CGT and Alt-DA. /// @dev It should be possible to enable Fault Proofs with any mix of CGT and Alt-DA.
function testFuzz_enableFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual { function testFuzz_enableFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual {
enableAddOns(_enableCGT, _enableAltDa); enableAddOns(_enableCGT, _enableAltDa);
...@@ -29,6 +30,7 @@ contract DeployVariations_Test is CommonTest { ...@@ -29,6 +30,7 @@ contract DeployVariations_Test is CommonTest {
super.setUp(); super.setUp();
} }
/// forge-config: ci.fuzz.runs = 512
/// @dev It should be possible to enable Fault Proofs and Interop with any mix of CGT and Alt-DA. /// @dev It should be possible to enable Fault Proofs and Interop with any mix of CGT and Alt-DA.
function test_enableInteropAndFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual { function test_enableInteropAndFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual {
enableAddOns(_enableCGT, _enableAltDa); enableAddOns(_enableCGT, _enableAltDa);
......
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