Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
26ead0b5
Unverified
Commit
26ead0b5
authored
Nov 08, 2022
by
mergify[bot]
Committed by
GitHub
Nov 08, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3897 from ethereum-optimism/11-06-ctb_Add_system_config_deployment
ctb: Add system config deployment
parents
8ed14a8f
b94e9cb5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
178 additions
and
8 deletions
+178
-8
.gitignore
packages/contracts-bedrock/.gitignore
+2
-0
BaseSystemDictator.sol
...racts-bedrock/contracts/deployment/BaseSystemDictator.sol
+18
-3
FreshSystemDictator.sol
...acts-bedrock/contracts/deployment/FreshSystemDictator.sol
+18
-1
MigrationSystemDictator.sol
...-bedrock/contracts/deployment/MigrationSystemDictator.sol
+18
-1
007-SystemConfigProxy.ts
packages/contracts-bedrock/deploy/007-SystemConfigProxy.ts
+24
-0
014-SystemConfigImpl.ts
packages/contracts-bedrock/deploy/014-SystemConfigImpl.ts
+51
-0
015-FreshSystemDictator.ts
packages/contracts-bedrock/deploy/015-FreshSystemDictator.ts
+15
-0
016-FreshSystemDictatorSteps.ts
.../contracts-bedrock/deploy/016-FreshSystemDictatorSteps.ts
+0
-0
017-MigrationSystemDictator.ts
...s/contracts-bedrock/deploy/017-MigrationSystemDictator.ts
+15
-0
018-MigrationSystemDictatorSteps.ts
...tracts-bedrock/deploy/018-MigrationSystemDictatorSteps.ts
+9
-3
deploy-utils.ts
packages/contracts-bedrock/src/deploy-utils.ts
+8
-0
No files found.
packages/contracts-bedrock/.gitignore
View file @
26ead0b5
...
...
@@ -8,3 +8,5 @@ broadcast
genesis.json
src/contract-artifacts.ts
tmp-artifacts
deployments/mainnet-forked
deploy-config/mainnet-forked.json
packages/contracts-bedrock/contracts/deployment/BaseSystemDictator.sol
View file @
26ead0b5
...
...
@@ -7,6 +7,7 @@ import { OptimismPortal } from "../L1/OptimismPortal.sol";
import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol";
import { L1StandardBridge } from "../L1/L1StandardBridge.sol";
import { L1ERC721Bridge } from "../L1/L1ERC721Bridge.sol";
import { SystemConfig } from "../L1/SystemConfig.sol";
import { OptimismMintableERC20Factory } from "../universal/OptimismMintableERC20Factory.sol";
import { AddressManager } from "../legacy/AddressManager.sol";
import { PortalSender } from "./PortalSender.sol";
...
...
@@ -37,6 +38,7 @@ contract BaseSystemDictator is Ownable {
address l1StandardBridgeProxy;
address optimismMintableERC20FactoryProxy;
address l1ERC721BridgeProxy;
address systemConfigProxy;
}
/**
...
...
@@ -50,6 +52,7 @@ contract BaseSystemDictator is Ownable {
OptimismMintableERC20Factory optimismMintableERC20FactoryImpl;
L1ERC721Bridge l1ERC721BridgeImpl;
PortalSender portalSenderImpl;
SystemConfig systemConfigImpl;
}
/**
...
...
@@ -61,20 +64,32 @@ contract BaseSystemDictator is Ownable {
address l2OutputOracleOwner;
}
/**
* @notice Values for the system config contract.
*/
struct SystemConfigConfig {
address owner;
uint256 overhead;
uint256 scalar;
bytes32 batcherHash;
uint64 gasLimit;
}
/**
* @notice Combined system configuration.
*/
struct
System
Config {
struct
Deploy
Config {
GlobalConfig globalConfig;
ProxyAddressConfig proxyAddressConfig;
ImplementationAddressConfig implementationAddressConfig;
L2OutputOracleConfig l2OutputOracleConfig;
SystemConfigConfig systemConfigConfig;
}
/**
* @notice System configuration.
*/
System
Config public config;
Deploy
Config public config;
/**
* @notice Current step;
...
...
@@ -95,7 +110,7 @@ contract BaseSystemDictator is Ownable {
/**
* @param _config System configuration.
*/
constructor(
System
Config memory _config) Ownable() {
constructor(
Deploy
Config memory _config) Ownable() {
config = _config;
_transferOwnership(config.globalConfig.controller);
}
...
...
packages/contracts-bedrock/contracts/deployment/FreshSystemDictator.sol
View file @
26ead0b5
...
...
@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
import { L2OutputOracle } from "../L1/L2OutputOracle.sol";
import { OptimismPortal } from "../L1/OptimismPortal.sol";
import { SystemConfig } from "../L1/SystemConfig.sol";
import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol";
import { BaseSystemDictator } from "./BaseSystemDictator.sol";
...
...
@@ -16,7 +17,7 @@ contract FreshSystemDictator is BaseSystemDictator {
/**
* @param _config System configuration.
*/
constructor(
System
Config memory _config) BaseSystemDictator(_config) {}
constructor(
Deploy
Config memory _config) BaseSystemDictator(_config) {}
/**
* @notice Upgrades and initializes proxy contracts.
...
...
@@ -67,6 +68,22 @@ contract FreshSystemDictator is BaseSystemDictator {
payable(config.proxyAddressConfig.l1ERC721BridgeProxy),
address(config.implementationAddressConfig.l1ERC721BridgeImpl)
);
// Upgrade and initialize the SystemConfig.
config.globalConfig.proxyAdmin.upgradeAndCall(
payable(config.proxyAddressConfig.systemConfigProxy),
address(config.implementationAddressConfig.systemConfigImpl),
abi.encodeCall(
SystemConfig.initialize,
(
config.systemConfigConfig.owner,
config.systemConfigConfig.overhead,
config.systemConfigConfig.scalar,
config.systemConfigConfig.batcherHash,
config.systemConfigConfig.gasLimit
)
)
);
}
/**
...
...
packages/contracts-bedrock/contracts/deployment/MigrationSystemDictator.sol
View file @
26ead0b5
...
...
@@ -7,6 +7,7 @@ import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol";
import { L1ChugSplashProxy } from "../legacy/L1ChugSplashProxy.sol";
import { ProxyAdmin } from "../universal/ProxyAdmin.sol";
import { PortalSender } from "./PortalSender.sol";
import { SystemConfig } from "../L1/SystemConfig.sol";
import { BaseSystemDictator } from "./BaseSystemDictator.sol";
/**
...
...
@@ -19,7 +20,7 @@ contract MigrationSystemDictator is BaseSystemDictator {
/**
* @param _config System configuration.
*/
constructor(
System
Config memory _config) BaseSystemDictator(_config) {}
constructor(
Deploy
Config memory _config) BaseSystemDictator(_config) {}
/**
* @notice Configures the ProxyAdmin contract.
...
...
@@ -153,6 +154,22 @@ contract MigrationSystemDictator is BaseSystemDictator {
payable(config.proxyAddressConfig.l1ERC721BridgeProxy),
address(config.implementationAddressConfig.l1ERC721BridgeImpl)
);
// Upgrade and initialize the SystemConfig.
config.globalConfig.proxyAdmin.upgradeAndCall(
payable(config.proxyAddressConfig.systemConfigProxy),
address(config.implementationAddressConfig.systemConfigImpl),
abi.encodeCall(
SystemConfig.initialize,
(
config.systemConfigConfig.owner,
config.systemConfigConfig.overhead,
config.systemConfigConfig.scalar,
config.systemConfigConfig.batcherHash,
config.systemConfigConfig.gasLimit
)
)
);
}
/**
...
...
packages/contracts-bedrock/deploy/007-SystemConfigProxy.ts
0 → 100644
View file @
26ead0b5
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
assertContractVariable
,
deployAndVerifyAndThen
,
getDeploymentAddress
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
await
deployAndVerifyAndThen
({
hre
,
name
:
'
SystemConfigProxy
'
,
contract
:
'
Proxy
'
,
args
:
[
proxyAdmin
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
admin
'
,
proxyAdmin
)
},
})
}
deployFn
.
tags
=
[
'
SystemConfigProxy
'
,
'
fresh
'
,
'
migration
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/014-SystemConfigImpl.ts
0 → 100644
View file @
26ead0b5
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
{
assertContractVariable
,
deployAndVerifyAndThen
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
batcherHash
=
hre
.
ethers
.
utils
.
hexZeroPad
(
hre
.
deployConfig
.
batchSenderAddress
,
32
)
await
deployAndVerifyAndThen
({
hre
,
name
:
'
SystemConfig
'
,
args
:
[
hre
.
deployConfig
.
systemConfigOwner
,
hre
.
deployConfig
.
gasPriceOracleOverhead
,
hre
.
deployConfig
.
gasPriceOracleScalar
,
batcherHash
,
hre
.
deployConfig
.
l2GenesisBlockGasLimit
,
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
owner
'
,
hre
.
deployConfig
.
systemConfigOwner
)
await
assertContractVariable
(
contract
,
'
overhead
'
,
hre
.
deployConfig
.
gasPriceOracleOverhead
)
await
assertContractVariable
(
contract
,
'
scalar
'
,
hre
.
deployConfig
.
gasPriceOracleScalar
)
await
assertContractVariable
(
contract
,
'
batcherHash
'
,
batcherHash
.
toLowerCase
()
)
},
})
}
deployFn
.
tags
=
[
'
SystemConfigImpl
'
,
'
fresh
'
,
'
migration
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/01
4-FreshSystemDic
ator.ts
→
packages/contracts-bedrock/deploy/01
5-FreshSystemDict
ator.ts
View file @
26ead0b5
...
...
@@ -46,6 +46,10 @@ const deployFn: DeployFunction = async (hre) => {
hre
,
'
L1ERC721BridgeProxy
'
),
systemConfigProxy
:
await
getDeploymentAddress
(
hre
,
'
SystemConfigProxy
'
),
},
implementationAddressConfig
:
{
l2OutputOracleImpl
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracle
'
),
...
...
@@ -64,6 +68,7 @@ const deployFn: DeployFunction = async (hre) => {
),
l1ERC721BridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721Bridge
'
),
portalSenderImpl
:
await
getDeploymentAddress
(
hre
,
'
PortalSender
'
),
systemConfigImpl
:
await
getDeploymentAddress
(
hre
,
'
SystemConfig
'
),
},
l2OutputOracleConfig
:
{
l2OutputOracleGenesisL2Output
:
...
...
@@ -71,6 +76,16 @@ const deployFn: DeployFunction = async (hre) => {
l2OutputOracleProposer
:
hre
.
deployConfig
.
l2OutputOracleProposer
,
l2OutputOracleOwner
:
hre
.
deployConfig
.
l2OutputOracleOwner
,
},
systemConfigConfig
:
{
owner
:
hre
.
deployConfig
.
systemConfigOwner
,
overhead
:
hre
.
deployConfig
.
gasPriceOracleOverhead
,
scalar
:
hre
.
deployConfig
.
gasPriceOracleDecimals
,
batcherHash
:
hre
.
ethers
.
utils
.
hexZeroPad
(
hre
.
deployConfig
.
batchSenderAddress
,
32
),
gasLimit
:
hre
.
deployConfig
.
l2GenesisBlockGasLimit
,
},
},
],
postDeployAction
:
async
()
=>
{
...
...
packages/contracts-bedrock/deploy/01
5
-FreshSystemDictatorSteps.ts
→
packages/contracts-bedrock/deploy/01
6
-FreshSystemDictatorSteps.ts
View file @
26ead0b5
File moved
packages/contracts-bedrock/deploy/01
6
-MigrationSystemDictator.ts
→
packages/contracts-bedrock/deploy/01
7
-MigrationSystemDictator.ts
View file @
26ead0b5
...
...
@@ -81,6 +81,10 @@ const deployFn: DeployFunction = async (hre) => {
hre
,
'
L1ERC721BridgeProxy
'
),
systemConfigProxy
:
await
getDeploymentAddress
(
hre
,
'
SystemConfigProxy
'
),
},
implementationAddressConfig
:
{
l2OutputOracleImpl
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracle
'
),
...
...
@@ -99,6 +103,7 @@ const deployFn: DeployFunction = async (hre) => {
),
l1ERC721BridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721Bridge
'
),
portalSenderImpl
:
await
getDeploymentAddress
(
hre
,
'
PortalSender
'
),
systemConfigImpl
:
await
getDeploymentAddress
(
hre
,
'
SystemConfig
'
),
},
l2OutputOracleConfig
:
{
l2OutputOracleGenesisL2Output
:
...
...
@@ -106,6 +111,16 @@ const deployFn: DeployFunction = async (hre) => {
l2OutputOracleProposer
:
hre
.
deployConfig
.
l2OutputOracleProposer
,
l2OutputOracleOwner
:
hre
.
deployConfig
.
l2OutputOracleOwner
,
},
systemConfigConfig
:
{
owner
:
hre
.
deployConfig
.
systemConfigOwner
,
overhead
:
hre
.
deployConfig
.
gasPriceOracleOverhead
,
scalar
:
hre
.
deployConfig
.
gasPriceOracleDecimals
,
batcherHash
:
hre
.
ethers
.
utils
.
hexZeroPad
(
hre
.
deployConfig
.
batchSenderAddress
,
32
),
gasLimit
:
hre
.
deployConfig
.
l2GenesisBlockGasLimit
,
},
},
],
postDeployAction
:
async
()
=>
{
...
...
packages/contracts-bedrock/deploy/01
7
-MigrationSystemDictatorSteps.ts
→
packages/contracts-bedrock/deploy/01
8
-MigrationSystemDictatorSteps.ts
View file @
26ead0b5
...
...
@@ -116,7 +116,13 @@ const deployFn: DeployFunction = async (hre) => {
hre
,
'
Proxy__OVM_L1StandardBridge
'
)
if
((
await
L1StandardBridge
.
owner
())
!==
MigrationSystemDictator
.
address
)
{
const
getOwnerOpts
=
{
from
:
ethers
.
constants
.
AddressZero
,
}
if
(
(
await
L1StandardBridge
.
callStatic
.
getOwner
(
getOwnerOpts
))
!==
MigrationSystemDictator
.
address
)
{
if
(
isLiveDeployer
)
{
console
.
log
(
`Transferring ownership of L1StandardBridge to the MigrationSystemDictator...`
...
...
@@ -135,7 +141,7 @@ const deployFn: DeployFunction = async (hre) => {
)
}
await
awaitCondition
(
async
()
=>
{
const
owner
=
await
L1StandardBridge
.
callStatic
.
getOwner
()
const
owner
=
await
L1StandardBridge
.
callStatic
.
getOwner
(
getOwnerOpts
)
return
owner
===
MigrationSystemDictator
.
address
})
}
else
{
...
...
@@ -152,7 +158,7 @@ const deployFn: DeployFunction = async (hre) => {
await
awaitCondition
(
async
()
=>
{
const
step
=
await
MigrationSystemDictator
.
currentStep
()
return
step
.
toNumber
(
)
===
i
+
1
return
Number
(
step
)
===
i
+
1
})
}
}
...
...
packages/contracts-bedrock/src/deploy-utils.ts
View file @
26ead0b5
...
...
@@ -280,6 +280,14 @@ export const assertContractVariable = async (
from
:
ethers
.
constants
.
AddressZero
,
})
if
(
ethers
.
utils
.
isAddress
(
expected
))
{
assert
(
actual
.
toLowerCase
()
===
expected
.
toLowerCase
(),
`[FATAL]
${
variable
}
is
${
actual
}
but should be
${
expected
}
`
)
return
}
assert
(
actual
===
expected
||
(
actual
.
eq
&&
actual
.
eq
(
expected
)),
`[FATAL]
${
variable
}
is
${
actual
}
but should be
${
expected
}
`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment