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
79c1c5ac
Unverified
Commit
79c1c5ac
authored
Oct 30, 2023
by
Tei Im
Committed by
protolambda
Oct 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments in batch queue
parent
210492cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
batch_queue.go
op-node/rollup/derive/batch_queue.go
+9
-1
No files found.
op-node/rollup/derive/batch_queue.go
View file @
79c1c5ac
...
...
@@ -93,11 +93,16 @@ func (bq *BatchQueue) popNextBatch(safeL2Head eth.L2BlockRef) *SingularBatch {
// It also returns the boolean that indicates if the batch is the last block in the batch.
func
(
bq
*
BatchQueue
)
NextBatch
(
ctx
context
.
Context
,
safeL2Head
eth
.
L2BlockRef
)
(
*
SingularBatch
,
bool
,
error
)
{
if
len
(
bq
.
nextSpan
)
>
0
{
// There are cached singular batches derived from the span batch.
// Check if the next cached batch matches the given parent block.
if
bq
.
nextSpan
[
0
]
.
Timestamp
==
safeL2Head
.
Time
+
bq
.
config
.
BlockTime
{
//
If there are cached singular batches, p
op first one and return.
//
P
op first one and return.
nextBatch
:=
bq
.
popNextBatch
(
safeL2Head
)
// len(bq.nextSpan) == 0 means it's the last batch of the span.
return
nextBatch
,
len
(
bq
.
nextSpan
)
==
0
,
nil
}
else
{
// Given parent block does not match the next batch. It means the previously returned batch is invalid.
// Drop cached batches and find another batch.
bq
.
nextSpan
=
bq
.
nextSpan
[
:
0
]
}
}
...
...
@@ -110,6 +115,7 @@ func (bq *BatchQueue) NextBatch(ctx context.Context, safeL2Head eth.L2BlockRef)
break
}
}
// If we can't find the origin of parent block, we have to advance bq.origin.
}
// Note: We use the origin that we will have to determine if it's behind. This is important
...
...
@@ -189,6 +195,8 @@ func (bq *BatchQueue) NextBatch(ctx context.Context, safeL2Head eth.L2BlockRef)
return
nil
,
false
,
NewCriticalError
(
fmt
.
Errorf
(
"unrecognized batch type: %d"
,
batch
.
GetBatchType
()))
}
// If the nextBatch is derived from the span batch, len(bq.nextSpan) == 0 means it's the last batch of the span.
// For singular batches, len(bq.nextSpan) == 0 is always true.
return
nextBatch
,
len
(
bq
.
nextSpan
)
==
0
,
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