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
418d7999
Commit
418d7999
authored
Jan 26, 2023
by
Sebastian Stammler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-batcher: channelBuilder: Use ChannelOut.InputBytes
Better than replicating state.
parent
5b4c4822
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
channel_builder.go
op-batcher/batcher/channel_builder.go
+2
-6
No files found.
op-batcher/batcher/channel_builder.go
View file @
418d7999
...
@@ -17,8 +17,6 @@ type (
...
@@ -17,8 +17,6 @@ type (
channelBuilder
struct
{
channelBuilder
struct
{
cfg
ChannelConfig
cfg
ChannelConfig
// tracks total input data rlp bytes
inputSize
uint64
// marked as full if a) max RLP input bytes, b) max num frames or c) max
// marked as full if a) max RLP input bytes, b) max num frames or c) max
// allowed frame index (uint16) has been reached
// allowed frame index (uint16) has been reached
fullErr
error
fullErr
error
...
@@ -98,7 +96,6 @@ func (c *channelBuilder) Blocks() []*types.Block {
...
@@ -98,7 +96,6 @@ func (c *channelBuilder) Blocks() []*types.Block {
}
}
func
(
c
*
channelBuilder
)
Reset
()
error
{
func
(
c
*
channelBuilder
)
Reset
()
error
{
c
.
inputSize
=
0
c
.
blocks
=
c
.
blocks
[
:
0
]
c
.
blocks
=
c
.
blocks
[
:
0
]
c
.
frames
=
c
.
frames
[
:
0
]
c
.
frames
=
c
.
frames
[
:
0
]
return
c
.
co
.
Reset
()
return
c
.
co
.
Reset
()
...
@@ -117,14 +114,13 @@ func (c *channelBuilder) AddBlock(block *types.Block) error {
...
@@ -117,14 +114,13 @@ func (c *channelBuilder) AddBlock(block *types.Block) error {
return
c
.
FullErr
()
return
c
.
FullErr
()
}
}
rlpsize
,
err
:=
c
.
co
.
AddBlock
(
block
)
_
,
err
:=
c
.
co
.
AddBlock
(
block
)
if
errors
.
Is
(
err
,
derive
.
ErrTooManyRLPBytes
)
{
if
errors
.
Is
(
err
,
derive
.
ErrTooManyRLPBytes
)
{
c
.
setFullErr
(
err
)
c
.
setFullErr
(
err
)
return
c
.
FullErr
()
return
c
.
FullErr
()
}
else
if
err
!=
nil
{
}
else
if
err
!=
nil
{
return
fmt
.
Errorf
(
"adding block to channel out: %w"
,
err
)
return
fmt
.
Errorf
(
"adding block to channel out: %w"
,
err
)
}
}
c
.
inputSize
+=
rlpsize
c
.
blocks
=
append
(
c
.
blocks
,
block
)
c
.
blocks
=
append
(
c
.
blocks
,
block
)
if
c
.
InputTargetReached
()
{
if
c
.
InputTargetReached
()
{
...
@@ -138,7 +134,7 @@ func (c *channelBuilder) AddBlock(block *types.Block) error {
...
@@ -138,7 +134,7 @@ func (c *channelBuilder) AddBlock(block *types.Block) error {
// InputTargetReached says whether the target amount of input data has been
// InputTargetReached says whether the target amount of input data has been
// reached in this channel builder. No more blocks can be added afterwards.
// reached in this channel builder. No more blocks can be added afterwards.
func
(
c
*
channelBuilder
)
InputTargetReached
()
bool
{
func
(
c
*
channelBuilder
)
InputTargetReached
()
bool
{
return
c
.
inputSize
>=
c
.
cfg
.
InputThreshold
()
return
uint64
(
c
.
co
.
InputBytes
())
>=
c
.
cfg
.
InputThreshold
()
}
}
// IsFull returns whether the channel is full.
// IsFull returns whether the channel is full.
...
...
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