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
169329cf
Unverified
Commit
169329cf
authored
Jan 04, 2023
by
mergify[bot]
Committed by
GitHub
Jan 04, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4579 from ethereum-optimism/fix/deploy-config-validation-2
op-chain-ops: better deploy config validation
parents
899e3b94
722ee120
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
21 deletions
+17
-21
config.go
op-chain-ops/genesis/config.go
+4
-1
cmd.go
op-node/cmd/genesis/cmd.go
+13
-20
No files found.
op-chain-ops/genesis/config.go
View file @
169329cf
...
...
@@ -108,6 +108,9 @@ type DeployConfig struct {
// Check will ensure that the config is sane and return an error when it is not
func
(
d
*
DeployConfig
)
Check
()
error
{
if
d
.
L1StartingBlockTag
==
nil
{
return
fmt
.
Errorf
(
"%w: L2StartingBlockTag cannot be nil"
,
ErrInvalidDeployConfig
)
}
if
d
.
L1ChainID
==
0
{
return
fmt
.
Errorf
(
"%w: L1ChainID cannot be 0"
,
ErrInvalidDeployConfig
)
}
...
...
@@ -327,7 +330,7 @@ func NewDeployConfig(path string) (*DeployConfig, error) {
var
config
DeployConfig
if
err
:=
json
.
Unmarshal
(
file
,
&
config
);
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal deploy config: %w"
,
err
)
}
return
&
config
,
nil
...
...
op-node/cmd/genesis/cmd.go
View file @
169329cf
...
...
@@ -3,7 +3,6 @@ package genesis
import
(
"context"
"encoding/json"
"errors"
"fmt"
"math/big"
"os"
...
...
@@ -114,16 +113,24 @@ var Subcommands = cli.Commands{
return
err
}
if
config
.
L1StartingBlockTag
==
nil
{
return
errors
.
New
(
"must specify a starting block tag in genesis"
)
depPath
,
network
:=
filepath
.
Split
(
ctx
.
String
(
"deployment-dir"
))
hh
,
err
:=
hardhat
.
New
(
network
,
nil
,
[]
string
{
depPath
})
if
err
!=
nil
{
return
err
}
// Read the appropriate deployment addresses from disk
if
err
:=
config
.
GetDeployedAddresses
(
hh
);
err
!=
nil
{
return
err
}
if
config
.
L2GenesisBlockGasLimit
==
0
{
// TODO: this is a hotfix, need to set default values in more clean way + sanity check the config
config
.
L2GenesisBlockGasLimit
=
15
_000_000
// Sanity check the config
if
err
:=
config
.
Check
();
err
!=
nil
{
return
err
}
client
,
err
:=
ethclient
.
Dial
(
ctx
.
String
(
"l1-rpc"
))
if
err
!=
nil
{
return
err
return
fmt
.
Errorf
(
"cannot dial %s: %w"
,
ctx
.
String
(
"l1-rpc"
),
err
)
}
var
l1StartBlock
*
types
.
Block
...
...
@@ -136,20 +143,6 @@ var Subcommands = cli.Commands{
return
fmt
.
Errorf
(
"error getting l1 start block: %w"
,
err
)
}
depPath
,
network
:=
filepath
.
Split
(
ctx
.
String
(
"deployment-dir"
))
hh
,
err
:=
hardhat
.
New
(
network
,
nil
,
[]
string
{
depPath
})
if
err
!=
nil
{
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
}
// Build the developer L2 genesis block
l2Genesis
,
err
:=
genesis
.
BuildL2DeveloperGenesis
(
config
,
l1StartBlock
)
if
err
!=
nil
{
...
...
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