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
c946eebc
Unverified
Commit
c946eebc
authored
Apr 06, 2023
by
OptimismBot
Committed by
GitHub
Apr 06, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5367 from ethereum-optimism/op-chain-ops/migrate-fix
op-chain-ops: migrate error handling
parents
9c4eeaaa
deaa3565
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
main.go
op-chain-ops/cmd/op-migrate/main.go
+9
-4
config.go
op-chain-ops/genesis/config.go
+15
-0
No files found.
op-chain-ops/cmd/op-migrate/main.go
View file @
c946eebc
...
@@ -3,6 +3,7 @@ package main
...
@@ -3,6 +3,7 @@ package main
import
(
import
(
"context"
"context"
"encoding/json"
"encoding/json"
"errors"
"fmt"
"fmt"
"math/big"
"math/big"
"os"
"os"
...
@@ -168,10 +169,14 @@ func main() {
...
@@ -168,10 +169,14 @@ func main() {
var
block
*
types
.
Block
var
block
*
types
.
Block
tag
:=
config
.
L1StartingBlockTag
tag
:=
config
.
L1StartingBlockTag
if
tag
.
BlockNumber
!=
nil
{
if
tag
==
nil
{
block
,
err
=
l1Client
.
BlockByNumber
(
context
.
Background
(),
big
.
NewInt
(
tag
.
BlockNumber
.
Int64
()))
return
errors
.
New
(
"l1StartingBlockTag cannot be nil"
)
}
else
if
tag
.
BlockHash
!=
nil
{
}
block
,
err
=
l1Client
.
BlockByHash
(
context
.
Background
(),
*
tag
.
BlockHash
)
log
.
Info
(
"Using L1 Starting Block Tag"
,
"tag"
,
tag
.
String
())
if
number
,
isNumber
:=
tag
.
Number
();
isNumber
{
block
,
err
=
l1Client
.
BlockByNumber
(
context
.
Background
(),
big
.
NewInt
(
number
.
Int64
()))
}
else
if
hash
,
isHash
:=
tag
.
Hash
();
isHash
{
block
,
err
=
l1Client
.
BlockByHash
(
context
.
Background
(),
hash
)
}
else
{
}
else
{
return
fmt
.
Errorf
(
"invalid l1StartingBlockTag in deploy config: %v"
,
tag
)
return
fmt
.
Errorf
(
"invalid l1StartingBlockTag in deploy config: %v"
,
tag
)
}
}
...
...
op-chain-ops/genesis/config.go
View file @
c946eebc
...
@@ -498,3 +498,18 @@ func (m *MarshalableRPCBlockNumberOrHash) UnmarshalJSON(b []byte) error {
...
@@ -498,3 +498,18 @@ func (m *MarshalableRPCBlockNumberOrHash) UnmarshalJSON(b []byte) error {
*
m
=
asMarshalable
*
m
=
asMarshalable
return
nil
return
nil
}
}
// Number wraps the rpc.BlockNumberOrHash Number method.
func
(
m
*
MarshalableRPCBlockNumberOrHash
)
Number
()
(
rpc
.
BlockNumber
,
bool
)
{
return
(
*
rpc
.
BlockNumberOrHash
)(
m
)
.
Number
()
}
// Hash wraps the rpc.BlockNumberOrHash Hash method.
func
(
m
*
MarshalableRPCBlockNumberOrHash
)
Hash
()
(
common
.
Hash
,
bool
)
{
return
(
*
rpc
.
BlockNumberOrHash
)(
m
)
.
Hash
()
}
// String wraps the rpc.BlockNumberOrHash String method.
func
(
m
*
MarshalableRPCBlockNumberOrHash
)
String
()
string
{
return
(
*
rpc
.
BlockNumberOrHash
)(
m
)
.
String
()
}
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