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
186e46a4
Unverified
Commit
186e46a4
authored
May 31, 2023
by
Matthew Slipper
Committed by
GitHub
May 31, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5850 from ethereum-optimism/fix/rollover-script
op-chain-ops: fix rollover script
parents
7affff18
69b5ada0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
5 deletions
+36
-5
main.go
op-chain-ops/cmd/rollover/main.go
+36
-5
No files found.
op-chain-ops/cmd/rollover/main.go
View file @
186e46a4
...
@@ -51,6 +51,8 @@ func main() {
...
@@ -51,6 +51,8 @@ func main() {
return
err
return
err
}
}
log
.
Info
(
"Requires an archive node"
)
log
.
Info
(
"Connecting to AddressManager"
,
"address"
,
addresses
.
AddressManager
)
log
.
Info
(
"Connecting to AddressManager"
,
"address"
,
addresses
.
AddressManager
)
addressManager
,
err
:=
bindings
.
NewAddressManager
(
addresses
.
AddressManager
,
clients
.
L1Client
)
addressManager
,
err
:=
bindings
.
NewAddressManager
(
addresses
.
AddressManager
,
clients
.
L1Client
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -70,28 +72,42 @@ func main() {
...
@@ -70,28 +72,42 @@ func main() {
time
.
Sleep
(
3
*
time
.
Second
)
time
.
Sleep
(
3
*
time
.
Second
)
}
}
shutoffBlock
,
err
:=
addressManager
.
GetAddress
(
&
bind
.
CallOpts
{},
"DTL_SHUTOFF_BLOCK"
)
if
err
!=
nil
{
return
err
}
shutoffHeight
:=
shutoffBlock
.
Big
()
log
.
Info
(
"Connecting to CanonicalTransactionChain"
,
"address"
,
addresses
.
CanonicalTransactionChain
)
log
.
Info
(
"Connecting to CanonicalTransactionChain"
,
"address"
,
addresses
.
CanonicalTransactionChain
)
ctc
,
err
:=
legacy_bindings
.
NewCanonicalTransactionChain
(
addresses
.
CanonicalTransactionChain
,
clients
.
L1Client
)
ctc
,
err
:=
legacy_bindings
.
NewCanonicalTransactionChain
(
addresses
.
CanonicalTransactionChain
,
clients
.
L1Client
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
queueLength
,
err
:=
ctc
.
GetQueueLength
(
&
bind
.
CallOpts
{})
queueLength
,
err
:=
ctc
.
GetQueueLength
(
&
bind
.
CallOpts
{
BlockNumber
:
shutoffHeight
,
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
totalElements
,
err
:=
ctc
.
GetTotalElements
(
&
bind
.
CallOpts
{})
totalElements
,
err
:=
ctc
.
GetTotalElements
(
&
bind
.
CallOpts
{
BlockNumber
:
shutoffHeight
,
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
totalBatches
,
err
:=
ctc
.
GetTotalBatches
(
&
bind
.
CallOpts
{})
totalBatches
,
err
:=
ctc
.
GetTotalBatches
(
&
bind
.
CallOpts
{
BlockNumber
:
shutoffHeight
,
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
pending
,
err
:=
ctc
.
GetNumPendingQueueElements
(
&
bind
.
CallOpts
{})
pending
,
err
:=
ctc
.
GetNumPendingQueueElements
(
&
bind
.
CallOpts
{
BlockNumber
:
shutoffHeight
,
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -131,6 +147,7 @@ func main() {
...
@@ -131,6 +147,7 @@ func main() {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
// If the queue origin is l1, then it is a deposit.
// 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
{
...
@@ -138,12 +155,26 @@ func main() {
...
@@ -138,12 +155,26 @@ func main() {
return
fmt
.
Errorf
(
"queue index is nil for tx %s at height %d"
,
hash
.
Hex
(),
blockNumber
)
return
fmt
.
Errorf
(
"queue index is nil for tx %s at height %d"
,
hash
.
Hex
(),
blockNumber
)
}
}
queueIndex
:=
uint64
(
*
json
.
QueueIndex
)
queueIndex
:=
uint64
(
*
json
.
QueueIndex
)
if
json
.
L1BlockNumber
==
nil
{
// This should never happen.
return
fmt
.
Errorf
(
"L1 block number is nil for tx %s at height %d"
,
hash
.
Hex
(),
blockNumber
)
}
l1BlockNumber
:=
json
.
L1BlockNumber
.
ToInt
()
log
.
Info
(
"Deposit found"
,
"l2-block"
,
blockNumber
,
"l1-block"
,
l1BlockNumber
,
"queue-index"
,
queueIndex
)
// This should never happen
if
json
.
L1BlockNumber
.
ToInt
()
.
Uint64
()
>
shutoffHeight
.
Uint64
()
{
log
.
Warn
(
"Lost deposit"
)
return
fmt
.
Errorf
(
"Lost deposit: %s"
,
hash
.
Hex
())
}
// Check to see if the final deposit was ingested. Subtract 1 here to handle zero
// Check to see if the final deposit was ingested. Subtract 1 here to handle zero
// indexing.
// 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
// 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
// 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
// to the latest block number to restart walking backwards to find deposits that
...
@@ -258,7 +289,7 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e
...
@@ -258,7 +289,7 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e
log
.
Info
(
log
.
Info
(
"Waiting for elements to be submitted"
,
"Waiting for elements to be submitted"
,
"name"
,
name
,
"name"
,
name
,
"count"
,
totalElements
.
Uint64
()
-
bn
,
"count"
,
bn
-
totalElements
.
Uint64
()
,
"height"
,
bn
,
"height"
,
bn
,
"total-elements"
,
totalElements
.
Uint64
(),
"total-elements"
,
totalElements
.
Uint64
(),
)
)
...
...
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