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
acdd051d
Unverified
Commit
acdd051d
authored
Mar 27, 2023
by
Brian Bland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Immediately flush channel builder on channel manager close
parent
8b87c2d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
18 deletions
+23
-18
channel_manager.go
op-batcher/batcher/channel_manager.go
+12
-15
driver.go
op-batcher/batcher/driver.go
+8
-2
migration_test.go
op-e2e/migration_test.go
+3
-1
No files found.
op-batcher/batcher/channel_manager.go
View file @
acdd051d
...
@@ -187,8 +187,8 @@ func (s *channelManager) TxData(l1Head eth.BlockID) (txData, error) {
...
@@ -187,8 +187,8 @@ func (s *channelManager) TxData(l1Head eth.BlockID) (txData, error) {
dataPending
:=
s
.
pendingChannel
!=
nil
&&
s
.
pendingChannel
.
HasFrame
()
dataPending
:=
s
.
pendingChannel
!=
nil
&&
s
.
pendingChannel
.
HasFrame
()
s
.
log
.
Debug
(
"Requested tx data"
,
"l1Head"
,
l1Head
,
"data_pending"
,
dataPending
,
"blocks_pending"
,
len
(
s
.
blocks
))
s
.
log
.
Debug
(
"Requested tx data"
,
"l1Head"
,
l1Head
,
"data_pending"
,
dataPending
,
"blocks_pending"
,
len
(
s
.
blocks
))
// Short circuit if there is a pending frame.
// Short circuit if there is a pending frame
or the channel manager is closed
.
if
dataPending
{
if
dataPending
||
s
.
closed
{
return
s
.
nextTxData
()
return
s
.
nextTxData
()
}
}
...
@@ -203,11 +203,8 @@ func (s *channelManager) TxData(l1Head eth.BlockID) (txData, error) {
...
@@ -203,11 +203,8 @@ func (s *channelManager) TxData(l1Head eth.BlockID) (txData, error) {
return
txData
{},
err
return
txData
{},
err
}
}
// Avoid processing blocks if the channel manager has been explicitly closed.
if
err
:=
s
.
processBlocks
();
err
!=
nil
{
if
!
s
.
closed
{
return
txData
{},
err
if
err
:=
s
.
processBlocks
();
err
!=
nil
{
return
txData
{},
err
}
}
}
// Register current L1 head only after all pending blocks have been
// Register current L1 head only after all pending blocks have been
...
@@ -356,14 +353,12 @@ func l2BlockRefFromBlockAndL1Info(block *types.Block, l1info derive.L1BlockInfo)
...
@@ -356,14 +353,12 @@ func l2BlockRefFromBlockAndL1Info(block *types.Block, l1info derive.L1BlockInfo)
}
}
}
}
// Close closes the current pending channel, if one exists, and prevents the
// Close closes the current pending channel, if one exists, outputs any remaining frames,
// creation of any new channels.
// and prevents the creation of any new channels.
// This ensures that no new blocks will be added to the channel, but there may be any number
// Any outputted frames still need to be published.
// of frames still produced by calling `OutputFrames()`, which flushes the compression buffer.
func
(
s
*
channelManager
)
Close
()
error
{
// These frames still need to be published.
func
(
s
*
channelManager
)
Close
()
{
if
s
.
closed
{
if
s
.
closed
{
return
return
nil
}
}
s
.
closed
=
true
s
.
closed
=
true
...
@@ -374,8 +369,10 @@ func (s *channelManager) Close() {
...
@@ -374,8 +369,10 @@ func (s *channelManager) Close() {
}
}
if
s
.
pendingChannel
==
nil
{
if
s
.
pendingChannel
==
nil
{
return
return
nil
}
}
s
.
pendingChannel
.
Close
()
s
.
pendingChannel
.
Close
()
return
s
.
outputFrames
()
}
}
op-batcher/batcher/driver.go
View file @
acdd051d
...
@@ -317,9 +317,15 @@ func (l *BatchSubmitter) publishStateToL1(ctx context.Context) {
...
@@ -317,9 +317,15 @@ func (l *BatchSubmitter) publishStateToL1(ctx context.Context) {
// produced. Any remaining frames must still be published to the L1 to prevent stalling.
// produced. Any remaining frames must still be published to the L1 to prevent stalling.
select
{
select
{
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
l
.
state
.
Close
()
err
:=
l
.
state
.
Close
()
if
err
!=
nil
{
l
.
log
.
Error
(
"error closing the channel manager"
,
"err"
,
err
)
}
case
<-
l
.
shutdownCtx
.
Done
()
:
case
<-
l
.
shutdownCtx
.
Done
()
:
l
.
state
.
Close
()
err
:=
l
.
state
.
Close
()
if
err
!=
nil
{
l
.
log
.
Error
(
"error closing the channel manager"
,
"err"
,
err
)
}
default
:
default
:
}
}
...
...
op-e2e/migration_test.go
View file @
acdd051d
...
@@ -352,7 +352,9 @@ func TestMigration(t *testing.T) {
...
@@ -352,7 +352,9 @@ func TestMigration(t *testing.T) {
},
lgr
.
New
(
"module"
,
"batcher"
),
batchermetrics
.
NoopMetrics
)
},
lgr
.
New
(
"module"
,
"batcher"
),
batchermetrics
.
NoopMetrics
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
t
.
Cleanup
(
func
()
{
t
.
Cleanup
(
func
()
{
batcher
.
StopIfRunning
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
10
*
time
.
Second
)
defer
cancel
()
batcher
.
StopIfRunning
(
ctx
)
})
})
proposer
,
err
:=
l2os
.
NewL2OutputSubmitterFromCLIConfig
(
l2os
.
CLIConfig
{
proposer
,
err
:=
l2os
.
NewL2OutputSubmitterFromCLIConfig
(
l2os
.
CLIConfig
{
...
...
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