Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSM: Begin implementing OP Stack Manager code and it's deployment #11623

Merged
merged 32 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
80711d3
begin supporting specifying versions in OPSM
mds1 Aug 26, 2024
e596583
add deploy logic
mds1 Aug 27, 2024
9ae8ac9
deploy OPSM along with implementations
mds1 Aug 27, 2024
b69c5c2
scaffold opsm interface between scripts
mds1 Aug 27, 2024
e667133
fixes
mds1 Aug 28, 2024
a2ef733
mvp of DeployOPChain
mds1 Aug 28, 2024
dc5168c
start working on an e2e opsm test, currently reverts
mds1 Aug 28, 2024
71b3664
fix tests
mds1 Aug 29, 2024
6d498d9
test cleanup
mds1 Aug 29, 2024
412e23c
rename opsmSingleton to opsm
mds1 Aug 29, 2024
f22e7d2
chore: remove unused imports
mds1 Aug 29, 2024
df20391
refactor: switch from 'new' to blueprints, 50% code size reduction
mds1 Aug 30, 2024
ac019a9
Merge branch 'develop' into opsm/deploy-op-chain
mds1 Aug 30, 2024
5480466
fix semgrep
mds1 Aug 30, 2024
60c9dc7
feat: add OPSM interop tests
mds1 Aug 30, 2024
b58a270
test: add missing specs
mds1 Aug 30, 2024
f3f15d3
Merge branch 'develop' into opsm/deploy-op-chain
mds1 Sep 3, 2024
1a4f8bf
add DisputeGameFactory deployment
mds1 Sep 3, 2024
22c637e
chore: update snapshots
mds1 Sep 3, 2024
76ade4d
Merge branch 'develop' into opsm/deploy-op-chain
mds1 Sep 6, 2024
9ccf7d8
fix opsm interop support
mds1 Sep 6, 2024
c89123a
Merge branch 'develop' into opsm/deploy-op-chain
mds1 Sep 9, 2024
8a2904f
chore: update snapshots
mds1 Sep 9, 2024
e727817
Update packages/contracts-bedrock/test/DeployOPChain.t.sol
mds1 Sep 9, 2024
8676abb
fix: add L1StandardBridge setter and initialization
mds1 Sep 9, 2024
0c40a9e
chore: small clarification of deploy flow
mds1 Sep 9, 2024
fcebe36
Update packages/contracts-bedrock/scripts/DeployImplementations.s.sol
mds1 Sep 10, 2024
0c1b274
chore: add todos
mds1 Sep 10, 2024
4717a7c
fix: change bytes32 to string
mds1 Sep 10, 2024
447504c
rename addrs to opChainAddrs for clarity
mds1 Sep 10, 2024
8e6e323
test: fix assertion string numbering
mds1 Sep 10, 2024
499758a
chore: update semver lock:
mds1 Sep 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
325 changes: 307 additions & 18 deletions packages/contracts-bedrock/scripts/DeployImplementations.s.sol
mds1 marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

69 changes: 67 additions & 2 deletions packages/contracts-bedrock/scripts/DeployOPChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol";

import { OPStackManager } from "src/L1/OPStackManager.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
Expand All @@ -38,6 +39,7 @@ contract DeployOPChainInput {
uint32 basefeeScalar;
uint32 blobBaseFeeScalar;
uint256 l2ChainId;
OPStackManager opsm;
}

bool public inputSet = false;
Expand All @@ -59,6 +61,8 @@ contract DeployOPChainInput {
require(_input.roles.unsafeBlockSigner != address(0), "DeployOPChainInput: null unsafeBlockSigner");
require(_input.roles.proposer != address(0), "DeployOPChainInput: null proposer");
require(_input.roles.challenger != address(0), "DeployOPChainInput: null challenger");
require(_input.l2ChainId != 0 && _input.l2ChainId != block.chainid, "DeployOPChainInput: invalid l2ChainId");
require(address(_input.opsm) != address(0), "DeployOPChainInput: null opsm");

inputSet = true;
inputs = _input;
Expand Down Expand Up @@ -117,6 +121,11 @@ contract DeployOPChainInput {
assertInputSet();
return inputs.l2ChainId;
}

function opsm() public view returns (OPStackManager) {
assertInputSet();
return inputs.opsm;
}
}

contract DeployOPChainOutput {
Expand Down Expand Up @@ -298,10 +307,66 @@ contract DeployOPChain is Script {
return dso.output();
}

function run(DeployOPChainInput _dsi, DeployOPChainOutput _dso) public view {
function run(DeployOPChainInput _dsi, DeployOPChainOutput _dso) public {
require(_dsi.inputSet(), "DeployOPChain: input not set");

// TODO call OP Stack Manager deploy method
OPStackManager opsm = _dsi.opsm();

OPStackManager.Roles memory roles = OPStackManager.Roles({
opChainProxyAdminOwner: _dsi.opChainProxyAdminOwner(),
systemConfigOwner: _dsi.systemConfigOwner(),
batcher: _dsi.batcher(),
unsafeBlockSigner: _dsi.unsafeBlockSigner(),
proposer: _dsi.proposer(),
challenger: _dsi.challenger()
});
OPStackManager.DeployInput memory deployInput = OPStackManager.DeployInput({
roles: roles,
basefeeScalar: _dsi.basefeeScalar(),
blobBasefeeScalar: _dsi.blobBaseFeeScalar(),
l2ChainId: _dsi.l2ChainId()
});

vm.broadcast(msg.sender);
OPStackManager.DeployOutput memory deployOutput = opsm.deploy(deployInput);
mds1 marked this conversation as resolved.
Show resolved Hide resolved

vm.label(address(deployOutput.opChainProxyAdmin), "opChainProxyAdmin");
vm.label(address(deployOutput.addressManager), "addressManager");
vm.label(address(deployOutput.l1ERC721BridgeProxy), "l1ERC721BridgeProxy");
vm.label(address(deployOutput.systemConfigProxy), "systemConfigProxy");
vm.label(address(deployOutput.optimismMintableERC20FactoryProxy), "optimismMintableERC20FactoryProxy");
vm.label(address(deployOutput.l1StandardBridgeProxy), "l1StandardBridgeProxy");
vm.label(address(deployOutput.l1CrossDomainMessengerProxy), "l1CrossDomainMessengerProxy");
vm.label(address(deployOutput.optimismPortalProxy), "optimismPortalProxy");
vm.label(address(deployOutput.disputeGameFactoryProxy), "disputeGameFactoryProxy");
vm.label(address(deployOutput.disputeGameFactoryImpl), "disputeGameFactoryImpl");
vm.label(address(deployOutput.anchorStateRegistryProxy), "anchorStateRegistryProxy");
vm.label(address(deployOutput.anchorStateRegistryImpl), "anchorStateRegistryImpl");
vm.label(address(deployOutput.faultDisputeGame), "faultDisputeGame");
vm.label(address(deployOutput.permissionedDisputeGame), "permissionedDisputeGame");
vm.label(address(deployOutput.delayedWETHPermissionedGameProxy), "delayedWETHPermissionedGameProxy");
vm.label(address(deployOutput.delayedWETHPermissionlessGameProxy), "delayedWETHPermissionlessGameProxy");

_dso.set(_dso.opChainProxyAdmin.selector, address(deployOutput.opChainProxyAdmin));
_dso.set(_dso.addressManager.selector, address(deployOutput.addressManager));
_dso.set(_dso.l1ERC721BridgeProxy.selector, address(deployOutput.l1ERC721BridgeProxy));
_dso.set(_dso.systemConfigProxy.selector, address(deployOutput.systemConfigProxy));
_dso.set(
_dso.optimismMintableERC20FactoryProxy.selector, address(deployOutput.optimismMintableERC20FactoryProxy)
);
_dso.set(_dso.l1StandardBridgeProxy.selector, address(deployOutput.l1StandardBridgeProxy));
_dso.set(_dso.l1CrossDomainMessengerProxy.selector, address(deployOutput.l1CrossDomainMessengerProxy));
_dso.set(_dso.optimismPortalProxy.selector, address(deployOutput.optimismPortalProxy));
_dso.set(_dso.disputeGameFactoryProxy.selector, address(deployOutput.disputeGameFactoryProxy));
_dso.set(_dso.disputeGameFactoryImpl.selector, address(deployOutput.disputeGameFactoryImpl));
_dso.set(_dso.anchorStateRegistryProxy.selector, address(deployOutput.anchorStateRegistryProxy));
_dso.set(_dso.anchorStateRegistryImpl.selector, address(deployOutput.anchorStateRegistryImpl));
_dso.set(_dso.faultDisputeGame.selector, address(deployOutput.faultDisputeGame));
_dso.set(_dso.permissionedDisputeGame.selector, address(deployOutput.permissionedDisputeGame));
_dso.set(_dso.delayedWETHPermissionedGameProxy.selector, address(deployOutput.delayedWETHPermissionedGameProxy));
_dso.set(
_dso.delayedWETHPermissionlessGameProxy.selector, address(deployOutput.delayedWETHPermissionlessGameProxy)
);

_dso.checkOutput();
}
Expand Down
34 changes: 33 additions & 1 deletion packages/contracts-bedrock/scripts/libraries/Solarray.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pragma solidity ^0.8.13;
// since Solidity does not have great array UX.
//
// This library was generated using the `generator.py` script from the linked repo with the length
// set to 10, and then everything except the `addresses` functions was removed.
// set accordingly, and then everything except the `addresses` functions was removed.
library Solarray {
mds1 marked this conversation as resolved.
Show resolved Hide resolved
function addresses(address a) internal pure returns (address[] memory) {
address[] memory arr = new address[](1);
Expand Down Expand Up @@ -189,6 +189,38 @@ library Solarray {
return arr;
}

function addresses(
address a,
address b,
address c,
address d,
address e,
address f,
address g,
address h,
address i,
address j,
address k
)
internal
pure
returns (address[] memory)
{
address[] memory arr = new address[](11);
arr[0] = a;
arr[1] = b;
arr[2] = c;
arr[3] = d;
arr[4] = e;
arr[5] = f;
arr[6] = g;
arr[7] = h;
arr[8] = i;
arr[9] = j;
arr[10] = k;
return arr;
}

function extend(address[] memory arr1, address[] memory arr2) internal pure returns (address[] memory newArr) {
uint256 length1 = arr1.length;
uint256 length2 = arr2.length;
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"sourceCodeHash": "0xc11a2a514a051bdc82b21ec39c7b923145d384629adb1efc52b534f3c686f6a0"
},
"src/L1/OPStackManager.sol": {
"initCodeHash": "0x67bf02405bf1ca7d78c4215c350ad9c5c7b4cece35d9fab837f279d65f995c5d",
"sourceCodeHash": "0x8e272e707e383d516b8f1cce0ea29ff46a0eb448c8386fa146e6a43f3100042a"
"initCodeHash": "0xe1eab75651e3d81ad20ca01b1e7d373b25d716ee5f8841a56e56b4531a6e0e70",
"sourceCodeHash": "0x5182a2678dadb200dd255ecdfa395e5f7b1e1e27288e78ddf8802ab51ed2dd81"
},
"src/L1/OptimismPortal.sol": {
"initCodeHash": "0x6bf59539298b20221de6c51db21016be8d3278bdbe0be1cdd49638dc828e003e",
Expand Down
Loading