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
69fbf1dc
Unverified
Commit
69fbf1dc
authored
Aug 31, 2023
by
mergify[bot]
Committed by
GitHub
Aug 31, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into aj/game-scripts
parents
fa88dfd7
5593b9c3
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
1 deletion
+51
-1
batch_helpers.go
op-chain-ops/safe/batch_helpers.go
+1
-1
main_test.go
op-challenger/cmd/main_test.go
+22
-0
config.go
op-challenger/config/config.go
+7
-0
config_test.go
op-challenger/config/config_test.go
+8
-0
flags.go
op-challenger/flags/flags.go
+8
-0
executor.go
op-challenger/game/fault/trace/cannon/executor.go
+3
-0
executor_test.go
op-challenger/game/fault/trace/cannon/executor_test.go
+2
-0
No files found.
op-chain-ops/safe/batch_helpers.go
View file @
69fbf1dc
...
@@ -142,7 +142,7 @@ func createContractInput(input abi.Argument, inputs []ContractInput) ([]Contract
...
@@ -142,7 +142,7 @@ func createContractInput(input abi.Argument, inputs []ContractInput) ([]Contract
}
}
internalType
:=
input
.
Type
.
String
()
internalType
:=
input
.
Type
.
String
()
if
input
Type
==
"tuple"
{
if
input
.
Type
.
T
==
abi
.
TupleTy
{
internalType
=
input
.
Type
.
TupleRawName
internalType
=
input
.
Type
.
TupleRawName
}
}
...
...
op-challenger/cmd/main_test.go
View file @
69fbf1dc
...
@@ -254,6 +254,28 @@ func TestCannonSnapshotFreq(t *testing.T) {
...
@@ -254,6 +254,28 @@ func TestCannonSnapshotFreq(t *testing.T) {
cfg
:=
configForArgs
(
t
,
addRequiredArgs
(
config
.
TraceTypeCannon
,
"--cannon-snapshot-freq=1234"
))
cfg
:=
configForArgs
(
t
,
addRequiredArgs
(
config
.
TraceTypeCannon
,
"--cannon-snapshot-freq=1234"
))
require
.
Equal
(
t
,
uint
(
1234
),
cfg
.
CannonSnapshotFreq
)
require
.
Equal
(
t
,
uint
(
1234
),
cfg
.
CannonSnapshotFreq
)
})
})
t
.
Run
(
"Invalid"
,
func
(
t
*
testing
.
T
)
{
verifyArgsInvalid
(
t
,
"invalid value
\"
abc
\"
for flag -cannon-snapshot-freq"
,
addRequiredArgs
(
config
.
TraceTypeCannon
,
"--cannon-snapshot-freq=abc"
))
})
}
func
TestCannonInfoFreq
(
t
*
testing
.
T
)
{
t
.
Run
(
"UsesDefault"
,
func
(
t
*
testing
.
T
)
{
cfg
:=
configForArgs
(
t
,
addRequiredArgs
(
config
.
TraceTypeCannon
))
require
.
Equal
(
t
,
config
.
DefaultCannonInfoFreq
,
cfg
.
CannonInfoFreq
)
})
t
.
Run
(
"Valid"
,
func
(
t
*
testing
.
T
)
{
cfg
:=
configForArgs
(
t
,
addRequiredArgs
(
config
.
TraceTypeCannon
,
"--cannon-info-freq=1234"
))
require
.
Equal
(
t
,
uint
(
1234
),
cfg
.
CannonInfoFreq
)
})
t
.
Run
(
"Invalid"
,
func
(
t
*
testing
.
T
)
{
verifyArgsInvalid
(
t
,
"invalid value
\"
abc
\"
for flag -cannon-info-freq"
,
addRequiredArgs
(
config
.
TraceTypeCannon
,
"--cannon-info-freq=abc"
))
})
}
}
func
TestGameWindow
(
t
*
testing
.
T
)
{
func
TestGameWindow
(
t
*
testing
.
T
)
{
...
...
op-challenger/config/config.go
View file @
69fbf1dc
...
@@ -26,6 +26,7 @@ var (
...
@@ -26,6 +26,7 @@ var (
ErrMissingL1EthRPC
=
errors
.
New
(
"missing l1 eth rpc url"
)
ErrMissingL1EthRPC
=
errors
.
New
(
"missing l1 eth rpc url"
)
ErrMissingGameFactoryAddress
=
errors
.
New
(
"missing game factory address"
)
ErrMissingGameFactoryAddress
=
errors
.
New
(
"missing game factory address"
)
ErrMissingCannonSnapshotFreq
=
errors
.
New
(
"missing cannon snapshot freq"
)
ErrMissingCannonSnapshotFreq
=
errors
.
New
(
"missing cannon snapshot freq"
)
ErrMissingCannonInfoFreq
=
errors
.
New
(
"missing cannon info freq"
)
ErrMissingCannonRollupConfig
=
errors
.
New
(
"missing cannon network or rollup config path"
)
ErrMissingCannonRollupConfig
=
errors
.
New
(
"missing cannon network or rollup config path"
)
ErrMissingCannonL2Genesis
=
errors
.
New
(
"missing cannon network or l2 genesis path"
)
ErrMissingCannonL2Genesis
=
errors
.
New
(
"missing cannon network or l2 genesis path"
)
ErrCannonNetworkAndRollupConfig
=
errors
.
New
(
"only specify one of network or rollup config path"
)
ErrCannonNetworkAndRollupConfig
=
errors
.
New
(
"only specify one of network or rollup config path"
)
...
@@ -78,6 +79,7 @@ func ValidTraceType(value TraceType) bool {
...
@@ -78,6 +79,7 @@ func ValidTraceType(value TraceType) bool {
const
(
const
(
DefaultCannonSnapshotFreq
=
uint
(
1
_000_000_000
)
DefaultCannonSnapshotFreq
=
uint
(
1
_000_000_000
)
DefaultCannonInfoFreq
=
uint
(
10
_000_000
)
// DefaultGameWindow is the default maximum time duration in the past
// DefaultGameWindow is the default maximum time duration in the past
// that the challenger will look for games to progress.
// that the challenger will look for games to progress.
// The default value is 11 days, which is a 4 day resolution buffer
// The default value is 11 days, which is a 4 day resolution buffer
...
@@ -111,6 +113,7 @@ type Config struct {
...
@@ -111,6 +113,7 @@ type Config struct {
CannonL2GenesisPath
string
CannonL2GenesisPath
string
CannonL2
string
// L2 RPC Url
CannonL2
string
// L2 RPC Url
CannonSnapshotFreq
uint
// Frequency of snapshots to create when executing cannon (in VM instructions)
CannonSnapshotFreq
uint
// Frequency of snapshots to create when executing cannon (in VM instructions)
CannonInfoFreq
uint
// Frequency of cannon progress log messages (in VM instructions)
TxMgrConfig
txmgr
.
CLIConfig
TxMgrConfig
txmgr
.
CLIConfig
MetricsConfig
opmetrics
.
CLIConfig
MetricsConfig
opmetrics
.
CLIConfig
...
@@ -140,6 +143,7 @@ func NewConfig(
...
@@ -140,6 +143,7 @@ func NewConfig(
Datadir
:
datadir
,
Datadir
:
datadir
,
CannonSnapshotFreq
:
DefaultCannonSnapshotFreq
,
CannonSnapshotFreq
:
DefaultCannonSnapshotFreq
,
CannonInfoFreq
:
DefaultCannonInfoFreq
,
GameWindow
:
DefaultGameWindow
,
GameWindow
:
DefaultGameWindow
,
}
}
}
}
...
@@ -194,6 +198,9 @@ func (c Config) Check() error {
...
@@ -194,6 +198,9 @@ func (c Config) Check() error {
if
c
.
CannonSnapshotFreq
==
0
{
if
c
.
CannonSnapshotFreq
==
0
{
return
ErrMissingCannonSnapshotFreq
return
ErrMissingCannonSnapshotFreq
}
}
if
c
.
CannonInfoFreq
==
0
{
return
ErrMissingCannonInfoFreq
}
}
}
if
c
.
TraceType
==
TraceTypeAlphabet
&&
c
.
AlphabetTrace
==
""
{
if
c
.
TraceType
==
TraceTypeAlphabet
&&
c
.
AlphabetTrace
==
""
{
return
ErrMissingAlphabetTrace
return
ErrMissingAlphabetTrace
...
...
op-challenger/config/config_test.go
View file @
69fbf1dc
...
@@ -132,6 +132,14 @@ func TestCannonSnapshotFreq(t *testing.T) {
...
@@ -132,6 +132,14 @@ func TestCannonSnapshotFreq(t *testing.T) {
})
})
}
}
func
TestCannonInfoFreq
(
t
*
testing
.
T
)
{
t
.
Run
(
"MustNotBeZero"
,
func
(
t
*
testing
.
T
)
{
cfg
:=
validConfig
(
TraceTypeCannon
)
cfg
.
CannonInfoFreq
=
0
require
.
ErrorIs
(
t
,
cfg
.
Check
(),
ErrMissingCannonInfoFreq
)
})
}
func
TestCannonNetworkOrRollupConfigRequired
(
t
*
testing
.
T
)
{
func
TestCannonNetworkOrRollupConfigRequired
(
t
*
testing
.
T
)
{
cfg
:=
validConfig
(
TraceTypeCannon
)
cfg
:=
validConfig
(
TraceTypeCannon
)
cfg
.
CannonNetwork
=
""
cfg
.
CannonNetwork
=
""
...
...
op-challenger/flags/flags.go
View file @
69fbf1dc
...
@@ -116,6 +116,12 @@ var (
...
@@ -116,6 +116,12 @@ var (
EnvVars
:
prefixEnvVars
(
"CANNON_SNAPSHOT_FREQ"
),
EnvVars
:
prefixEnvVars
(
"CANNON_SNAPSHOT_FREQ"
),
Value
:
config
.
DefaultCannonSnapshotFreq
,
Value
:
config
.
DefaultCannonSnapshotFreq
,
}
}
CannonInfoFreqFlag
=
&
cli
.
UintFlag
{
Name
:
"cannon-info-freq"
,
Usage
:
"Frequency of cannon info log messages to generate in VM steps (cannon trace type only)"
,
EnvVars
:
prefixEnvVars
(
"CANNON_INFO_FREQ"
),
Value
:
config
.
DefaultCannonInfoFreq
,
}
GameWindowFlag
=
&
cli
.
DurationFlag
{
GameWindowFlag
=
&
cli
.
DurationFlag
{
Name
:
"game-window"
,
Name
:
"game-window"
,
Usage
:
"The time window which the challenger will look for games to progress."
,
Usage
:
"The time window which the challenger will look for games to progress."
,
...
@@ -146,6 +152,7 @@ var optionalFlags = []cli.Flag{
...
@@ -146,6 +152,7 @@ var optionalFlags = []cli.Flag{
CannonPreStateFlag
,
CannonPreStateFlag
,
CannonL2Flag
,
CannonL2Flag
,
CannonSnapshotFreqFlag
,
CannonSnapshotFreqFlag
,
CannonInfoFreqFlag
,
GameWindowFlag
,
GameWindowFlag
,
}
}
...
@@ -250,6 +257,7 @@ func NewConfigFromCLI(ctx *cli.Context) (*config.Config, error) {
...
@@ -250,6 +257,7 @@ func NewConfigFromCLI(ctx *cli.Context) (*config.Config, error) {
Datadir
:
ctx
.
String
(
DatadirFlag
.
Name
),
Datadir
:
ctx
.
String
(
DatadirFlag
.
Name
),
CannonL2
:
ctx
.
String
(
CannonL2Flag
.
Name
),
CannonL2
:
ctx
.
String
(
CannonL2Flag
.
Name
),
CannonSnapshotFreq
:
ctx
.
Uint
(
CannonSnapshotFreqFlag
.
Name
),
CannonSnapshotFreq
:
ctx
.
Uint
(
CannonSnapshotFreqFlag
.
Name
),
CannonInfoFreq
:
ctx
.
Uint
(
CannonInfoFreqFlag
.
Name
),
AgreeWithProposedOutput
:
ctx
.
Bool
(
AgreeWithProposedOutputFlag
.
Name
),
AgreeWithProposedOutput
:
ctx
.
Bool
(
AgreeWithProposedOutputFlag
.
Name
),
TxMgrConfig
:
txMgrConfig
,
TxMgrConfig
:
txMgrConfig
,
MetricsConfig
:
metricsConfig
,
MetricsConfig
:
metricsConfig
,
...
...
op-challenger/game/fault/trace/cannon/executor.go
View file @
69fbf1dc
...
@@ -40,6 +40,7 @@ type Executor struct {
...
@@ -40,6 +40,7 @@ type Executor struct {
l2Genesis
string
l2Genesis
string
absolutePreState
string
absolutePreState
string
snapshotFreq
uint
snapshotFreq
uint
infoFreq
uint
selectSnapshot
snapshotSelect
selectSnapshot
snapshotSelect
cmdExecutor
cmdExecutor
cmdExecutor
cmdExecutor
}
}
...
@@ -57,6 +58,7 @@ func NewExecutor(logger log.Logger, cfg *config.Config, inputs LocalGameInputs)
...
@@ -57,6 +58,7 @@ func NewExecutor(logger log.Logger, cfg *config.Config, inputs LocalGameInputs)
l2Genesis
:
cfg
.
CannonL2GenesisPath
,
l2Genesis
:
cfg
.
CannonL2GenesisPath
,
absolutePreState
:
cfg
.
CannonAbsolutePreState
,
absolutePreState
:
cfg
.
CannonAbsolutePreState
,
snapshotFreq
:
cfg
.
CannonSnapshotFreq
,
snapshotFreq
:
cfg
.
CannonSnapshotFreq
,
infoFreq
:
cfg
.
CannonInfoFreq
,
selectSnapshot
:
findStartingSnapshot
,
selectSnapshot
:
findStartingSnapshot
,
cmdExecutor
:
runCmd
,
cmdExecutor
:
runCmd
,
}
}
...
@@ -76,6 +78,7 @@ func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) erro
...
@@ -76,6 +78,7 @@ func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) erro
"--input"
,
start
,
"--input"
,
start
,
"--output"
,
lastGeneratedState
,
"--output"
,
lastGeneratedState
,
"--meta"
,
""
,
"--meta"
,
""
,
"--info-at"
,
"%"
+
strconv
.
FormatUint
(
uint64
(
e
.
infoFreq
),
10
),
"--proof-at"
,
"="
+
strconv
.
FormatUint
(
i
,
10
),
"--proof-at"
,
"="
+
strconv
.
FormatUint
(
i
,
10
),
"--proof-fmt"
,
filepath
.
Join
(
proofDir
,
"%d.json.gz"
),
"--proof-fmt"
,
filepath
.
Join
(
proofDir
,
"%d.json.gz"
),
"--snapshot-at"
,
"%"
+
strconv
.
FormatUint
(
uint64
(
e
.
snapshotFreq
),
10
),
"--snapshot-at"
,
"%"
+
strconv
.
FormatUint
(
uint64
(
e
.
snapshotFreq
),
10
),
...
...
op-challenger/game/fault/trace/cannon/executor_test.go
View file @
69fbf1dc
...
@@ -29,6 +29,7 @@ func TestGenerateProof(t *testing.T) {
...
@@ -29,6 +29,7 @@ func TestGenerateProof(t *testing.T) {
cfg
.
CannonServer
=
"./bin/op-program"
cfg
.
CannonServer
=
"./bin/op-program"
cfg
.
CannonL2
=
"http://localhost:9999"
cfg
.
CannonL2
=
"http://localhost:9999"
cfg
.
CannonSnapshotFreq
=
500
cfg
.
CannonSnapshotFreq
=
500
cfg
.
CannonInfoFreq
=
900
inputs
:=
LocalGameInputs
{
inputs
:=
LocalGameInputs
{
L1Head
:
common
.
Hash
{
0x11
},
L1Head
:
common
.
Hash
{
0x11
},
...
@@ -81,6 +82,7 @@ func TestGenerateProof(t *testing.T) {
...
@@ -81,6 +82,7 @@ func TestGenerateProof(t *testing.T) {
require
.
Equal
(
t
,
"=150000000"
,
args
[
"--proof-at"
])
require
.
Equal
(
t
,
"=150000000"
,
args
[
"--proof-at"
])
require
.
Equal
(
t
,
"=150000001"
,
args
[
"--stop-at"
])
require
.
Equal
(
t
,
"=150000001"
,
args
[
"--stop-at"
])
require
.
Equal
(
t
,
"%500"
,
args
[
"--snapshot-at"
])
require
.
Equal
(
t
,
"%500"
,
args
[
"--snapshot-at"
])
require
.
Equal
(
t
,
"%900"
,
args
[
"--info-at"
])
// Slight quirk of how we pair off args
// Slight quirk of how we pair off args
// The server binary winds up as the key and the first arg --server as the value which has no value
// The server binary winds up as the key and the first arg --server as the value which has no value
// Then everything else pairs off correctly again
// Then everything else pairs off correctly again
...
...
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