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
dd7f5dbb
Unverified
Commit
dd7f5dbb
authored
Sep 21, 2024
by
clabby
Committed by
GitHub
Sep 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(op-e2e): assert that the channel actually timed out (#11998)
* assert that the channel actually timed out * fmt
parent
c5007bb4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
3 deletions
+30
-3
l2_verifier.go
op-e2e/actions/helpers/l2_verifier.go
+10
-3
channel_timeout_test.go
op-e2e/actions/proofs/channel_timeout_test.go
+16
-0
metrics.go
op-service/testutils/metrics.go
+4
-0
No files found.
op-e2e/actions/helpers/l2_verifier.go
View file @
dd7f5dbb
...
@@ -49,8 +49,9 @@ type L2Verifier struct {
...
@@ -49,8 +49,9 @@ type L2Verifier struct {
drainer
event
.
Drainer
drainer
event
.
Drainer
// L2 rollup
// L2 rollup
engine
*
engine
.
EngineController
engine
*
engine
.
EngineController
derivation
*
derive
.
DerivationPipeline
derivationMetrics
*
testutils
.
TestDerivationMetrics
derivation
*
derive
.
DerivationPipeline
safeHeadListener
rollup
.
SafeHeadListener
safeHeadListener
rollup
.
SafeHeadListener
syncCfg
*
sync
.
Config
syncCfg
*
sync
.
Config
...
@@ -88,7 +89,8 @@ type safeDB interface {
...
@@ -88,7 +89,8 @@ type safeDB interface {
func
NewL2Verifier
(
t
Testing
,
log
log
.
Logger
,
l1
derive
.
L1Fetcher
,
func
NewL2Verifier
(
t
Testing
,
log
log
.
Logger
,
l1
derive
.
L1Fetcher
,
blobsSrc
derive
.
L1BlobsFetcher
,
altDASrc
driver
.
AltDAIface
,
blobsSrc
derive
.
L1BlobsFetcher
,
altDASrc
driver
.
AltDAIface
,
eng
L2API
,
cfg
*
rollup
.
Config
,
syncCfg
*
sync
.
Config
,
safeHeadListener
safeDB
,
eng
L2API
,
cfg
*
rollup
.
Config
,
syncCfg
*
sync
.
Config
,
safeHeadListener
safeDB
,
interopBackend
interop
.
InteropBackend
)
*
L2Verifier
{
interopBackend
interop
.
InteropBackend
,
)
*
L2Verifier
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
t
.
Cleanup
(
cancel
)
t
.
Cleanup
(
cancel
)
...
@@ -162,6 +164,7 @@ func NewL2Verifier(t Testing, log log.Logger, l1 derive.L1Fetcher,
...
@@ -162,6 +164,7 @@ func NewL2Verifier(t Testing, log log.Logger, l1 derive.L1Fetcher,
log
:
log
,
log
:
log
,
Eng
:
eng
,
Eng
:
eng
,
engine
:
ec
,
engine
:
ec
,
derivationMetrics
:
metrics
,
derivation
:
pipeline
,
derivation
:
pipeline
,
safeHeadListener
:
safeHeadListener
,
safeHeadListener
:
safeHeadListener
,
syncCfg
:
syncCfg
,
syncCfg
:
syncCfg
,
...
@@ -238,6 +241,10 @@ func (s *l2VerifierBackend) OnUnsafeL2Payload(ctx context.Context, envelope *eth
...
@@ -238,6 +241,10 @@ func (s *l2VerifierBackend) OnUnsafeL2Payload(ctx context.Context, envelope *eth
return
nil
return
nil
}
}
func
(
s
*
L2Verifier
)
DerivationMetricsTracer
()
*
testutils
.
TestDerivationMetrics
{
return
s
.
derivationMetrics
}
func
(
s
*
L2Verifier
)
L2Finalized
()
eth
.
L2BlockRef
{
func
(
s
*
L2Verifier
)
L2Finalized
()
eth
.
L2BlockRef
{
return
s
.
engine
.
Finalized
()
return
s
.
engine
.
Finalized
()
}
}
...
...
op-e2e/actions/proofs/channel_timeout_test.go
View file @
dd7f5dbb
...
@@ -17,6 +17,11 @@ func runChannelTimeoutTest(gt *testing.T, testCfg *helpers.TestCfg[any]) {
...
@@ -17,6 +17,11 @@ func runChannelTimeoutTest(gt *testing.T, testCfg *helpers.TestCfg[any]) {
env
:=
helpers
.
NewL2FaultProofEnv
(
t
,
testCfg
,
tp
,
helpers
.
NewBatcherCfg
())
env
:=
helpers
.
NewL2FaultProofEnv
(
t
,
testCfg
,
tp
,
helpers
.
NewBatcherCfg
())
channelTimeout
:=
env
.
Sd
.
ChainSpec
.
ChannelTimeout
(
0
)
channelTimeout
:=
env
.
Sd
.
ChainSpec
.
ChannelTimeout
(
0
)
var
timedOutChannels
uint
env
.
Sequencer
.
DerivationMetricsTracer
()
.
FnRecordChannelTimedOut
=
func
()
{
timedOutChannels
++
}
const
NumL2Blocks
=
10
const
NumL2Blocks
=
10
// Build NumL2Blocks empty blocks on L2
// Build NumL2Blocks empty blocks on L2
...
@@ -62,6 +67,9 @@ func runChannelTimeoutTest(gt *testing.T, testCfg *helpers.TestCfg[any]) {
...
@@ -62,6 +67,9 @@ func runChannelTimeoutTest(gt *testing.T, testCfg *helpers.TestCfg[any]) {
l2SafeHead
=
env
.
Engine
.
L2Chain
()
.
CurrentSafeBlock
()
l2SafeHead
=
env
.
Engine
.
L2Chain
()
.
CurrentSafeBlock
()
require
.
Equal
(
t
,
uint64
(
0
),
l2SafeHead
.
Number
.
Uint64
())
require
.
Equal
(
t
,
uint64
(
0
),
l2SafeHead
.
Number
.
Uint64
())
// Ensure that the channel was timed out.
require
.
EqualValues
(
t
,
1
,
timedOutChannels
)
// Instruct the batcher to submit the blocks to L1 in a new channel,
// Instruct the batcher to submit the blocks to L1 in a new channel,
// submitted across 2 transactions.
// submitted across 2 transactions.
for
i
:=
0
;
i
<
2
;
i
++
{
for
i
:=
0
;
i
<
2
;
i
++
{
...
@@ -103,6 +111,11 @@ func runChannelTimeoutTest_CloseChannelLate(gt *testing.T, testCfg *helpers.Test
...
@@ -103,6 +111,11 @@ func runChannelTimeoutTest_CloseChannelLate(gt *testing.T, testCfg *helpers.Test
env
:=
helpers
.
NewL2FaultProofEnv
(
t
,
testCfg
,
tp
,
helpers
.
NewBatcherCfg
())
env
:=
helpers
.
NewL2FaultProofEnv
(
t
,
testCfg
,
tp
,
helpers
.
NewBatcherCfg
())
channelTimeout
:=
env
.
Sd
.
ChainSpec
.
ChannelTimeout
(
0
)
channelTimeout
:=
env
.
Sd
.
ChainSpec
.
ChannelTimeout
(
0
)
var
timedOutChannels
uint
env
.
Sequencer
.
DerivationMetricsTracer
()
.
FnRecordChannelTimedOut
=
func
()
{
timedOutChannels
++
}
const
NumL2Blocks
=
10
const
NumL2Blocks
=
10
// Build NumL2Blocks empty blocks on L2
// Build NumL2Blocks empty blocks on L2
...
@@ -148,6 +161,9 @@ func runChannelTimeoutTest_CloseChannelLate(gt *testing.T, testCfg *helpers.Test
...
@@ -148,6 +161,9 @@ func runChannelTimeoutTest_CloseChannelLate(gt *testing.T, testCfg *helpers.Test
l2SafeHead
=
env
.
Engine
.
L2Chain
()
.
CurrentSafeBlock
()
l2SafeHead
=
env
.
Engine
.
L2Chain
()
.
CurrentSafeBlock
()
require
.
Equal
(
t
,
uint64
(
0
),
l2SafeHead
.
Number
.
Uint64
())
require
.
Equal
(
t
,
uint64
(
0
),
l2SafeHead
.
Number
.
Uint64
())
// Ensure that the channel was timed out.
require
.
EqualValues
(
t
,
1
,
timedOutChannels
)
// Cache the second and final frame of the channel from the batcher, but do not submit it yet.
// Cache the second and final frame of the channel from the batcher, but do not submit it yet.
for
i
:=
0
;
i
<
NumL2Blocks
/
2
;
i
++
{
for
i
:=
0
;
i
<
NumL2Blocks
/
2
;
i
++
{
env
.
Batcher
.
ActL2BatchBuffer
(
t
)
env
.
Batcher
.
ActL2BatchBuffer
(
t
)
...
...
op-service/testutils/metrics.go
View file @
dd7f5dbb
...
@@ -14,6 +14,7 @@ type TestDerivationMetrics struct {
...
@@ -14,6 +14,7 @@ type TestDerivationMetrics struct {
FnRecordL2Ref
func
(
name
string
,
ref
eth
.
L2BlockRef
)
FnRecordL2Ref
func
(
name
string
,
ref
eth
.
L2BlockRef
)
FnRecordUnsafePayloads
func
(
length
uint64
,
memSize
uint64
,
next
eth
.
BlockID
)
FnRecordUnsafePayloads
func
(
length
uint64
,
memSize
uint64
,
next
eth
.
BlockID
)
FnRecordChannelInputBytes
func
(
inputCompressedBytes
int
)
FnRecordChannelInputBytes
func
(
inputCompressedBytes
int
)
FnRecordChannelTimedOut
func
()
}
}
func
(
t
*
TestDerivationMetrics
)
CountSequencedTxs
(
count
int
)
{
func
(
t
*
TestDerivationMetrics
)
CountSequencedTxs
(
count
int
)
{
...
@@ -59,6 +60,9 @@ func (t *TestDerivationMetrics) RecordHeadChannelOpened() {
...
@@ -59,6 +60,9 @@ func (t *TestDerivationMetrics) RecordHeadChannelOpened() {
}
}
func
(
t
*
TestDerivationMetrics
)
RecordChannelTimedOut
()
{
func
(
t
*
TestDerivationMetrics
)
RecordChannelTimedOut
()
{
if
t
.
FnRecordChannelTimedOut
!=
nil
{
t
.
FnRecordChannelTimedOut
()
}
}
}
func
(
t
*
TestDerivationMetrics
)
RecordFrame
()
{
func
(
t
*
TestDerivationMetrics
)
RecordFrame
()
{
...
...
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