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
b3b46545
Commit
b3b46545
authored
Jan 27, 2023
by
Sebastian Stammler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-batcher: Pass L1BlockRef to TxData in batcher loop
parent
9bea5ab3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
driver.go
op-batcher/batcher/driver.go
+20
-4
No files found.
op-batcher/batcher/driver.go
View file @
b3b46545
...
...
@@ -237,11 +237,15 @@ func (l *BatchSubmitter) loop() {
case
<-
ticker
.
C
:
l
.
loadBlocksIntoState
(
l
.
ctx
)
// Empty the state after loading into it on every iteration.
blockLoop
:
for
{
// Collect the output frame
data
,
id
,
err
:=
l
.
state
.
TxData
(
eth
.
L1BlockRef
{})
l1tip
,
err
:=
l
.
l1Tip
(
l
.
ctx
)
if
err
!=
nil
{
l
.
log
.
Error
(
"Failed to query L1 tip"
)
break
}
// Collect next transaction data
data
,
id
,
err
:=
l
.
state
.
TxData
(
l1tip
)
if
err
==
io
.
EOF
{
l
.
log
.
Trace
(
"no transaction data available"
)
break
// local for loop
...
...
@@ -251,7 +255,7 @@ func (l *BatchSubmitter) loop() {
}
// Record TX Status
if
receipt
,
err
:=
l
.
txMgr
.
SendTransaction
(
l
.
ctx
,
data
);
err
!=
nil
{
l
.
log
.
Error
(
"Failed to send transaction"
,
"err"
,
err
)
l
.
log
.
Warn
(
"Failed to send transaction"
,
"err"
,
err
)
l
.
state
.
TxFailed
(
id
)
}
else
{
l
.
log
.
Info
(
"Transaction confirmed"
,
"tx_hash"
,
receipt
.
TxHash
,
"status"
,
receipt
.
Status
,
"block_hash"
,
receipt
.
BlockHash
,
"block_number"
,
receipt
.
BlockNumber
)
...
...
@@ -273,3 +277,15 @@ func (l *BatchSubmitter) loop() {
}
}
}
// l1Tip gets the current L1 tip as a L1BlockRef. The passed context is assumed
// to be a runtime context, so it is internally wrapped with a network timeout.
func
(
l
*
BatchSubmitter
)
l1Tip
(
ctx
context
.
Context
)
(
eth
.
L1BlockRef
,
error
)
{
tctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
networkTimeout
)
defer
cancel
()
head
,
err
:=
l
.
cfg
.
L1Client
.
HeaderByNumber
(
tctx
,
nil
)
if
err
!=
nil
{
return
eth
.
L1BlockRef
{},
fmt
.
Errorf
(
"getting latest L1 block: %w"
,
err
)
}
return
eth
.
L1BlockRefFromHeader
(
head
),
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