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
0781a082
Commit
0781a082
authored
Mar 14, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add fuzzing to the batcher makefile as a stop-gap solution
parent
f7e4cb60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
Makefile
op-batcher/Makefile
+11
-1
channel_builder_test.go
op-batcher/batcher/channel_builder_test.go
+12
-12
No files found.
op-batcher/Makefile
View file @
0781a082
...
@@ -19,8 +19,18 @@ test:
...
@@ -19,8 +19,18 @@ test:
lint
:
lint
:
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
-e
"errors.As"
-e
"errors.Is"
golangci-lint run
-E
goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint
-e
"errors.As"
-e
"errors.Is"
fuzz
:
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzDurationZero ./batcher
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzDurationTimeoutMaxChannelDuration ./batcher
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzDurationTimeoutZeroMaxChannelDuration ./batcher
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzChannelCloseTimeout ./batcher
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzChannelZeroCloseTimeout ./batcher
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzSeqWindowClose ./batcher
go
test
-run
NOTAREALTEST
-v
-fuzztime
10s
-fuzz
FuzzSeqWindowZeroTimeoutClose ./batcher
.PHONY
:
\
.PHONY
:
\
op-batcher
\
op-batcher
\
clean
\
clean
\
test
\
test
\
lint
lint
\
fuzz
op-batcher/batcher/channel_builder_test.go
View file @
0781a082
...
@@ -96,10 +96,10 @@ func FuzzDurationTimeoutZeroMaxChannelDuration(f *testing.F) {
...
@@ -96,10 +96,10 @@ func FuzzDurationTimeoutZeroMaxChannelDuration(f *testing.F) {
})
})
}
}
// FuzzDuration ensures that when whenever the MaxChannelDuration
// FuzzDuration
Zero
ensures that when whenever the MaxChannelDuration
// is not set to 0, the channel builder will always have a duration timeout
// is not set to 0, the channel builder will always have a duration timeout
// as long as the channel builder's timeout is set to 0.
// as long as the channel builder's timeout is set to 0.
func
FuzzDuration
(
f
*
testing
.
F
)
{
func
FuzzDuration
Zero
(
f
*
testing
.
F
)
{
for
i
:=
range
[
10
]
int
{}
{
for
i
:=
range
[
10
]
int
{}
{
f
.
Add
(
uint64
(
i
),
uint64
(
i
))
f
.
Add
(
uint64
(
i
),
uint64
(
i
))
}
}
...
@@ -122,10 +122,10 @@ func FuzzDuration(f *testing.F) {
...
@@ -122,10 +122,10 @@ func FuzzDuration(f *testing.F) {
})
})
}
}
// FuzzDurationTimeout ensures that when whenever the MaxChannelDuration
// FuzzDurationTimeout
MaxChannelDuration
ensures that when whenever the MaxChannelDuration
// is not set to 0, the channel builder will always have a duration timeout
// is not set to 0, the channel builder will always have a duration timeout
// as long as the channel builder's timeout is greater than the target block number.
// as long as the channel builder's timeout is greater than the target block number.
func
FuzzDurationTimeout
(
f
*
testing
.
F
)
{
func
FuzzDurationTimeout
MaxChannelDuration
(
f
*
testing
.
F
)
{
// Set multiple seeds in case fuzzing isn't explicitly used
// Set multiple seeds in case fuzzing isn't explicitly used
for
i
:=
range
[
10
]
int
{}
{
for
i
:=
range
[
10
]
int
{}
{
f
.
Add
(
uint64
(
i
),
uint64
(
i
),
uint64
(
i
))
f
.
Add
(
uint64
(
i
),
uint64
(
i
),
uint64
(
i
))
...
@@ -159,10 +159,10 @@ func FuzzDurationTimeout(f *testing.F) {
...
@@ -159,10 +159,10 @@ func FuzzDurationTimeout(f *testing.F) {
})
})
}
}
// FuzzChannel
TimeoutClose
ensures that the channel builder has a [ErrChannelTimeoutClose]
// FuzzChannel
CloseTimeout
ensures that the channel builder has a [ErrChannelTimeoutClose]
// as long as the timeout constraint is met and the builder's timeout is greater than
// as long as the timeout constraint is met and the builder's timeout is greater than
// the calculated timeout
// the calculated timeout
func
FuzzChannel
TimeoutClose
(
f
*
testing
.
F
)
{
func
FuzzChannel
CloseTimeout
(
f
*
testing
.
F
)
{
// Set multiple seeds in case fuzzing isn't explicitly used
// Set multiple seeds in case fuzzing isn't explicitly used
for
i
:=
range
[
10
]
int
{}
{
for
i
:=
range
[
10
]
int
{}
{
f
.
Add
(
uint64
(
i
),
uint64
(
i
),
uint64
(
i
),
uint64
(
i
*
5
))
f
.
Add
(
uint64
(
i
),
uint64
(
i
),
uint64
(
i
),
uint64
(
i
*
5
))
...
@@ -179,7 +179,7 @@ func FuzzChannelTimeoutClose(f *testing.F) {
...
@@ -179,7 +179,7 @@ func FuzzChannelTimeoutClose(f *testing.F) {
cb
.
timeout
=
timeout
cb
.
timeout
=
timeout
cb
.
FramePublished
(
l1BlockNum
)
cb
.
FramePublished
(
l1BlockNum
)
calculatedTimeout
:=
l1BlockNum
+
channelTimeout
-
subSafetyMargin
calculatedTimeout
:=
l1BlockNum
+
channelTimeout
-
subSafetyMargin
if
timeout
>
calculatedTimeout
{
if
timeout
>
calculatedTimeout
&&
calculatedTimeout
!=
0
{
cb
.
checkTimeout
(
calculatedTimeout
)
cb
.
checkTimeout
(
calculatedTimeout
)
require
.
ErrorIs
(
t
,
cb
.
FullErr
(),
ErrChannelTimeoutClose
)
require
.
ErrorIs
(
t
,
cb
.
FullErr
(),
ErrChannelTimeoutClose
)
}
else
{
}
else
{
...
@@ -188,9 +188,9 @@ func FuzzChannelTimeoutClose(f *testing.F) {
...
@@ -188,9 +188,9 @@ func FuzzChannelTimeoutClose(f *testing.F) {
})
})
}
}
// FuzzChannel
TimeoutCloseZero
Timeout ensures that the channel builder has a [ErrChannelTimeoutClose]
// FuzzChannel
ZeroClose
Timeout ensures that the channel builder has a [ErrChannelTimeoutClose]
// as long as the timeout constraint is met and the builder's timeout is set to zero.
// as long as the timeout constraint is met and the builder's timeout is set to zero.
func
FuzzChannel
TimeoutCloseZero
Timeout
(
f
*
testing
.
F
)
{
func
FuzzChannel
ZeroClose
Timeout
(
f
*
testing
.
F
)
{
// Set multiple seeds in case fuzzing isn't explicitly used
// Set multiple seeds in case fuzzing isn't explicitly used
for
i
:=
range
[
10
]
int
{}
{
for
i
:=
range
[
10
]
int
{}
{
f
.
Add
(
uint64
(
i
),
uint64
(
i
),
uint64
(
i
))
f
.
Add
(
uint64
(
i
),
uint64
(
i
),
uint64
(
i
))
...
@@ -238,7 +238,7 @@ func FuzzSeqWindowClose(f *testing.F) {
...
@@ -238,7 +238,7 @@ func FuzzSeqWindowClose(f *testing.F) {
},
},
})
})
calculatedTimeout
:=
epochNum
+
seqWindowSize
-
subSafetyMargin
calculatedTimeout
:=
epochNum
+
seqWindowSize
-
subSafetyMargin
if
timeout
>
calculatedTimeout
{
if
timeout
>
calculatedTimeout
&&
calculatedTimeout
!=
0
{
cb
.
checkTimeout
(
calculatedTimeout
)
cb
.
checkTimeout
(
calculatedTimeout
)
require
.
ErrorIs
(
t
,
cb
.
FullErr
(),
ErrSeqWindowClose
)
require
.
ErrorIs
(
t
,
cb
.
FullErr
(),
ErrSeqWindowClose
)
}
else
{
}
else
{
...
@@ -247,9 +247,9 @@ func FuzzSeqWindowClose(f *testing.F) {
...
@@ -247,9 +247,9 @@ func FuzzSeqWindowClose(f *testing.F) {
})
})
}
}
// FuzzSeqWindow
CloseZeroTimeout
ensures that the channel builder has a [ErrSeqWindowClose]
// FuzzSeqWindow
ZeroTimeoutClose
ensures that the channel builder has a [ErrSeqWindowClose]
// as long as the timeout constraint is met and the builder's timeout is set to zero.
// as long as the timeout constraint is met and the builder's timeout is set to zero.
func
FuzzSeqWindow
CloseZeroTimeout
(
f
*
testing
.
F
)
{
func
FuzzSeqWindow
ZeroTimeoutClose
(
f
*
testing
.
F
)
{
// Set multiple seeds in case fuzzing isn't explicitly used
// Set multiple seeds in case fuzzing isn't explicitly used
for
i
:=
range
[
10
]
int
{}
{
for
i
:=
range
[
10
]
int
{}
{
f
.
Add
(
uint64
(
i
),
uint64
(
i
),
uint64
(
i
))
f
.
Add
(
uint64
(
i
),
uint64
(
i
),
uint64
(
i
))
...
...
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