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
58c8b1f4
Unverified
Commit
58c8b1f4
authored
Nov 01, 2023
by
protolambda
Committed by
GitHub
Nov 01, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7953 from testinprod-io/tip/batches-test-refactoring
Batch validation test refactoring
parents
9bfaf926
87a06441
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
409 additions
and
334 deletions
+409
-334
batches.go
op-node/rollup/derive/batches.go
+4
-4
batches_test.go
op-node/rollup/derive/batches_test.go
+405
-330
No files found.
op-node/rollup/derive/batches.go
View file @
58c8b1f4
...
@@ -199,18 +199,18 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
...
@@ -199,18 +199,18 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
if
batch
.
GetTimestamp
()
<
nextTimestamp
{
if
batch
.
GetTimestamp
()
<
nextTimestamp
{
if
batch
.
GetTimestamp
()
>
l2SafeHead
.
Time
{
if
batch
.
GetTimestamp
()
>
l2SafeHead
.
Time
{
// batch timestamp cannot be between safe head and next timestamp
// batch timestamp cannot be between safe head and next timestamp
log
.
Warn
(
"batch has misaligned timestamp"
)
log
.
Warn
(
"batch has misaligned timestamp
, block time is too short
"
)
return
BatchDrop
return
BatchDrop
}
}
if
(
l2SafeHead
.
Time
-
batch
.
GetTimestamp
())
%
cfg
.
BlockTime
!=
0
{
if
(
l2SafeHead
.
Time
-
batch
.
GetTimestamp
())
%
cfg
.
BlockTime
!=
0
{
log
.
Warn
(
"batch has misaligned timestamp"
)
log
.
Warn
(
"batch has misaligned timestamp
, not overlapped exactly
"
)
return
BatchDrop
return
BatchDrop
}
}
parentNum
=
l2SafeHead
.
Number
-
(
l2SafeHead
.
Time
-
batch
.
GetTimestamp
())
/
cfg
.
BlockTime
-
1
parentNum
=
l2SafeHead
.
Number
-
(
l2SafeHead
.
Time
-
batch
.
GetTimestamp
())
/
cfg
.
BlockTime
-
1
var
err
error
var
err
error
parentBlock
,
err
=
l2Fetcher
.
L2BlockRefByNumber
(
ctx
,
parentNum
)
parentBlock
,
err
=
l2Fetcher
.
L2BlockRefByNumber
(
ctx
,
parentNum
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"failed to fetch L2 block"
,
"number"
,
parentNum
,
"err"
,
err
)
log
.
Warn
(
"failed to fetch L2 block"
,
"number"
,
parentNum
,
"err"
,
err
)
// unable to validate the batch for now. retry later.
// unable to validate the batch for now. retry later.
return
BatchUndecided
return
BatchUndecided
}
}
...
@@ -332,7 +332,7 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
...
@@ -332,7 +332,7 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
safeBlockNum
:=
parentNum
+
i
+
1
safeBlockNum
:=
parentNum
+
i
+
1
safeBlockPayload
,
err
:=
l2Fetcher
.
PayloadByNumber
(
ctx
,
safeBlockNum
)
safeBlockPayload
,
err
:=
l2Fetcher
.
PayloadByNumber
(
ctx
,
safeBlockNum
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"failed to fetch L2 block payload"
,
"number"
,
parentNum
,
"err"
,
err
)
log
.
Warn
(
"failed to fetch L2 block payload"
,
"number"
,
parentNum
,
"err"
,
err
)
// unable to validate the batch for now. retry later.
// unable to validate the batch for now. retry later.
return
BatchUndecided
return
BatchUndecided
}
}
...
...
op-node/rollup/derive/batches_test.go
View file @
58c8b1f4
This diff is collapsed.
Click to expand it.
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