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
8209e753
Unverified
Commit
8209e753
authored
Nov 14, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-challenger: Do not allow both cannon and outputCannon trace types to be enabled
parent
290f58c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
config.go
op-challenger/config/config.go
+4
-0
config_test.go
op-challenger/config/config_test.go
+8
-7
No files found.
op-challenger/config/config.go
View file @
8209e753
...
@@ -34,6 +34,7 @@ var (
...
@@ -34,6 +34,7 @@ var (
ErrCannonNetworkAndL2Genesis
=
errors
.
New
(
"only specify one of network or l2 genesis path"
)
ErrCannonNetworkAndL2Genesis
=
errors
.
New
(
"only specify one of network or l2 genesis path"
)
ErrCannonNetworkUnknown
=
errors
.
New
(
"unknown cannon network"
)
ErrCannonNetworkUnknown
=
errors
.
New
(
"unknown cannon network"
)
ErrMissingRollupRpc
=
errors
.
New
(
"missing rollup rpc url"
)
ErrMissingRollupRpc
=
errors
.
New
(
"missing rollup rpc url"
)
ErrCannonAndOutputCannonConflict
=
errors
.
New
(
"trace types cannon and outputCannon cannot be enabled at the same time"
)
)
)
type
TraceType
string
type
TraceType
string
...
@@ -187,6 +188,9 @@ func (c Config) Check() error {
...
@@ -187,6 +188,9 @@ func (c Config) Check() error {
return
ErrMissingRollupRpc
return
ErrMissingRollupRpc
}
}
}
}
if
c
.
TraceTypeEnabled
(
TraceTypeCannon
)
&&
c
.
TraceTypeEnabled
(
TraceTypeOutputCannon
)
{
return
ErrCannonAndOutputCannonConflict
}
if
c
.
TraceTypeEnabled
(
TraceTypeCannon
)
||
c
.
TraceTypeEnabled
(
TraceTypeOutputCannon
)
{
if
c
.
TraceTypeEnabled
(
TraceTypeCannon
)
||
c
.
TraceTypeEnabled
(
TraceTypeOutputCannon
)
{
if
c
.
CannonBin
==
""
{
if
c
.
CannonBin
==
""
{
return
ErrMissingCannonBin
return
ErrMissingCannonBin
...
...
op-challenger/config/config_test.go
View file @
8209e753
...
@@ -135,6 +135,12 @@ func TestRollupRpcRequired(t *testing.T) {
...
@@ -135,6 +135,12 @@ func TestRollupRpcRequired(t *testing.T) {
require
.
ErrorIs
(
t
,
config
.
Check
(),
ErrMissingRollupRpc
)
require
.
ErrorIs
(
t
,
config
.
Check
(),
ErrMissingRollupRpc
)
}
}
func
TestCannotEnableBothCannonAndOutputCannonTraceTypes
(
t
*
testing
.
T
)
{
config
:=
validConfig
(
TraceTypeOutputCannon
)
config
.
TraceTypes
=
append
(
config
.
TraceTypes
,
TraceTypeCannon
)
require
.
ErrorIs
(
t
,
config
.
Check
(),
ErrCannonAndOutputCannonConflict
)
}
func
TestCannonL2Required
(
t
*
testing
.
T
)
{
func
TestCannonL2Required
(
t
*
testing
.
T
)
{
config
:=
validConfig
(
TraceTypeCannon
)
config
:=
validConfig
(
TraceTypeCannon
)
config
.
CannonL2
=
""
config
.
CannonL2
=
""
...
@@ -195,19 +201,14 @@ func TestNetworkMustBeValid(t *testing.T) {
...
@@ -195,19 +201,14 @@ func TestNetworkMustBeValid(t *testing.T) {
require
.
ErrorIs
(
t
,
cfg
.
Check
(),
ErrCannonNetworkUnknown
)
require
.
ErrorIs
(
t
,
cfg
.
Check
(),
ErrCannonNetworkUnknown
)
}
}
func
TestRequireConfigFor
AllSupported
TraceTypes
(
t
*
testing
.
T
)
{
func
TestRequireConfigFor
Multiple
TraceTypes
(
t
*
testing
.
T
)
{
cfg
:=
validConfig
(
TraceTypeCannon
)
cfg
:=
validConfig
(
TraceTypeCannon
)
cfg
.
TraceTypes
=
[]
TraceType
{
TraceTypeCannon
,
TraceType
OutputCannon
,
TraceType
Alphabet
}
cfg
.
TraceTypes
=
[]
TraceType
{
TraceTypeCannon
,
TraceTypeAlphabet
}
// Set all required options and check its valid
// Set all required options and check its valid
cfg
.
RollupRpc
=
validRollupRpc
cfg
.
RollupRpc
=
validRollupRpc
cfg
.
AlphabetTrace
=
validAlphabetTrace
cfg
.
AlphabetTrace
=
validAlphabetTrace
require
.
NoError
(
t
,
cfg
.
Check
())
require
.
NoError
(
t
,
cfg
.
Check
())
// Require output cannon specific args
cfg
.
RollupRpc
=
""
require
.
ErrorIs
(
t
,
cfg
.
Check
(),
ErrMissingRollupRpc
)
cfg
.
RollupRpc
=
validRollupRpc
// Require cannon specific args
// Require cannon specific args
cfg
.
CannonL2
=
""
cfg
.
CannonL2
=
""
require
.
ErrorIs
(
t
,
cfg
.
Check
(),
ErrMissingCannonL2
)
require
.
ErrorIs
(
t
,
cfg
.
Check
(),
ErrMissingCannonL2
)
...
...
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