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
9672f1d9
Unverified
Commit
9672f1d9
authored
Sep 19, 2023
by
OptimismBot
Committed by
GitHub
Sep 19, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7274 from ethereum-optimism/refcell/l2-consensus
feat(op-challenger): Rollup RPC Challenger Flag
parents
2961cf94
177dfd7d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
2 deletions
+57
-2
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
+15
-2
No files found.
op-challenger/cmd/main_test.go
View file @
9672f1d9
...
...
@@ -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 @
9672f1d9
...
...
@@ -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 @
9672f1d9
...
...
@@ -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 @
9672f1d9
...
...
@@ -76,6 +76,11 @@ var (
EnvVars
:
prefixEnvVars
(
"HTTP_POLL_INTERVAL"
),
Value
:
config
.
DefaultPollInterval
,
}
RollupRpcFlag
=
&
cli
.
StringFlag
{
Name
:
"rollup-rpc"
,
Usage
:
"HTTP provider URL for the rollup node"
,
EnvVars
:
prefixEnvVars
(
"ROLLUP_RPC"
),
}
AlphabetFlag
=
&
cli
.
StringFlag
{
Name
:
"alphabet"
,
Usage
:
"Correct Alphabet Trace (alphabet trace type only)"
,
...
...
@@ -83,7 +88,10 @@ var (
}
CannonNetworkFlag
=
&
cli
.
StringFlag
{
Name
:
"cannon-network"
,
Usage
:
fmt
.
Sprintf
(
"Predefined network selection. Available networks: %s (cannon trace type only)"
,
strings
.
Join
(
chaincfg
.
AvailableNetworks
(),
", "
)),
Usage
:
fmt
.
Sprintf
(
"Predefined network selection. Available networks: %s (cannon trace type only)"
,
strings
.
Join
(
chaincfg
.
AvailableNetworks
(),
", "
),
),
EnvVars
:
prefixEnvVars
(
"CANNON_NETWORK"
),
}
CannonRollupConfigFlag
=
&
cli
.
StringFlag
{
...
...
@@ -149,6 +157,7 @@ var requiredFlags = []cli.Flag{
var
optionalFlags
=
[]
cli
.
Flag
{
MaxConcurrencyFlag
,
HTTPPollInterval
,
RollupRpcFlag
,
AlphabetFlag
,
GameAllowlistFlag
,
CannonNetworkFlag
,
...
...
@@ -221,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
)
}
...
...
@@ -266,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