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
920b46b4
Unverified
Commit
920b46b4
authored
Nov 09, 2022
by
mergify[bot]
Committed by
GitHub
Nov 09, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3929 from ethereum-optimism/sc/ctb-assert-config
feat(ctb): assert dictator config
parents
26ead0b5
d9112f90
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
157 deletions
+149
-157
015-FreshSystemDictator.ts
packages/contracts-bedrock/deploy/015-FreshSystemDictator.ts
+11
-79
017-MigrationSystemDictator.ts
...s/contracts-bedrock/deploy/017-MigrationSystemDictator.ts
+6
-78
deploy-utils.ts
packages/contracts-bedrock/src/deploy-utils.ts
+132
-0
No files found.
packages/contracts-bedrock/deploy/015-FreshSystemDictator.ts
View file @
920b46b4
import
{
ethers
}
from
'
ethers
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
hardhat-deploy
'
import
'
hardhat-deploy
'
import
{
import
{
getDeploymentAddress
,
deployAndVerifyAndThen
,
deployAndVerifyAndThen
,
assertDictatorConfig
,
makeDictatorConfig
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
config
=
await
makeDictatorConfig
(
hre
,
deployer
,
hre
.
deployConfig
.
finalSystemOwner
,
true
)
await
deployAndVerifyAndThen
({
await
deployAndVerifyAndThen
({
hre
,
hre
,
name
:
'
FreshSystemDictator
'
,
name
:
'
FreshSystemDictator
'
,
args
:
[
args
:
[
config
],
{
postDeployAction
:
async
(
contract
)
=>
{
globalConfig
:
{
await
assertDictatorConfig
(
contract
,
config
)
proxyAdmin
:
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
),
controller
:
deployer
,
finalOwner
:
hre
.
deployConfig
.
finalSystemOwner
,
addressManager
:
ethers
.
constants
.
AddressZero
,
},
proxyAddressConfig
:
{
l2OutputOracleProxy
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracleProxy
'
),
optimismPortalProxy
:
await
getDeploymentAddress
(
hre
,
'
OptimismPortalProxy
'
),
l1CrossDomainMessengerProxy
:
await
getDeploymentAddress
(
hre
,
'
L1CrossDomainMessengerProxy
'
),
l1StandardBridgeProxy
:
await
getDeploymentAddress
(
hre
,
'
L1StandardBridgeProxy
'
),
optimismMintableERC20FactoryProxy
:
await
getDeploymentAddress
(
hre
,
'
OptimismMintableERC20FactoryProxy
'
),
l1ERC721BridgeProxy
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721BridgeProxy
'
),
systemConfigProxy
:
await
getDeploymentAddress
(
hre
,
'
SystemConfigProxy
'
),
},
implementationAddressConfig
:
{
l2OutputOracleImpl
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracle
'
),
optimismPortalImpl
:
await
getDeploymentAddress
(
hre
,
'
OptimismPortal
'
),
l1CrossDomainMessengerImpl
:
await
getDeploymentAddress
(
hre
,
'
L1CrossDomainMessenger
'
),
l1StandardBridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1StandardBridge
'
),
optimismMintableERC20FactoryImpl
:
await
getDeploymentAddress
(
hre
,
'
OptimismMintableERC20Factory
'
),
l1ERC721BridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721Bridge
'
),
portalSenderImpl
:
await
getDeploymentAddress
(
hre
,
'
PortalSender
'
),
systemConfigImpl
:
await
getDeploymentAddress
(
hre
,
'
SystemConfig
'
),
},
l2OutputOracleConfig
:
{
l2OutputOracleGenesisL2Output
:
hre
.
deployConfig
.
l2OutputOracleGenesisL2Output
,
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
()
=>
{
// TODO: Assert all the config was set correctly.
},
},
})
})
}
}
...
...
packages/contracts-bedrock/deploy/017-MigrationSystemDictator.ts
View file @
920b46b4
...
@@ -4,8 +4,9 @@ import '@eth-optimism/hardhat-deploy-config'
...
@@ -4,8 +4,9 @@ import '@eth-optimism/hardhat-deploy-config'
import
'
hardhat-deploy
'
import
'
hardhat-deploy
'
import
{
import
{
getDeploymentAddress
,
deployAndVerifyAndThen
,
deployAndVerifyAndThen
,
assertDictatorConfig
,
makeDictatorConfig
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
...
@@ -45,86 +46,13 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -45,86 +46,13 @@ const deployFn: DeployFunction = async (hre) => {
}
}
}
}
const
config
=
await
makeDictatorConfig
(
hre
,
controller
,
finalOwner
,
false
)
await
deployAndVerifyAndThen
({
await
deployAndVerifyAndThen
({
hre
,
hre
,
name
:
'
MigrationSystemDictator
'
,
name
:
'
MigrationSystemDictator
'
,
args
:
[
args
:
[
config
],
{
postDeployAction
:
async
(
contract
)
=>
{
globalConfig
:
{
await
assertDictatorConfig
(
contract
,
config
)
proxyAdmin
:
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
),
controller
,
finalOwner
,
addressManager
:
await
getDeploymentAddress
(
hre
,
'
Lib_AddressManager
'
),
},
proxyAddressConfig
:
{
l2OutputOracleProxy
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracleProxy
'
),
optimismPortalProxy
:
await
getDeploymentAddress
(
hre
,
'
OptimismPortalProxy
'
),
l1CrossDomainMessengerProxy
:
await
getDeploymentAddress
(
hre
,
'
Proxy__OVM_L1CrossDomainMessenger
'
),
l1StandardBridgeProxy
:
await
getDeploymentAddress
(
hre
,
'
Proxy__OVM_L1StandardBridge
'
),
optimismMintableERC20FactoryProxy
:
await
getDeploymentAddress
(
hre
,
'
OptimismMintableERC20FactoryProxy
'
),
l1ERC721BridgeProxy
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721BridgeProxy
'
),
systemConfigProxy
:
await
getDeploymentAddress
(
hre
,
'
SystemConfigProxy
'
),
},
implementationAddressConfig
:
{
l2OutputOracleImpl
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracle
'
),
optimismPortalImpl
:
await
getDeploymentAddress
(
hre
,
'
OptimismPortal
'
),
l1CrossDomainMessengerImpl
:
await
getDeploymentAddress
(
hre
,
'
L1CrossDomainMessenger
'
),
l1StandardBridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1StandardBridge
'
),
optimismMintableERC20FactoryImpl
:
await
getDeploymentAddress
(
hre
,
'
OptimismMintableERC20Factory
'
),
l1ERC721BridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721Bridge
'
),
portalSenderImpl
:
await
getDeploymentAddress
(
hre
,
'
PortalSender
'
),
systemConfigImpl
:
await
getDeploymentAddress
(
hre
,
'
SystemConfig
'
),
},
l2OutputOracleConfig
:
{
l2OutputOracleGenesisL2Output
:
hre
.
deployConfig
.
l2OutputOracleGenesisL2Output
,
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
()
=>
{
// TODO: Assert all the config was set correctly.
},
},
})
})
}
}
...
...
packages/contracts-bedrock/src/deploy-utils.ts
View file @
920b46b4
...
@@ -6,6 +6,44 @@ import { Signer } from '@ethersproject/abstract-signer'
...
@@ -6,6 +6,44 @@ import { Signer } from '@ethersproject/abstract-signer'
import
{
sleep
,
awaitCondition
,
getChainId
}
from
'
@eth-optimism/core-utils
'
import
{
sleep
,
awaitCondition
,
getChainId
}
from
'
@eth-optimism/core-utils
'
import
{
HttpNetworkConfig
}
from
'
hardhat/types
'
import
{
HttpNetworkConfig
}
from
'
hardhat/types
'
export
interface
DictatorConfig
{
globalConfig
:
{
proxyAdmin
:
string
controller
:
string
finalOwner
:
string
addressManager
:
string
}
proxyAddressConfig
:
{
l2OutputOracleProxy
:
string
optimismPortalProxy
:
string
l1CrossDomainMessengerProxy
:
string
l1StandardBridgeProxy
:
string
optimismMintableERC20FactoryProxy
:
string
l1ERC721BridgeProxy
:
string
}
implementationAddressConfig
:
{
l2OutputOracleImpl
:
string
optimismPortalImpl
:
string
l1CrossDomainMessengerImpl
:
string
l1StandardBridgeImpl
:
string
optimismMintableERC20FactoryImpl
:
string
l1ERC721BridgeImpl
:
string
portalSenderImpl
:
string
}
l2OutputOracleConfig
:
{
l2OutputOracleGenesisL2Output
:
string
l2OutputOracleProposer
:
string
l2OutputOracleOwner
:
string
}
systemConfigConfig
:
{
owner
:
string
overhead
:
number
scalar
:
number
batcherHash
:
string
gasLimit
:
number
}
}
export
const
deployAndVerifyAndThen
=
async
({
export
const
deployAndVerifyAndThen
=
async
({
hre
,
hre
,
name
,
name
,
...
@@ -302,5 +340,99 @@ export const getDeploymentAddress = async (
...
@@ -302,5 +340,99 @@ export const getDeploymentAddress = async (
return
deployment
.
address
return
deployment
.
address
}
}
export
const
makeDictatorConfig
=
async
(
hre
:
any
,
controller
:
string
,
finalOwner
:
string
,
fresh
:
boolean
):
Promise
<
DictatorConfig
>
=>
{
return
{
globalConfig
:
{
proxyAdmin
:
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
),
controller
,
finalOwner
,
addressManager
:
fresh
?
ethers
.
constants
.
AddressZero
:
await
getDeploymentAddress
(
hre
,
'
Lib_AddressManager
'
),
},
proxyAddressConfig
:
{
l2OutputOracleProxy
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracleProxy
'
),
optimismPortalProxy
:
await
getDeploymentAddress
(
hre
,
'
OptimismPortalProxy
'
),
l1CrossDomainMessengerProxy
:
await
getDeploymentAddress
(
hre
,
fresh
?
'
L1CrossDomainMessengerProxy
'
:
'
Proxy__OVM_L1CrossDomainMessenger
'
),
l1StandardBridgeProxy
:
await
getDeploymentAddress
(
hre
,
fresh
?
'
L1StandardBridgeProxy
'
:
'
Proxy__OVM_L1StandardBridge
'
),
optimismMintableERC20FactoryProxy
:
await
getDeploymentAddress
(
hre
,
'
OptimismMintableERC20FactoryProxy
'
),
l1ERC721BridgeProxy
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721BridgeProxy
'
),
},
implementationAddressConfig
:
{
l2OutputOracleImpl
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracle
'
),
optimismPortalImpl
:
await
getDeploymentAddress
(
hre
,
'
OptimismPortal
'
),
l1CrossDomainMessengerImpl
:
await
getDeploymentAddress
(
hre
,
'
L1CrossDomainMessenger
'
),
l1StandardBridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1StandardBridge
'
),
optimismMintableERC20FactoryImpl
:
await
getDeploymentAddress
(
hre
,
'
OptimismMintableERC20Factory
'
),
l1ERC721BridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721Bridge
'
),
portalSenderImpl
:
await
getDeploymentAddress
(
hre
,
'
PortalSender
'
),
},
l2OutputOracleConfig
:
{
l2OutputOracleGenesisL2Output
:
hre
.
deployConfig
.
l2OutputOracleGenesisL2Output
,
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
,
},
}
}
export
const
assertDictatorConfig
=
async
(
dictator
:
Contract
,
config
:
DictatorConfig
)
=>
{
const
dictatorConfig
=
await
dictator
.
config
()
for
(
const
[
outerConfigKey
,
outerConfigValue
]
of
Object
.
entries
(
config
))
{
for
(
const
[
innerConfigKey
,
innerConfigValue
]
of
Object
.
entries
(
outerConfigValue
))
{
assert
(
dictatorConfig
[
outerConfigKey
][
innerConfigKey
]
===
innerConfigValue
,
`incorrect config for
${
outerConfigKey
}
.
${
innerConfigKey
}
`
)
}
}
}
// Large balance to fund accounts with.
// Large balance to fund accounts with.
export
const
BIG_BALANCE
=
ethers
.
BigNumber
.
from
(
`0xFFFFFFFFFFFFFFFFFFFF`
)
export
const
BIG_BALANCE
=
ethers
.
BigNumber
.
from
(
`0xFFFFFFFFFFFFFFFFFFFF`
)
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