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
4de760d3
Commit
4de760d3
authored
Jan 24, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow Go doc comment conventions
parent
4c255a29
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
garbage_channel_out.go
op-e2e/actions/garbage_channel_out.go
+4
-2
l2_batcher.go
op-e2e/actions/l2_batcher.go
+2
-2
l2_batcher_test.go
op-e2e/actions/l2_batcher_test.go
+3
-2
No files found.
op-e2e/actions/garbage_channel_out.go
View file @
4de760d3
...
@@ -19,7 +19,7 @@ import (
...
@@ -19,7 +19,7 @@ import (
var
ErrNotDepositTx
=
errors
.
New
(
"first transaction in block is not a deposit tx"
)
var
ErrNotDepositTx
=
errors
.
New
(
"first transaction in block is not a deposit tx"
)
var
ErrTooManyRLPBytes
=
errors
.
New
(
"batch would cause RLP bytes to go over limit"
)
var
ErrTooManyRLPBytes
=
errors
.
New
(
"batch would cause RLP bytes to go over limit"
)
//
I
nterface shared between `zlib.Writer` and `gzip.Writer`
//
WriterApi is the i
nterface shared between `zlib.Writer` and `gzip.Writer`
type
WriterApi
interface
{
type
WriterApi
interface
{
Close
()
error
Close
()
error
Flush
()
error
Flush
()
error
...
@@ -27,7 +27,8 @@ type WriterApi interface {
...
@@ -27,7 +27,8 @@ type WriterApi interface {
Write
([]
byte
)
(
int
,
error
)
Write
([]
byte
)
(
int
,
error
)
}
}
// Modified `derive.ChannelOut` that can be configured to behave differently than the original
// GarbageChannelOut is a modified `derive.ChannelOut` that can be configured to behave differently
// than the original
type
GarbageChannelOut
struct
{
type
GarbageChannelOut
struct
{
id
derive
.
ChannelID
id
derive
.
ChannelID
// Frame ID of the next frame to emit. Increment after emitting
// Frame ID of the next frame to emit. Increment after emitting
...
@@ -50,6 +51,7 @@ func (co *GarbageChannelOut) ID() derive.ChannelID {
...
@@ -50,6 +51,7 @@ func (co *GarbageChannelOut) ID() derive.ChannelID {
return
co
.
id
return
co
.
id
}
}
// NewGarbageChannelOut creates a new `GarbageChannelOut` with the given configuration.
func
NewGarbageChannelOut
(
cfg
*
GarbageChannelCfg
)
(
*
GarbageChannelOut
,
error
)
{
func
NewGarbageChannelOut
(
cfg
*
GarbageChannelCfg
)
(
*
GarbageChannelOut
,
error
)
{
c
:=
&
GarbageChannelOut
{
c
:=
&
GarbageChannelOut
{
id
:
derive
.
ChannelID
{},
// TODO: use GUID here instead of fully random data
id
:
derive
.
ChannelID
{},
// TODO: use GUID here instead of fully random data
...
...
op-e2e/actions/l2_batcher.go
View file @
4de760d3
...
@@ -254,9 +254,9 @@ type GarbageChannelCfg struct {
...
@@ -254,9 +254,9 @@ type GarbageChannelCfg struct {
malformRLP
bool
malformRLP
bool
}
}
// ActL2BatchSubmit constructs a malformed channel frame and submits it to the
// ActL2BatchSubmit
Garbage
constructs a malformed channel frame and submits it to the
// batch inbox. This *should* cause the batch inbox to reject the blocks
// batch inbox. This *should* cause the batch inbox to reject the blocks
// encoded within the frame, even if the
y
are valid.
// encoded within the frame, even if the
blocks themselves
are valid.
func
(
s
*
L2Batcher
)
ActL2BatchSubmitGarbage
(
t
Testing
,
kind
GarbageKind
)
{
func
(
s
*
L2Batcher
)
ActL2BatchSubmitGarbage
(
t
Testing
,
kind
GarbageKind
)
{
// Don't run this action if there's no data to submit
// Don't run this action if there's no data to submit
if
s
.
l2ChannelOut
==
nil
{
if
s
.
l2ChannelOut
==
nil
{
...
...
op-e2e/actions/l2_batcher_test.go
View file @
4de760d3
...
@@ -196,8 +196,9 @@ func TestL2Finalization(gt *testing.T) {
...
@@ -196,8 +196,9 @@ func TestL2Finalization(gt *testing.T) {
require
.
Equal
(
t
,
heightToSubmit
,
sequencer
.
SyncStatus
()
.
FinalizedL2
.
Number
,
"unknown/bad finalized L1 blocks are ignored"
)
require
.
Equal
(
t
,
heightToSubmit
,
sequencer
.
SyncStatus
()
.
FinalizedL2
.
Number
,
"unknown/bad finalized L1 blocks are ignored"
)
}
}
// Tests the behavior of an invalid/malformed output channel frame containing
// TestGarbageBatch tests the behavior of an invalid/malformed output channel frame containing
// valid batches being submitted to the batch inbox.
// valid batches being submitted to the batch inbox. These batches should always be rejected
// and the safe L2 head should remain unaltered.
func
TestGarbageBatch
(
gt
*
testing
.
T
)
{
func
TestGarbageBatch
(
gt
*
testing
.
T
)
{
t
:=
NewDefaultTesting
(
gt
)
t
:=
NewDefaultTesting
(
gt
)
p
:=
defaultRollupTestParams
p
:=
defaultRollupTestParams
...
...
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