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,
......
...@@ -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