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
4cfe73f6
Commit
4cfe73f6
authored
Sep 15, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rollup RPC Flag
parent
b6c8e14e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
0 deletions
+46
-0
main_test.go
op-challenger/cmd/main_test.go
+23
-0
config.go
op-challenger/config/config.go
+9
-0
config_test.go
op-challenger/config/config_test.go
+10
-0
flags.go
op-challenger/flags/flags.go
+4
-0
No files found.
op-challenger/cmd/main_test.go
View file @
4cfe73f6
...
...
@@ -24,6 +24,7 @@ var (
cannonPreState
=
"./pre.json"
datadir
=
"./test_data"
cannonL2
=
"http://example.com:9545"
rollupRpc
=
"http://example.com:8555"
alphabetTrace
=
"abcdefghijz"
agreeWithProposedOutput
=
"true"
)
...
...
@@ -249,6 +250,25 @@ func TestDataDir(t *testing.T) {
})
}
func
TestRollupRpc
(
t
*
testing
.
T
)
{
t
.
Run
(
"NotRequiredForAlphabetTrace"
,
func
(
t
*
testing
.
T
)
{
configForArgs
(
t
,
addRequiredArgsExcept
(
config
.
TraceTypeAlphabet
,
"--rollup-rpc"
))
})
t
.
Run
(
"NotRequiredForAlphabetTrace"
,
func
(
t
*
testing
.
T
)
{
configForArgs
(
t
,
addRequiredArgsExcept
(
config
.
TraceTypeCannon
,
"--rollup-rpc"
))
})
t
.
Run
(
"RequiredForOutputCannonTrace"
,
func
(
t
*
testing
.
T
)
{
verifyArgsInvalid
(
t
,
"flag rollup-rpc is required"
,
addRequiredArgsExcept
(
config
.
TraceTypeOutputCannon
,
"--rollup-rpc"
))
})
t
.
Run
(
"Valid"
,
func
(
t
*
testing
.
T
)
{
cfg
:=
configForArgs
(
t
,
addRequiredArgs
(
config
.
TraceTypeOutputCannon
))
require
.
Equal
(
t
,
rollupRpc
,
cfg
.
RollupRpc
)
})
}
func
TestCannonL2
(
t
*
testing
.
T
)
{
t
.
Run
(
"NotRequiredForAlphabetTrace"
,
func
(
t
*
testing
.
T
)
{
configForArgs
(
t
,
addRequiredArgsExcept
(
config
.
TraceTypeAlphabet
,
"--cannon-l2"
))
...
...
@@ -429,6 +449,9 @@ func requiredArgs(traceType config.TraceType) map[string]string {
args
[
"--cannon-prestate"
]
=
cannonPreState
args
[
"--cannon-l2"
]
=
cannonL2
}
if
traceType
==
config
.
TraceTypeOutputCannon
{
args
[
"--rollup-rpc"
]
=
rollupRpc
}
return
args
}
...
...
op-challenger/config/config.go
View file @
4cfe73f6
...
...
@@ -32,6 +32,7 @@ var (
ErrCannonNetworkAndRollupConfig
=
errors
.
New
(
"only specify one of network or rollup config path"
)
ErrCannonNetworkAndL2Genesis
=
errors
.
New
(
"only specify one of network or l2 genesis path"
)
ErrCannonNetworkUnknown
=
errors
.
New
(
"unknown cannon network"
)
ErrMissingRollupRpc
=
errors
.
New
(
"missing rollup rpc url"
)
)
type
TraceType
string
...
...
@@ -107,6 +108,9 @@ type Config struct {
// Specific to the alphabet trace provider
AlphabetTrace
string
// String for the AlphabetTraceProvider
// Specific to the output cannon trace type
RollupRpc
string
// Specific to the cannon trace provider
CannonBin
string
// Path to the cannon executable to run when generating trace data
CannonServer
string
// Path to the op-program executable that provides the pre-image oracle server
...
...
@@ -168,6 +172,11 @@ func (c Config) Check() error {
if
c
.
MaxConcurrency
==
0
{
return
ErrMaxConcurrencyZero
}
if
c
.
TraceType
==
TraceTypeOutputCannon
{
if
c
.
RollupRpc
==
""
{
return
ErrMissingRollupRpc
}
}
if
c
.
TraceType
==
TraceTypeCannon
||
c
.
TraceType
==
TraceTypeOutputCannon
{
if
c
.
CannonBin
==
""
{
return
ErrMissingCannonBin
...
...
op-challenger/config/config_test.go
View file @
4cfe73f6
...
...
@@ -20,6 +20,7 @@ var (
validCannonAbsolutPreState
=
"pre.json"
validDatadir
=
"/tmp/data"
validCannonL2
=
"http://localhost:9545"
validRollupRpc
=
"http://localhost:8555"
agreeWithProposedOutput
=
true
)
...
...
@@ -35,6 +36,9 @@ func validConfig(traceType TraceType) Config {
cfg
.
CannonL2
=
validCannonL2
cfg
.
CannonNetwork
=
validCannonNetwork
}
if
traceType
==
TraceTypeOutputCannon
{
cfg
.
RollupRpc
=
validRollupRpc
}
return
cfg
}
...
...
@@ -125,6 +129,12 @@ func TestHttpPollInterval(t *testing.T) {
})
}
func
TestRollupRpcRequired
(
t
*
testing
.
T
)
{
config
:=
validConfig
(
TraceTypeOutputCannon
)
config
.
RollupRpc
=
""
require
.
ErrorIs
(
t
,
config
.
Check
(),
ErrMissingRollupRpc
)
}
func
TestCannonL2Required
(
t
*
testing
.
T
)
{
config
:=
validConfig
(
TraceTypeCannon
)
config
.
CannonL2
=
""
...
...
op-challenger/flags/flags.go
View file @
4cfe73f6
...
...
@@ -230,6 +230,9 @@ func CheckRequired(ctx *cli.Context) error {
if
err
:=
CheckCannonFlags
(
ctx
);
err
!=
nil
{
return
err
}
if
!
ctx
.
IsSet
(
RollupRpcFlag
.
Name
)
{
return
fmt
.
Errorf
(
"flag %s is required"
,
RollupRpcFlag
.
Name
)
}
default
:
return
fmt
.
Errorf
(
"invalid trace type. must be one of %v"
,
config
.
TraceTypes
)
}
...
...
@@ -275,6 +278,7 @@ func NewConfigFromCLI(ctx *cli.Context) (*config.Config, error) {
GameWindow
:
ctx
.
Duration
(
GameWindowFlag
.
Name
),
MaxConcurrency
:
maxConcurrency
,
PollInterval
:
ctx
.
Duration
(
HTTPPollInterval
.
Name
),
RollupRpc
:
ctx
.
String
(
RollupRpcFlag
.
Name
),
AlphabetTrace
:
ctx
.
String
(
AlphabetFlag
.
Name
),
CannonNetwork
:
ctx
.
String
(
CannonNetworkFlag
.
Name
),
CannonRollupConfigPath
:
ctx
.
String
(
CannonRollupConfigFlag
.
Name
),
...
...
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