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
502732d4
Commit
502732d4
authored
Jan 26, 2023
by
Sebastian Stammler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-batcher: Improve code doc of channel builder & manager
parent
19834e00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
channel_builder.go
op-batcher/batcher/channel_builder.go
+3
-0
channel_manager.go
op-batcher/batcher/channel_manager.go
+10
-3
No files found.
op-batcher/batcher/channel_builder.go
View file @
502732d4
...
...
@@ -207,6 +207,9 @@ func (c *channelBuilder) closeAndOutputAllFrames() error {
}
}
// outputFrame creates one new frame and adds it to the frames queue.
// Note that compressed output data must be available on the underlying
// ChannelOut, or an empty frame will be produced.
func
(
c
*
channelBuilder
)
outputFrame
()
error
{
var
buf
bytes
.
Buffer
fn
,
err
:=
c
.
co
.
OutputFrame
(
&
buf
,
c
.
cfg
.
MaxFrameSize
)
...
...
op-batcher/batcher/channel_manager.go
View file @
502732d4
...
...
@@ -183,9 +183,14 @@ func (s *channelManager) nextTxData() ([]byte, txID, error) {
return
data
,
id
,
nil
}
// TxData returns the next tx.data that should be submitted to L1.
// It is very simple & currently ignores the l1Head provided (this will change).
// It may buffer very large channels as well.
// TxData returns the next tx data that should be submitted to L1.
//
// It currently only uses one frame per transaction. If the pending channel is
// full, it only returns the remaining frames of this channel until it got
// successfully fully sent to L1. It returns io.EOF if there's no pending frame.
//
// It currently ignores the l1Head provided and doesn't track channel timeouts
// or the sequencer window span yet.
func
(
s
*
channelManager
)
TxData
(
l1Head
eth
.
L1BlockRef
)
([]
byte
,
txID
,
error
)
{
dataPending
:=
s
.
pendingChannel
!=
nil
&&
s
.
pendingChannel
.
HasFrame
()
s
.
log
.
Debug
(
"Requested tx data"
,
"l1Head"
,
l1Head
,
"data_pending"
,
dataPending
,
"blocks_pending"
,
len
(
s
.
blocks
))
...
...
@@ -232,6 +237,8 @@ func (s *channelManager) ensurePendingChannel(l1Head eth.L1BlockRef) error {
return
nil
}
// addBlocks adds blocks from the blocks queue to the pending channel until
// either the queue got exhausted or the channel is full.
func
(
s
*
channelManager
)
addBlocks
()
error
{
var
(
blockidx
int
...
...
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