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
7256a570
Commit
7256a570
authored
Nov 08, 2022
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: update genesis commands
parent
11b1ab33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
28 deletions
+29
-28
cmd.go
op-node/cmd/genesis/cmd.go
+29
-28
No files found.
op-node/cmd/genesis/cmd.go
View file @
7256a570
...
...
@@ -17,7 +17,6 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
...
...
@@ -52,6 +51,11 @@ var Subcommands = cli.Commands{
return
err
}
// Add the developer L1 addresses to the config
if
err
:=
config
.
GetDeveloperDeployedAddresses
();
err
!=
nil
{
return
err
}
if
err
:=
config
.
Check
();
err
!=
nil
{
return
err
}
...
...
@@ -62,12 +66,15 @@ var Subcommands = cli.Commands{
}
l1StartBlock
:=
l1Genesis
.
ToBlock
()
l2Genesis
,
err
:=
genesis
.
BuildL2DeveloperGenesis
(
config
,
l1StartBlock
,
nil
)
l2Genesis
,
err
:=
genesis
.
BuildL2DeveloperGenesis
(
config
,
l1StartBlock
)
if
err
!=
nil
{
return
err
}
rollupConfig
:=
makeRollupConfig
(
config
,
l1StartBlock
,
l2Genesis
,
predeploys
.
DevOptimismPortalAddr
,
predeploys
.
DevSystemConfigAddr
)
rollupConfig
,
err
:=
makeRollupConfig
(
config
,
l1StartBlock
,
l2Genesis
)
if
err
!=
nil
{
return
err
}
if
err
:=
writeGenesisFile
(
ctx
.
String
(
"outfile.l1"
),
l1Genesis
);
err
!=
nil
{
return
err
...
...
@@ -138,31 +145,24 @@ var Subcommands = cli.Commands{
return
err
}
// Read the appropriate deployment addresses from disk
if
err
:=
config
.
GetDeployedAddresses
(
hh
);
err
!=
nil
{
return
err
}
// Sanity check the config
if
err
:=
config
.
Check
();
err
!=
nil
{
return
err
}
// TODO: delete this struct as everything is now in the DeployConfig
l2Addrs
:=
&
genesis
.
L2Addresses
{
ProxyAdminOwner
:
config
.
ProxyAdminOwner
,
L1StandardBridgeProxy
:
config
.
L1StandardBridgeProxy
,
L1CrossDomainMessengerProxy
:
config
.
L1CrossDomainMessengerProxy
,
L1ERC721BridgeProxy
:
config
.
L1ERC721BridgeProxy
,
BaseFeeVaultRecipient
:
config
.
BaseFeeVaultRecipient
,
L1FeeVaultRecipient
:
config
.
L1FeeVaultRecipient
,
SequencerFeeVaultRecipient
:
config
.
SequencerFeeVaultRecipient
,
SystemConfigProxy
:
config
.
SystemConfigProxy
,
}
l2Genesis
,
err
:=
genesis
.
BuildL2DeveloperGenesis
(
config
,
l1StartBlock
,
l2Addrs
)
// Build the developer L2 genesis block
l2Genesis
,
err
:=
genesis
.
BuildL2DeveloperGenesis
(
config
,
l1StartBlock
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error creating l2 developer genesis: %w"
,
err
)
}
rollupConfig
:=
makeRollupConfig
(
config
,
l1StartBlock
,
l2Genesis
,
config
.
OptimismPortalProxy
,
config
.
SystemConfigProxy
)
rollupConfig
,
err
:=
makeRollupConfig
(
config
,
l1StartBlock
,
l2Genesis
)
if
err
!=
nil
{
return
err
}
if
err
:=
rollupConfig
.
Check
();
err
!=
nil
{
return
fmt
.
Errorf
(
"generated rollup config does not pass validation: %w"
,
err
)
}
...
...
@@ -175,13 +175,14 @@ var Subcommands = cli.Commands{
},
}
func
makeRollupConfig
(
config
*
genesis
.
DeployConfig
,
l1StartBlock
*
types
.
Block
,
l2Genesis
*
core
.
Genesis
,
portalAddr
common
.
Address
,
sysConfigAddr
common
.
Address
,
)
*
rollup
.
Config
{
func
makeRollupConfig
(
config
*
genesis
.
DeployConfig
,
l1StartBlock
*
types
.
Block
,
l2Genesis
*
core
.
Genesis
)
(
*
rollup
.
Config
,
error
)
{
if
config
.
OptimismPortalProxy
==
(
common
.
Address
{})
{
return
nil
,
errors
.
New
(
"OptimismPortalProxy cannot be address(0)"
)
}
if
config
.
SystemConfigProxy
==
(
common
.
Address
{})
{
return
nil
,
errors
.
New
(
"SystemConfigProxy cannot be address(0)"
)
}
return
&
rollup
.
Config
{
Genesis
:
rollup
.
Genesis
{
L1
:
eth
.
BlockID
{
...
...
@@ -208,9 +209,9 @@ func makeRollupConfig(
L2ChainID
:
new
(
big
.
Int
)
.
SetUint64
(
config
.
L2ChainID
),
P2PSequencerAddress
:
config
.
P2PSequencerAddress
,
BatchInboxAddress
:
config
.
BatchInboxAddress
,
DepositContractAddress
:
portalAddr
,
L1SystemConfigAddress
:
sysConfigAddr
,
}
DepositContractAddress
:
config
.
OptimismPortalProxy
,
L1SystemConfigAddress
:
config
.
SystemConfigProxy
,
}
,
nil
}
func
writeGenesisFile
(
outfile
string
,
input
interface
{})
error
{
...
...
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