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
900f44a3
Unverified
Commit
900f44a3
authored
May 18, 2023
by
OptimismBot
Committed by
GitHub
May 18, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5720 from ethereum-optimism/feat/better-rollover-check
op-chain-ops: better rollover checks
parents
63a6436f
8ac1bd79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
main.go
op-chain-ops/cmd/rollover/main.go
+21
-4
No files found.
op-chain-ops/cmd/rollover/main.go
View file @
900f44a3
...
@@ -2,7 +2,6 @@ package main
...
@@ -2,7 +2,6 @@ package main
import
(
import
(
"context"
"context"
"errors"
"fmt"
"fmt"
"math/big"
"math/big"
"os"
"os"
...
@@ -112,6 +111,7 @@ func main() {
...
@@ -112,6 +111,7 @@ func main() {
}
}
log
.
Info
(
"Searching backwards for final deposit"
,
"start"
,
blockNumber
)
log
.
Info
(
"Searching backwards for final deposit"
,
"start"
,
blockNumber
)
// Walk backards through the blocks until we find the final deposit.
for
{
for
{
bn
:=
new
(
big
.
Int
)
.
SetUint64
(
blockNumber
)
bn
:=
new
(
big
.
Int
)
.
SetUint64
(
blockNumber
)
log
.
Info
(
"Checking L2 block"
,
"number"
,
bn
)
log
.
Info
(
"Checking L2 block"
,
"number"
,
bn
)
...
@@ -131,18 +131,35 @@ func main() {
...
@@ -131,18 +131,35 @@ func main() {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
// If the queue origin is l1, then it is a deposit.
if
json
.
QueueOrigin
==
"l1"
{
if
json
.
QueueOrigin
==
"l1"
{
if
json
.
QueueIndex
==
nil
{
if
json
.
QueueIndex
==
nil
{
// This should never happen
// This should never happen
.
return
errors
.
New
(
"queue index is nil"
)
return
fmt
.
Errorf
(
"queue index is nil for tx %s at height %d"
,
hash
.
Hex
(),
blockNumber
)
}
}
queueIndex
:=
uint64
(
*
json
.
QueueIndex
)
queueIndex
:=
uint64
(
*
json
.
QueueIndex
)
// Check to see if the final deposit was ingested. Subtract 1 here to handle zero
// indexing.
if
queueIndex
==
queueLength
.
Uint64
()
-
1
{
if
queueIndex
==
queueLength
.
Uint64
()
-
1
{
log
.
Info
(
"Found final deposit in l2geth"
,
"queue-index"
,
queueIndex
)
log
.
Info
(
"Found final deposit in l2geth"
,
"queue-index"
,
queueIndex
)
break
break
}
}
// If the queue index is less than the queue length, then not all deposits have
// been ingested by l2geth yet. This means that we need to reset the blocknumber
// to the latest block number to restart walking backwards to find deposits that
// have yet to be ingested.
if
queueIndex
<
queueLength
.
Uint64
()
{
if
queueIndex
<
queueLength
.
Uint64
()
{
return
errors
.
New
(
"missed final deposit"
)
log
.
Info
(
"Not all deposits ingested"
,
"queue-index"
,
queueIndex
,
"queue-length"
,
queueLength
.
Uint64
())
time
.
Sleep
(
time
.
Second
*
3
)
blockNumber
,
err
=
clients
.
L2Client
.
BlockNumber
(
context
.
Background
())
if
err
!=
nil
{
return
err
}
continue
}
// The queueIndex should never be greater than the queue length.
if
queueIndex
>
queueLength
.
Uint64
()
{
log
.
Warn
(
"Queue index is greater than queue length"
,
"queue-index"
,
queueIndex
,
"queue-length"
,
queueLength
.
Uint64
())
}
}
}
}
blockNumber
--
blockNumber
--
...
...
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