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
4dd44c5a
Commit
4dd44c5a
authored
Jan 13, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add random bytes `GarbageKind`; Remove `MALFORM_RLP` & `INVALID_COMPRESSION` are WIP
parent
6b34dedd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
l2_batcher.go
op-e2e/actions/l2_batcher.go
+12
-5
No files found.
op-e2e/actions/l2_batcher.go
View file @
4dd44c5a
...
@@ -4,9 +4,9 @@ import (
...
@@ -4,9 +4,9 @@ import (
"bytes"
"bytes"
"context"
"context"
"crypto/ecdsa"
"crypto/ecdsa"
"encoding/hex"
"io"
"io"
"math/big"
"math/big"
"math/rand"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
...
@@ -14,7 +14,6 @@ import (
...
@@ -14,7 +14,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
...
@@ -202,14 +201,18 @@ type GarbageKind int64
...
@@ -202,14 +201,18 @@ type GarbageKind int64
const
(
const
(
STRIP_VERSION
GarbageKind
=
iota
STRIP_VERSION
GarbageKind
=
iota
RANDOM
MALFORM_RLP
MALFORM_RLP
INVALID_COMPRESSION
TRUNCATE_END
TRUNCATE_END
DIRTY_APPEND
DIRTY_APPEND
)
)
var
GarbageKinds
=
[]
GarbageKind
{
var
GarbageKinds
=
[]
GarbageKind
{
STRIP_VERSION
,
STRIP_VERSION
,
RANDOM
,
// MALFORM_RLP,
// MALFORM_RLP,
// INVALID_COMPRESSION,
TRUNCATE_END
,
TRUNCATE_END
,
DIRTY_APPEND
,
DIRTY_APPEND
,
}
}
...
@@ -226,6 +229,7 @@ func (s *L2Batcher) ActL2BatchSubmitGarbage(t Testing, kind GarbageKind) {
...
@@ -226,6 +229,7 @@ func (s *L2Batcher) ActL2BatchSubmitGarbage(t Testing, kind GarbageKind) {
// Collect the output frame
// Collect the output frame
data
:=
new
(
bytes
.
Buffer
)
data
:=
new
(
bytes
.
Buffer
)
data
.
WriteByte
(
derive
.
DerivationVersion0
)
data
.
WriteByte
(
derive
.
DerivationVersion0
)
// subtract one, to account for the version byte
// subtract one, to account for the version byte
if
err
:=
s
.
l2ChannelOut
.
OutputFrame
(
data
,
s
.
l2BatcherCfg
.
MaxL1TxSize
-
1
);
err
==
io
.
EOF
{
if
err
:=
s
.
l2ChannelOut
.
OutputFrame
(
data
,
s
.
l2BatcherCfg
.
MaxL1TxSize
-
1
);
err
==
io
.
EOF
{
s
.
l2ChannelOut
=
nil
s
.
l2ChannelOut
=
nil
...
@@ -242,9 +246,12 @@ func (s *L2Batcher) ActL2BatchSubmitGarbage(t Testing, kind GarbageKind) {
...
@@ -242,9 +246,12 @@ func (s *L2Batcher) ActL2BatchSubmitGarbage(t Testing, kind GarbageKind) {
// Strip the derivation version byte from the output frame
// Strip the derivation version byte from the output frame
case
STRIP_VERSION
:
case
STRIP_VERSION
:
outputFrame
=
outputFrame
[
1
:
]
outputFrame
=
outputFrame
[
1
:
]
case
MALFORM_RLP
:
// Replace the output frame with random bytes of length [1, 512]
// WIP
case
RANDOM
:
t
.
Log
(
"output frame"
,
hex
.
EncodeToString
(
outputFrame
),
rlp
.
Decode
(
bytes
.
NewReader
(
outputFrame
[
1
:
len
(
outputFrame
)
-
47
]),
&
derive
.
BatchData
{}))
buf
:=
make
([]
byte
,
rand
.
Intn
(
512
)
+
1
)
_
,
err
:=
rand
.
Read
(
buf
)
require
.
NoError
(
t
,
err
,
"error generating random bytes"
)
outputFrame
=
buf
// Remove 4 bytes from the tail end of the output frame
// Remove 4 bytes from the tail end of the output frame
case
TRUNCATE_END
:
case
TRUNCATE_END
:
outputFrame
=
outputFrame
[
:
len
(
outputFrame
)
-
4
]
outputFrame
=
outputFrame
[
:
len
(
outputFrame
)
-
4
]
...
...
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