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
a3416a2f
Unverified
Commit
a3416a2f
authored
Jul 26, 2023
by
Mark Tyneway
Committed by
GitHub
Jul 26, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6456 from ethereum-optimism/fix/genesis-script
op-node: safer genesis script
parents
fff05ea7
a8a4b229
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
cmd.go
op-node/cmd/genesis/cmd.go
+16
-4
No files found.
op-node/cmd/genesis/cmd.go
View file @
a3416a2f
...
...
@@ -3,6 +3,7 @@ package genesis
import
(
"context"
"encoding/json"
"errors"
"fmt"
"math/big"
"os"
...
...
@@ -12,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
...
...
@@ -91,11 +93,11 @@ var Subcommands = cli.Commands{
},
&
cli
.
StringFlag
{
Name
:
"deploy-config"
,
Usage
:
"Path to
hardhat
deploy config file"
,
Usage
:
"Path to deploy config file"
,
},
&
cli
.
StringFlag
{
Name
:
"deployment-dir"
,
Usage
:
"Path to deployment directory"
,
Usage
:
"Path to
network
deployment directory"
,
},
&
cli
.
StringFlag
{
Name
:
"outfile.l2"
,
...
...
@@ -108,12 +110,19 @@ var Subcommands = cli.Commands{
},
Action
:
func
(
ctx
*
cli
.
Context
)
error
{
deployConfig
:=
ctx
.
String
(
"deploy-config"
)
log
.
Info
(
"Deploy config"
,
"path"
,
deployConfig
)
config
,
err
:=
genesis
.
NewDeployConfig
(
deployConfig
)
if
err
!=
nil
{
return
err
}
depPath
,
network
:=
filepath
.
Split
(
ctx
.
String
(
"deployment-dir"
))
deployDir
:=
ctx
.
String
(
"deployment-dir"
)
if
deployDir
==
""
{
return
errors
.
New
(
"Must specify --deployment-dir"
)
}
log
.
Info
(
"Deployment directory"
,
"path"
,
deployDir
)
depPath
,
network
:=
filepath
.
Split
(
deployDir
)
hh
,
err
:=
hardhat
.
New
(
network
,
nil
,
[]
string
{
depPath
})
if
err
!=
nil
{
return
err
...
...
@@ -134,7 +143,9 @@ var Subcommands = cli.Commands{
}
var
l1StartBlock
*
types
.
Block
if
config
.
L1StartingBlockTag
.
BlockHash
!=
nil
{
if
config
.
L1StartingBlockTag
==
nil
{
l1StartBlock
,
err
=
client
.
BlockByNumber
(
context
.
Background
(),
nil
)
}
else
if
config
.
L1StartingBlockTag
.
BlockHash
!=
nil
{
l1StartBlock
,
err
=
client
.
BlockByHash
(
context
.
Background
(),
*
config
.
L1StartingBlockTag
.
BlockHash
)
}
else
if
config
.
L1StartingBlockTag
.
BlockNumber
!=
nil
{
l1StartBlock
,
err
=
client
.
BlockByNumber
(
context
.
Background
(),
big
.
NewInt
(
config
.
L1StartingBlockTag
.
BlockNumber
.
Int64
()))
...
...
@@ -142,6 +153,7 @@ var Subcommands = cli.Commands{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error getting l1 start block: %w"
,
err
)
}
log
.
Info
(
"Using L1 Start Block"
,
"number"
,
l1StartBlock
.
Number
(),
"hash"
,
l1StartBlock
.
Hash
()
.
Hex
())
// Build the developer L2 genesis block
l2Genesis
,
err
:=
genesis
.
BuildL2Genesis
(
config
,
l1StartBlock
)
...
...
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