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
59d40347
Commit
59d40347
authored
Dec 03, 2023
by
Tei Im
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve span batch logging
parent
05deae54
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
4 deletions
+17
-4
channel_manager.go
op-batcher/batcher/channel_manager.go
+3
-1
batch_queue.go
op-node/rollup/derive/batch_queue.go
+7
-0
batches.go
op-node/rollup/derive/batches.go
+1
-1
channel_in_reader.go
op-node/rollup/derive/channel_in_reader.go
+2
-0
singular_batch.go
op-node/rollup/derive/singular_batch.go
+1
-0
span_batch.go
op-node/rollup/derive/span_batch.go
+3
-2
No files found.
op-batcher/batcher/channel_manager.go
View file @
59d40347
...
...
@@ -207,7 +207,9 @@ func (s *channelManager) ensureChannelWithSpace(l1Head eth.BlockID) error {
s
.
log
.
Info
(
"Created channel"
,
"id"
,
pc
.
ID
(),
"l1Head"
,
l1Head
,
"blocks_pending"
,
len
(
s
.
blocks
))
"blocks_pending"
,
len
(
s
.
blocks
),
"batch_type"
,
s
.
cfg
.
BatchType
,
)
s
.
metr
.
RecordChannelOpened
(
pc
.
ID
(),
len
(
s
.
blocks
))
return
nil
...
...
op-node/rollup/derive/batch_queue.go
View file @
59d40347
...
...
@@ -86,6 +86,7 @@ func (bq *BatchQueue) popNextBatch(parent eth.L2BlockRef) *SingularBatch {
bq
.
nextSpan
=
bq
.
nextSpan
[
1
:
]
// Must set ParentHash before return. we can use parent because the parentCheck is verified in CheckBatch().
nextBatch
.
ParentHash
=
parent
.
Hash
bq
.
log
.
Debug
(
"pop next batch from the cached span batch"
)
return
nextBatch
}
...
...
@@ -103,6 +104,7 @@ func (bq *BatchQueue) NextBatch(ctx context.Context, parent eth.L2BlockRef) (*Si
}
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
.
log
.
Warn
(
"parent block does not match the next batch. dropped cached batches"
,
"parent"
,
parent
.
ID
(),
"nextBatchTime"
,
bq
.
nextSpan
[
0
]
.
GetTimestamp
())
bq
.
nextSpan
=
bq
.
nextSpan
[
:
0
]
}
}
...
...
@@ -115,6 +117,11 @@ func (bq *BatchQueue) NextBatch(ctx context.Context, parent eth.L2BlockRef) (*Si
for
i
,
l1Block
:=
range
bq
.
l1Blocks
{
if
parent
.
L1Origin
.
Number
==
l1Block
.
Number
{
bq
.
l1Blocks
=
bq
.
l1Blocks
[
i
:
]
if
len
(
bq
.
l1Blocks
)
>
0
{
bq
.
log
.
Debug
(
"Advancing internal L1 blocks"
,
"next_epoch"
,
bq
.
l1Blocks
[
0
]
.
ID
(),
"next_epoch_time"
,
bq
.
l1Blocks
[
0
]
.
Time
)
}
else
{
bq
.
log
.
Debug
(
"Advancing internal L1 blocks. No L1 blocks left"
)
}
break
}
}
...
...
op-node/rollup/derive/batches.go
View file @
59d40347
...
...
@@ -187,7 +187,7 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
batchOrigin
=
l1Blocks
[
1
]
}
if
!
cfg
.
IsDelta
(
batchOrigin
.
Time
)
{
log
.
Warn
(
"received SpanBatch with L1 origin before Delta hard fork"
)
log
.
Warn
(
"received SpanBatch with L1 origin before Delta hard fork"
,
"l1_origin"
,
batchOrigin
.
ID
(),
"l1_origin_time"
,
batchOrigin
.
Time
)
return
BatchDrop
}
...
...
op-node/rollup/derive/channel_in_reader.go
View file @
59d40347
...
...
@@ -96,6 +96,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) {
if
!
ok
{
return
nil
,
NewCriticalError
(
errors
.
New
(
"failed type assertion to SingularBatch"
))
}
cr
.
log
.
Debug
(
"decoded singular batch from channel"
)
return
singularBatch
,
nil
case
SpanBatchType
:
if
origin
:=
cr
.
Origin
();
!
cr
.
cfg
.
IsDelta
(
origin
.
Time
)
{
...
...
@@ -113,6 +114,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) {
if
err
!=
nil
{
return
nil
,
err
}
cr
.
log
.
Debug
(
"decoded span batch from channel"
)
return
spanBatch
,
nil
default
:
// error is bubbled up to user, but pipeline can skip the batch and continue after.
...
...
op-node/rollup/derive/singular_batch.go
View file @
59d40347
...
...
@@ -44,6 +44,7 @@ func (b *SingularBatch) GetEpochNum() rollup.Epoch {
// LogContext creates a new log context that contains information of the batch
func
(
b
*
SingularBatch
)
LogContext
(
log
log
.
Logger
)
log
.
Logger
{
return
log
.
New
(
"batch_type"
,
"SingularBatch"
,
"batch_timestamp"
,
b
.
Timestamp
,
"parent_hash"
,
b
.
ParentHash
,
"batch_epoch"
,
b
.
Epoch
(),
...
...
op-node/rollup/derive/span_batch.go
View file @
59d40347
...
...
@@ -230,10 +230,10 @@ func (b *RawSpanBatch) decode(r *bytes.Reader) error {
return
ErrTooBigSpanBatchSize
}
if
err
:=
b
.
decodePrefix
(
r
);
err
!=
nil
{
return
err
return
fmt
.
Errorf
(
"failed to decode span batch prefix: %w"
,
err
)
}
if
err
:=
b
.
decodePayload
(
r
);
err
!=
nil
{
return
err
return
fmt
.
Errorf
(
"failed to decode span batch payload: %w"
,
err
)
}
return
nil
}
...
...
@@ -460,6 +460,7 @@ func (b *SpanBatch) LogContext(log log.Logger) log.Logger {
return
log
.
New
(
"block_count"
,
0
)
}
return
log
.
New
(
"batch_type"
,
"SpanBatch"
,
"batch_timestamp"
,
b
.
batches
[
0
]
.
Timestamp
,
"parent_check"
,
hexutil
.
Encode
(
b
.
parentCheck
[
:
]),
"origin_check"
,
hexutil
.
Encode
(
b
.
l1OriginCheck
[
:
]),
...
...
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