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
c777bf52
Unverified
Commit
c777bf52
authored
Mar 31, 2023
by
mergify[bot]
Committed by
GitHub
Mar 31, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5276 from ethereum-optimism/jm/type-safe-config
Generate JSON deploy config from typescript
parents
7354398f
741c3752
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
156 additions
and
2 deletions
+156
-2
README.md
packages/contracts-bedrock/README.md
+3
-1
mainnet.json
packages/contracts-bedrock/deploy-config/mainnet.json
+36
-0
mainnet.ts
packages/contracts-bedrock/deploy-config/mainnet.ts
+52
-0
hardhat.config.ts
packages/contracts-bedrock/hardhat.config.ts
+3
-1
deploy-config.ts
packages/contracts-bedrock/src/deploy-config.ts
+36
-0
generate-deploy-config.ts
packages/contracts-bedrock/tasks/generate-deploy-config.ts
+25
-0
index.ts
packages/contracts-bedrock/tasks/index.ts
+1
-0
No files found.
packages/contracts-bedrock/README.md
View file @
c777bf52
...
...
@@ -92,8 +92,10 @@ yarn echidna:aliasing
#### Configuration
1.
Create or modify a file
`<network-name>.
json
`
inside of the
[
`deploy-config`
](
./deploy-config/
)
folder.
1.
Create or modify a file
`<network-name>.
ts
`
inside of the
[
`deploy-config`
](
./deploy-config/
)
folder.
2.
Fill out this file according to the
`deployConfigSpec`
located inside of the
[
`hardhat.config.ts
](
./hardhat.config.ts
)
3.
Optionally: Run
`npx hardhat generate-deploy-config --network <network-name>`
to generate the associated JSON
file. This is required if using
`op-chain-ops`
.
#### Execution
...
...
packages/contracts-bedrock/deploy-config/mainnet.json
0 → 100644
View file @
c777bf52
{
"finalSystemOwner"
:
"0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A"
,
"controller"
:
"0x78339d822c23d943e4a2d4c3dd5408f66e6d662d"
,
"portalGuardian"
:
"0x78339d822c23d943e4a2d4c3dd5408f66e6d662d"
,
"l1StartingBlockTag"
:
"0x126e52a0cc0ae18948f567ee9443f4a8f0db67c437706e35baee424eb314a0d0"
,
"l1ChainID"
:
1
,
"l2ChainID"
:
10
,
"l2BlockTime"
:
2
,
"maxSequencerDrift"
:
600
,
"sequencerWindowSize"
:
3600
,
"channelTimeout"
:
300
,
"p2pSequencerAddress"
:
"0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65"
,
"batchInboxAddress"
:
"0xff00000000000000000000000000000000000010"
,
"batchSenderAddress"
:
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
,
"l2OutputOracleSubmissionInterval"
:
20
,
"l2OutputOracleStartingTimestamp"
:
1679069195
,
"l2OutputOracleStartingBlockNumber"
:
79149704
,
"l2OutputOracleProposer"
:
"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
,
"l2OutputOracleChallenger"
:
"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
,
"finalizationPeriodSeconds"
:
2
,
"proxyAdminOwner"
:
"0x90F79bf6EB2c4f870365E785982E1f101E93b906"
,
"baseFeeVaultRecipient"
:
"0x90F79bf6EB2c4f870365E785982E1f101E93b906"
,
"l1FeeVaultRecipient"
:
"0x90F79bf6EB2c4f870365E785982E1f101E93b906"
,
"sequencerFeeVaultRecipient"
:
"0x90F79bf6EB2c4f870365E785982E1f101E93b906"
,
"governanceTokenName"
:
"Optimism"
,
"governanceTokenSymbol"
:
"OP"
,
"governanceTokenOwner"
:
"0x90F79bf6EB2c4f870365E785982E1f101E93b906"
,
"l2GenesisBlockGasLimit"
:
"0x17D7840"
,
"l2GenesisBlockCoinbase"
:
"0x4200000000000000000000000000000000000011"
,
"l2GenesisBlockBaseFeePerGas"
:
"0x3b9aca00"
,
"gasPriceOracleOverhead"
:
2100
,
"gasPriceOracleScalar"
:
1000000
,
"eip1559Denominator"
:
50
,
"eip1559Elasticity"
:
10
,
"l2GenesisRegolithTimeOffset"
:
"0x0"
}
\ No newline at end of file
packages/contracts-bedrock/deploy-config/mainnet.ts
0 → 100644
View file @
c777bf52
import
{
DeployConfig
}
from
'
../src/deploy-config
'
// NOTE: The 'mainnet' network is currently being used for bedrock migration rehearsals.
// The system configured below is not yet live on mainnet, and many of the addresses used are
// unsafe for a production system.
const
config
:
DeployConfig
=
{
finalSystemOwner
:
'
0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A
'
,
controller
:
'
0x78339d822c23d943e4a2d4c3dd5408f66e6d662d
'
,
portalGuardian
:
'
0x78339d822c23d943e4a2d4c3dd5408f66e6d662d
'
,
l1StartingBlockTag
:
'
0x126e52a0cc0ae18948f567ee9443f4a8f0db67c437706e35baee424eb314a0d0
'
,
l1ChainID
:
1
,
l2ChainID
:
10
,
l2BlockTime
:
2
,
maxSequencerDrift
:
600
,
sequencerWindowSize
:
3600
,
channelTimeout
:
300
,
p2pSequencerAddress
:
'
0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65
'
,
batchInboxAddress
:
'
0xff00000000000000000000000000000000000010
'
,
batchSenderAddress
:
'
0x70997970C51812dc3A010C7d01b50e0d17dc79C8
'
,
l2OutputOracleSubmissionInterval
:
20
,
l2OutputOracleStartingTimestamp
:
1679069195
,
l2OutputOracleStartingBlockNumber
:
79149704
,
l2OutputOracleProposer
:
'
0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
'
,
l2OutputOracleChallenger
:
'
0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
'
,
finalizationPeriodSeconds
:
2
,
proxyAdminOwner
:
'
0x90F79bf6EB2c4f870365E785982E1f101E93b906
'
,
baseFeeVaultRecipient
:
'
0x90F79bf6EB2c4f870365E785982E1f101E93b906
'
,
l1FeeVaultRecipient
:
'
0x90F79bf6EB2c4f870365E785982E1f101E93b906
'
,
sequencerFeeVaultRecipient
:
'
0x90F79bf6EB2c4f870365E785982E1f101E93b906
'
,
governanceTokenName
:
'
Optimism
'
,
governanceTokenSymbol
:
'
OP
'
,
governanceTokenOwner
:
'
0x90F79bf6EB2c4f870365E785982E1f101E93b906
'
,
l2GenesisBlockGasLimit
:
'
0x17D7840
'
,
l2GenesisBlockCoinbase
:
'
0x4200000000000000000000000000000000000011
'
,
l2GenesisBlockBaseFeePerGas
:
'
0x3b9aca00
'
,
gasPriceOracleOverhead
:
2100
,
gasPriceOracleScalar
:
1000000
,
eip1559Denominator
:
50
,
eip1559Elasticity
:
10
,
l2GenesisRegolithTimeOffset
:
'
0x0
'
,
}
export
default
config
packages/contracts-bedrock/hardhat.config.ts
View file @
c777bf52
...
...
@@ -22,8 +22,10 @@ const config: HardhatUserConfig = {
hardhat
:
{
live
:
false
,
},
// NOTE: The 'mainnet' network is currently being used for mainnet rehearsals.
mainnet
:
{
url
:
process
.
env
.
L1_RPC
||
'
http://localhost:8545
'
,
url
:
process
.
env
.
L1_RPC
||
'
https://mainnet-l1-rehearsal.optimism.io
'
,
accounts
:
[
process
.
env
.
PRIVATE_KEY_DEPLOYER
||
ethers
.
constants
.
HashZero
],
},
devnetL1
:
{
live
:
false
,
...
...
packages/contracts-bedrock/src/deploy-config.ts
View file @
c777bf52
...
...
@@ -129,6 +129,26 @@ interface RequiredDeployConfig {
* Output finalization period in seconds.
*/
finalizationPeriodSeconds
:
number
/**
* Owner of the ProxyAdmin contract.
*/
proxyAdminOwner
:
string
/**
* L1 address which receives the base fee for the L2 network.
*/
baseFeeVaultRecipient
:
string
/**
* L1 address which receives data fees for the L2 network.
*/
l1FeeVaultRecipient
:
string
/**
* L1 address which receives tip fees for the L2 network.
*/
sequencerFeeVaultRecipient
:
string
}
/**
...
...
@@ -160,6 +180,10 @@ interface OptionalL2DeployConfig {
l2GenesisBlockGasUsed
:
string
l2GenesisBlockParentHash
:
string
l2GenesisBlockBaseFeePerGas
:
string
l2GenesisBlockCoinbase
:
string
l2GenesisRegolithTimeOffset
:
string
eip1559Denominator
:
number
eip1559Elasticity
:
number
gasPriceOracleOverhead
:
number
gasPriceOracleScalar
:
number
}
...
...
@@ -243,6 +267,18 @@ export const deployConfigSpec: {
type
:
'
number
'
,
default
:
2
,
},
proxyAdminOwner
:
{
type
:
'
address
'
,
},
baseFeeVaultRecipient
:
{
type
:
'
address
'
,
},
l1FeeVaultRecipient
:
{
type
:
'
address
'
,
},
sequencerFeeVaultRecipient
:
{
type
:
'
address
'
,
},
cliqueSignerAddress
:
{
type
:
'
address
'
,
default
:
ethers
.
constants
.
AddressZero
,
...
...
packages/contracts-bedrock/tasks/generate-deploy-config.ts
0 → 100644
View file @
c777bf52
import
fs
from
'
fs
'
import
path
from
'
path
'
import
{
task
}
from
'
hardhat/config
'
import
{
HardhatRuntimeEnvironment
}
from
'
hardhat/types
'
task
(
'
generate-deploy-config
'
,
'
generates a json config file for the current network
'
).
setAction
(
async
({},
hre
:
HardhatRuntimeEnvironment
)
=>
{
try
{
const
base
=
path
.
join
(
hre
.
config
.
paths
.
deployConfig
,
hre
.
network
.
name
)
if
(
fs
.
existsSync
(
`
${
base
}
.ts`
))
{
// eslint-disable-next-line @typescript-eslint/no-var-requires
const
config
=
require
(
`
${
base
}
.ts`
).
default
fs
.
writeFileSync
(
`
${
base
}
.json`
,
JSON
.
stringify
(
config
,
null
,
2
),
'
utf8
'
)
}
else
{
throw
new
Error
(
'
not found
'
)
}
}
catch
(
err
)
{
throw
new
Error
(
`error while loading deploy config for network:
${
hre
.
network
.
name
}
,
${
err
}
`
)
}
})
packages/contracts-bedrock/tasks/index.ts
View file @
c777bf52
...
...
@@ -10,3 +10,4 @@ import './check-l2'
import
'
./update-dynamic-oracle-config
'
import
'
./wait-for-final-batch
'
import
'
./wait-for-final-deposit
'
import
'
./generate-deploy-config
'
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