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
82528f38
Commit
82528f38
authored
Jul 26, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: fix small bugs in genesis script
parent
ae148960
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
config.go
op-chain-ops/genesis/config.go
+1
-1
cmd.go
op-node/cmd/genesis/cmd.go
+10
-4
No files found.
op-chain-ops/genesis/config.go
View file @
82528f38
...
@@ -188,7 +188,7 @@ func (d *DeployConfig) Copy() *DeployConfig {
...
@@ -188,7 +188,7 @@ func (d *DeployConfig) Copy() *DeployConfig {
// Check will ensure that the config is sane and return an error when it is not
// Check will ensure that the config is sane and return an error when it is not
func
(
d
*
DeployConfig
)
Check
()
error
{
func
(
d
*
DeployConfig
)
Check
()
error
{
if
d
.
L1StartingBlockTag
==
nil
{
if
d
.
L1StartingBlockTag
==
nil
{
return
fmt
.
Errorf
(
"%w: L
2
StartingBlockTag cannot be nil"
,
ErrInvalidDeployConfig
)
return
fmt
.
Errorf
(
"%w: L
1
StartingBlockTag cannot be nil"
,
ErrInvalidDeployConfig
)
}
}
if
d
.
L1ChainID
==
0
{
if
d
.
L1ChainID
==
0
{
return
fmt
.
Errorf
(
"%w: L1ChainID cannot be 0"
,
ErrInvalidDeployConfig
)
return
fmt
.
Errorf
(
"%w: L1ChainID cannot be 0"
,
ErrInvalidDeployConfig
)
...
...
op-node/cmd/genesis/cmd.go
View file @
82528f38
...
@@ -14,6 +14,7 @@ import (
...
@@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
...
@@ -132,10 +133,6 @@ var Subcommands = cli.Commands{
...
@@ -132,10 +133,6 @@ var Subcommands = cli.Commands{
if
err
:=
config
.
GetDeployedAddresses
(
hh
);
err
!=
nil
{
if
err
:=
config
.
GetDeployedAddresses
(
hh
);
err
!=
nil
{
return
err
return
err
}
}
// Sanity check the config
if
err
:=
config
.
Check
();
err
!=
nil
{
return
err
}
client
,
err
:=
ethclient
.
Dial
(
ctx
.
String
(
"l1-rpc"
))
client
,
err
:=
ethclient
.
Dial
(
ctx
.
String
(
"l1-rpc"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -145,6 +142,8 @@ var Subcommands = cli.Commands{
...
@@ -145,6 +142,8 @@ var Subcommands = cli.Commands{
var
l1StartBlock
*
types
.
Block
var
l1StartBlock
*
types
.
Block
if
config
.
L1StartingBlockTag
==
nil
{
if
config
.
L1StartingBlockTag
==
nil
{
l1StartBlock
,
err
=
client
.
BlockByNumber
(
context
.
Background
(),
nil
)
l1StartBlock
,
err
=
client
.
BlockByNumber
(
context
.
Background
(),
nil
)
tag
:=
rpc
.
BlockNumberOrHashWithHash
(
l1StartBlock
.
Hash
(),
true
)
config
.
L1StartingBlockTag
=
(
*
genesis
.
MarshalableRPCBlockNumberOrHash
)(
&
tag
)
}
else
if
config
.
L1StartingBlockTag
.
BlockHash
!=
nil
{
}
else
if
config
.
L1StartingBlockTag
.
BlockHash
!=
nil
{
l1StartBlock
,
err
=
client
.
BlockByHash
(
context
.
Background
(),
*
config
.
L1StartingBlockTag
.
BlockHash
)
l1StartBlock
,
err
=
client
.
BlockByHash
(
context
.
Background
(),
*
config
.
L1StartingBlockTag
.
BlockHash
)
}
else
if
config
.
L1StartingBlockTag
.
BlockNumber
!=
nil
{
}
else
if
config
.
L1StartingBlockTag
.
BlockNumber
!=
nil
{
...
@@ -153,6 +152,13 @@ var Subcommands = cli.Commands{
...
@@ -153,6 +152,13 @@ var Subcommands = cli.Commands{
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error getting l1 start block: %w"
,
err
)
return
fmt
.
Errorf
(
"error getting l1 start block: %w"
,
err
)
}
}
// Sanity check the config. Do this after filling in the L1StartingBlockTag
// if it is not defined.
if
err
:=
config
.
Check
();
err
!=
nil
{
return
err
}
log
.
Info
(
"Using L1 Start Block"
,
"number"
,
l1StartBlock
.
Number
(),
"hash"
,
l1StartBlock
.
Hash
()
.
Hex
())
log
.
Info
(
"Using L1 Start Block"
,
"number"
,
l1StartBlock
.
Number
(),
"hash"
,
l1StartBlock
.
Hash
()
.
Hex
())
// Build the developer L2 genesis block
// Build the developer L2 genesis block
...
...
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