Commit 0466b62d authored by Maurelian's avatar Maurelian Committed by GitHub

deployOpChain using OPCM (#12291)

* feat: move log to top of save function

Makes debugging slightly easier.

* feat: Deploy system with OPCM

* feat: Deploy missing Permissionless DWETH

* feat: Fully OPCM based deployment

At this point tests that depend on the L2OutputOracle will still fail,
but those with Fault Proofs _should_ pass.

* feat: Refactor _setFaultGameImplementation

It no longer handles the PERMISSIONED game type deploy by OPCM.

* test: Make caller explicit in unauthorized test case

* test: Fix have guardian setRespectedGameType to Cannon

THis is necessary because the tests assume the respecte game is cannon,
but the OPCM assumes it is the permissioned game

* test: Bridge_Initializer defaulst to FP on

* test: setRespectedGameType to Cannon in Deploy

* test: Bridge_Initializer defaulst to FP on

* feat: resetInitializedProxy func to allow reinitializing contracts

* feat: Delete initializeOpChain, we don't need it anymore

* feat: Set batch inbox address in config using hashed method

* feat: Make caller explicit in testFuzz_removeDependency_notDependencyManager_reverts

* feat: lint

* Revert "test: Bridge_Initializer defaulst to FP on"

This reverts commit d435653b5405f35970e9663cfddd5a7214fcdb57.

* feat: Consolidate useFaultProofs modifications into _run

* Revert "test: Bridge_Initializer defaulst to FP on"

This reverts commit af8d99b94393c3adef32b6ae5d5384e6766569e5.

* feat: Some annotations in Deploy.s.ol

* feat: Skip checking L2OO in Initializable.t.sol

* feat: Delete unused initialize functions

* fix: Remove unused imports

* fix: unused import

* feat: Use respectedGameType from deploy-config

* use startPrank

* feat: Prevent deploying legacy portal for interop

* fix: incorrect var name

* feat: detect when OPCM is deploying the Permissionless game

* fix: error format
parent a5d0e307
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"sequencerWindowSize": 200, "sequencerWindowSize": 200,
"channelTimeout": 120, "channelTimeout": 120,
"p2pSequencerAddress": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc", "p2pSequencerAddress": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
"batchInboxAddress": "0xff00000000000000000000000000000000000901", "batchInboxAddress": "0x00289C189bEE4E70334629f04Cd5eD602B6600eB",
"batchSenderAddress": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC", "batchSenderAddress": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
"l1StartingBlockTag": "earliest", "l1StartingBlockTag": "earliest",
"l2OutputOracleSubmissionInterval": 10, "l2OutputOracleSubmissionInterval": 10,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"sequencerWindowSize": 15, "sequencerWindowSize": 15,
"channelTimeout": 40, "channelTimeout": 40,
"p2pSequencerAddress": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc", "p2pSequencerAddress": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
"batchInboxAddress": "0xff00000000000000000000000000000000000000", "batchInboxAddress": "0x00289C189bEE4E70334629f04Cd5eD602B6600eB",
"batchSenderAddress": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC", "batchSenderAddress": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
"l2OutputOracleSubmissionInterval": 6, "l2OutputOracleSubmissionInterval": 6,
"l2OutputOracleStartingTimestamp": 1, "l2OutputOracleStartingTimestamp": 1,
......
...@@ -183,6 +183,7 @@ abstract contract Artifacts { ...@@ -183,6 +183,7 @@ abstract contract Artifacts {
/// @param _name The name of the deployment. /// @param _name The name of the deployment.
/// @param _deployed The address of the deployment. /// @param _deployed The address of the deployment.
function save(string memory _name, address _deployed) public { function save(string memory _name, address _deployed) public {
console.log("Saving %s: %s", _name, _deployed);
if (bytes(_name).length == 0) { if (bytes(_name).length == 0) {
revert InvalidDeployment("EmptyName"); revert InvalidDeployment("EmptyName");
} }
...@@ -190,7 +191,6 @@ abstract contract Artifacts { ...@@ -190,7 +191,6 @@ abstract contract Artifacts {
revert InvalidDeployment("AlreadyExists"); revert InvalidDeployment("AlreadyExists");
} }
console.log("Saving %s: %s", _name, _deployed);
Deployment memory deployment = Deployment({ name: _name, addr: payable(_deployed) }); Deployment memory deployment = Deployment({ name: _name, addr: payable(_deployed) });
_namedDeployments[_name] = deployment; _namedDeployments[_name] = deployment;
_newDeployments.push(deployment); _newDeployments.push(deployment);
......
...@@ -10,12 +10,16 @@ import { GameTypes, OutputRoot, Hash } from "src/dispute/lib/Types.sol"; ...@@ -10,12 +10,16 @@ import { GameTypes, OutputRoot, Hash } from "src/dispute/lib/Types.sol";
/// should be defined in that contract instead. /// should be defined in that contract instead.
library Constants { library Constants {
/// @notice Returns the default starting anchor roots value to be used in a new dispute game. /// @notice Returns the default starting anchor roots value to be used in a new dispute game.
function DEFAULT_OUTPUT_ROOT() internal pure returns (OutputRoot memory) {
return OutputRoot({ root: Hash.wrap(bytes32(hex"dead")), l2BlockNumber: 0 });
}
function DEFAULT_STARTING_ANCHOR_ROOTS() internal pure returns (IAnchorStateRegistry.StartingAnchorRoot[] memory) { function DEFAULT_STARTING_ANCHOR_ROOTS() internal pure returns (IAnchorStateRegistry.StartingAnchorRoot[] memory) {
IAnchorStateRegistry.StartingAnchorRoot[] memory defaultStartingAnchorRoots = IAnchorStateRegistry.StartingAnchorRoot[] memory defaultStartingAnchorRoots =
new IAnchorStateRegistry.StartingAnchorRoot[](1); new IAnchorStateRegistry.StartingAnchorRoot[](1);
defaultStartingAnchorRoots[0] = IAnchorStateRegistry.StartingAnchorRoot({ defaultStartingAnchorRoots[0] = IAnchorStateRegistry.StartingAnchorRoot({
gameType: GameTypes.PERMISSIONED_CANNON, gameType: GameTypes.PERMISSIONED_CANNON,
outputRoot: OutputRoot({ root: Hash.wrap(bytes32(hex"dead")), l2BlockNumber: 0 }) outputRoot: DEFAULT_OUTPUT_ROOT()
}); });
return defaultStartingAnchorRoots; return defaultStartingAnchorRoots;
} }
......
...@@ -80,7 +80,9 @@ contract SystemConfigInterop_Test is CommonTest { ...@@ -80,7 +80,9 @@ contract SystemConfigInterop_Test is CommonTest {
/// @dev Tests that adding a dependency as not the dependency manager reverts. /// @dev Tests that adding a dependency as not the dependency manager reverts.
function testFuzz_addDependency_notDependencyManager_reverts(uint256 _chainId) public { function testFuzz_addDependency_notDependencyManager_reverts(uint256 _chainId) public {
require(alice != _systemConfigInterop().dependencyManager(), "SystemConfigInterop_Test-100");
vm.expectRevert("SystemConfig: caller is not the dependency manager"); vm.expectRevert("SystemConfig: caller is not the dependency manager");
vm.prank(alice);
_systemConfigInterop().addDependency(_chainId); _systemConfigInterop().addDependency(_chainId);
} }
...@@ -100,7 +102,9 @@ contract SystemConfigInterop_Test is CommonTest { ...@@ -100,7 +102,9 @@ contract SystemConfigInterop_Test is CommonTest {
/// @dev Tests that removing a dependency as not the dependency manager reverts. /// @dev Tests that removing a dependency as not the dependency manager reverts.
function testFuzz_removeDependency_notDependencyManager_reverts(uint256 _chainId) public { function testFuzz_removeDependency_notDependencyManager_reverts(uint256 _chainId) public {
require(alice != _systemConfigInterop().dependencyManager(), "SystemConfigInterop_Test-100");
vm.expectRevert("SystemConfig: caller is not the dependency manager"); vm.expectRevert("SystemConfig: caller is not the dependency manager");
vm.prank(alice);
_systemConfigInterop().removeDependency(_chainId); _systemConfigInterop().removeDependency(_chainId);
} }
......
...@@ -393,7 +393,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -393,7 +393,7 @@ contract Initializer_Test is Bridge_Initializer {
/// 3. The `initialize()` function of each contract cannot be called again. /// 3. The `initialize()` function of each contract cannot be called again.
function test_cannotReinitialize_succeeds() public { function test_cannotReinitialize_succeeds() public {
// Collect exclusions. // Collect exclusions.
string[] memory excludes = new string[](8); string[] memory excludes = new string[](9);
// TODO: Neither of these contracts are labeled properly in the deployment script. Both are // TODO: Neither of these contracts are labeled properly in the deployment script. Both are
// currently being labeled as their non-interop versions. Remove these exclusions once // currently being labeled as their non-interop versions. Remove these exclusions once
// the deployment script is fixed. // the deployment script is fixed.
...@@ -412,6 +412,8 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -412,6 +412,8 @@ contract Initializer_Test is Bridge_Initializer {
// TODO: Eventually remove this exclusion. Same reason as above dispute contracts. // TODO: Eventually remove this exclusion. Same reason as above dispute contracts.
excludes[6] = "src/L1/OPContractsManager.sol"; excludes[6] = "src/L1/OPContractsManager.sol";
excludes[7] = "src/L1/OPContractsManagerInterop.sol"; excludes[7] = "src/L1/OPContractsManagerInterop.sol";
// The L2OutputOracle is not always deployed (and is no longer being modified)
excludes[8] = "src/L1/L2OutputOracle.sol";
// Get all contract names in the src directory, minus the excluded contracts. // Get all contract names in the src directory, minus the excluded contracts.
string[] memory contractNames = ForgeArtifacts.getContractNames("src/*", excludes); string[] memory contractNames = ForgeArtifacts.getContractNames("src/*", excludes);
......
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