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
37ca8449
Unverified
Commit
37ca8449
authored
Aug 18, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-challenger: Add --game-factory-address CLI option.
Actual config value isn't actually used yet.
parent
dcca3a7d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
99 additions
and
43 deletions
+99
-43
main_test.go
op-challenger/cmd/main_test.go
+23
-6
config.go
op-challenger/config/config.go
+7
-6
config_test.go
op-challenger/config/config_test.go
+10
-4
executor_test.go
op-challenger/fault/cannon/executor_test.go
+1
-1
flags.go
op-challenger/flags/flags.go
+17
-2
charlie.sh
op-challenger/scripts/alphabet/charlie.sh
+3
-0
mallory.sh
op-challenger/scripts/alphabet/mallory.sh
+3
-0
alphabet_helper.go
op-e2e/e2eutils/disputegame/alphabet_helper.go
+1
-0
cannon_helper.go
op-e2e/e2eutils/disputegame/cannon_helper.go
+11
-3
game_helper.go
op-e2e/e2eutils/disputegame/game_helper.go
+7
-6
helper.go
op-e2e/e2eutils/disputegame/helper.go
+16
-15
No files found.
op-challenger/cmd/main_test.go
View file @
37ca8449
...
@@ -15,7 +15,7 @@ import (
...
@@ -15,7 +15,7 @@ import (
var
(
var
(
l1EthRpc
=
"http://example.com:8545"
l1EthRpc
=
"http://example.com:8545"
game
AddressValue
=
"0xaa
00000000000000000000000000000000000000"
game
FactoryAddressValue
=
"0xbb
00000000000000000000000000000000000000"
cannonNetwork
=
chaincfg
.
AvailableNetworks
()[
0
]
cannonNetwork
=
chaincfg
.
AvailableNetworks
()[
0
]
otherCannonNetwork
=
chaincfg
.
AvailableNetworks
()[
1
]
otherCannonNetwork
=
chaincfg
.
AvailableNetworks
()[
1
]
cannonBin
=
"./bin/cannon"
cannonBin
=
"./bin/cannon"
...
@@ -44,14 +44,14 @@ func TestLogLevel(t *testing.T) {
...
@@ -44,14 +44,14 @@ func TestLogLevel(t *testing.T) {
func
TestDefaultCLIOptionsMatchDefaultConfig
(
t
*
testing
.
T
)
{
func
TestDefaultCLIOptionsMatchDefaultConfig
(
t
*
testing
.
T
)
{
cfg
:=
configForArgs
(
t
,
addRequiredArgs
(
config
.
TraceTypeAlphabet
))
cfg
:=
configForArgs
(
t
,
addRequiredArgs
(
config
.
TraceTypeAlphabet
))
defaultCfg
:=
config
.
NewConfig
(
l1EthRpc
,
common
.
HexToAddress
(
gameAddressValue
)
,
config
.
TraceTypeAlphabet
,
true
)
defaultCfg
:=
config
.
NewConfig
(
common
.
HexToAddress
(
gameFactoryAddressValue
),
l1EthRpc
,
config
.
TraceTypeAlphabet
,
true
)
// Add in the extra CLI options required when using alphabet trace type
// Add in the extra CLI options required when using alphabet trace type
defaultCfg
.
AlphabetTrace
=
alphabetTrace
defaultCfg
.
AlphabetTrace
=
alphabetTrace
require
.
Equal
(
t
,
defaultCfg
,
cfg
)
require
.
Equal
(
t
,
defaultCfg
,
cfg
)
}
}
func
TestDefaultConfigIsValid
(
t
*
testing
.
T
)
{
func
TestDefaultConfigIsValid
(
t
*
testing
.
T
)
{
cfg
:=
config
.
NewConfig
(
l1EthRpc
,
common
.
HexToAddress
(
gameAddressValue
)
,
config
.
TraceTypeAlphabet
,
true
)
cfg
:=
config
.
NewConfig
(
common
.
HexToAddress
(
gameFactoryAddressValue
),
l1EthRpc
,
config
.
TraceTypeAlphabet
,
true
)
// Add in options that are required based on the specific trace type
// Add in options that are required based on the specific trace type
// To avoid needing to specify unused options, these aren't included in the params for NewConfig
// To avoid needing to specify unused options, these aren't included in the params for NewConfig
cfg
.
AlphabetTrace
=
alphabetTrace
cfg
.
AlphabetTrace
=
alphabetTrace
...
@@ -89,9 +89,26 @@ func TestTraceType(t *testing.T) {
...
@@ -89,9 +89,26 @@ func TestTraceType(t *testing.T) {
})
})
}
}
func
TestGameAddress
(
t
*
testing
.
T
)
{
func
TestGame
Factory
Address
(
t
*
testing
.
T
)
{
t
.
Run
(
"Required"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"Required"
,
func
(
t
*
testing
.
T
)
{
verifyArgsInvalid
(
t
,
"flag game-address is required"
,
addRequiredArgsExcept
(
config
.
TraceTypeAlphabet
,
"--game-address"
))
verifyArgsInvalid
(
t
,
"flag game-factory-address is required"
,
addRequiredArgsExcept
(
config
.
TraceTypeAlphabet
,
"--game-factory-address"
))
})
t
.
Run
(
"Valid"
,
func
(
t
*
testing
.
T
)
{
addr
:=
common
.
Address
{
0xbb
,
0xcc
,
0xdd
}
cfg
:=
configForArgs
(
t
,
addRequiredArgsExcept
(
config
.
TraceTypeAlphabet
,
"--game-factory-address"
,
"--game-factory-address="
+
addr
.
Hex
()))
require
.
Equal
(
t
,
addr
,
cfg
.
GameFactoryAddress
)
})
t
.
Run
(
"Invalid"
,
func
(
t
*
testing
.
T
)
{
verifyArgsInvalid
(
t
,
"invalid address: foo"
,
addRequiredArgsExcept
(
config
.
TraceTypeAlphabet
,
"--game-factory-address"
,
"--game-factory-address=foo"
))
})
}
func
TestGameAddress
(
t
*
testing
.
T
)
{
t
.
Run
(
"Optional"
,
func
(
t
*
testing
.
T
)
{
cfg
:=
configForArgs
(
t
,
addRequiredArgsExcept
(
config
.
TraceTypeAlphabet
,
"--game-address"
))
require
.
NoError
(
t
,
cfg
.
Check
())
})
})
t
.
Run
(
"Valid"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"Valid"
,
func
(
t
*
testing
.
T
)
{
...
@@ -316,7 +333,7 @@ func requiredArgs(traceType config.TraceType) map[string]string {
...
@@ -316,7 +333,7 @@ func requiredArgs(traceType config.TraceType) map[string]string {
args
:=
map
[
string
]
string
{
args
:=
map
[
string
]
string
{
"--agree-with-proposed-output"
:
agreeWithProposedOutput
,
"--agree-with-proposed-output"
:
agreeWithProposedOutput
,
"--l1-eth-rpc"
:
l1EthRpc
,
"--l1-eth-rpc"
:
l1EthRpc
,
"--game-
address"
:
game
AddressValue
,
"--game-
factory-address"
:
gameFactory
AddressValue
,
"--trace-type"
:
traceType
.
String
(),
"--trace-type"
:
traceType
.
String
(),
}
}
switch
traceType
{
switch
traceType
{
...
...
op-challenger/config/config.go
View file @
37ca8449
...
@@ -18,7 +18,7 @@ var (
...
@@ -18,7 +18,7 @@ var (
ErrMissingCannonAbsolutePreState
=
errors
.
New
(
"missing cannon absolute pre-state"
)
ErrMissingCannonAbsolutePreState
=
errors
.
New
(
"missing cannon absolute pre-state"
)
ErrMissingAlphabetTrace
=
errors
.
New
(
"missing alphabet trace"
)
ErrMissingAlphabetTrace
=
errors
.
New
(
"missing alphabet trace"
)
ErrMissingL1EthRPC
=
errors
.
New
(
"missing l1 eth rpc url"
)
ErrMissingL1EthRPC
=
errors
.
New
(
"missing l1 eth rpc url"
)
ErrMissingGame
Address
=
errors
.
New
(
"missing game
address"
)
ErrMissingGame
FactoryAddress
=
errors
.
New
(
"missing game factory
address"
)
ErrMissingCannonSnapshotFreq
=
errors
.
New
(
"missing cannon snapshot freq"
)
ErrMissingCannonSnapshotFreq
=
errors
.
New
(
"missing cannon snapshot 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"
)
...
@@ -65,6 +65,7 @@ const DefaultCannonSnapshotFreq = uint(1_000_000_000)
...
@@ -65,6 +65,7 @@ const DefaultCannonSnapshotFreq = uint(1_000_000_000)
// It is used to initialize the challenger.
// It is used to initialize the challenger.
type
Config
struct
{
type
Config
struct
{
L1EthRpc
string
// L1 RPC Url
L1EthRpc
string
// L1 RPC Url
GameFactoryAddress
common
.
Address
// Address of the dispute game factory
GameAddress
common
.
Address
// Address of the fault game
GameAddress
common
.
Address
// Address of the fault game
AgreeWithProposedOutput
bool
// Temporary config if we agree or disagree with the posted output
AgreeWithProposedOutput
bool
// Temporary config if we agree or disagree with the posted output
...
@@ -88,14 +89,14 @@ type Config struct {
...
@@ -88,14 +89,14 @@ type Config struct {
}
}
func
NewConfig
(
func
NewConfig
(
gameFactoryAddress
common
.
Address
,
l1EthRpc
string
,
l1EthRpc
string
,
gameAddress
common
.
Address
,
traceType
TraceType
,
traceType
TraceType
,
agreeWithProposedOutput
bool
,
agreeWithProposedOutput
bool
,
)
Config
{
)
Config
{
return
Config
{
return
Config
{
L1EthRpc
:
l1EthRpc
,
L1EthRpc
:
l1EthRpc
,
Game
Address
:
game
Address
,
Game
FactoryAddress
:
gameFactory
Address
,
AgreeWithProposedOutput
:
agreeWithProposedOutput
,
AgreeWithProposedOutput
:
agreeWithProposedOutput
,
...
@@ -111,8 +112,8 @@ func (c Config) Check() error {
...
@@ -111,8 +112,8 @@ func (c Config) Check() error {
if
c
.
L1EthRpc
==
""
{
if
c
.
L1EthRpc
==
""
{
return
ErrMissingL1EthRPC
return
ErrMissingL1EthRPC
}
}
if
c
.
GameAddress
==
(
common
.
Address
{})
{
if
c
.
Game
Factory
Address
==
(
common
.
Address
{})
{
return
ErrMissingGameAddress
return
ErrMissingGame
Factory
Address
}
}
if
c
.
TraceType
==
""
{
if
c
.
TraceType
==
""
{
return
ErrMissingTraceType
return
ErrMissingTraceType
...
...
op-challenger/config/config_test.go
View file @
37ca8449
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
var
(
var
(
validL1EthRpc
=
"http://localhost:8545"
validL1EthRpc
=
"http://localhost:8545"
validGame
Address
=
common
.
HexToAddress
(
"0x7bdd3b028C4796eF0EAf07d11394d0d9d8c24139"
)
validGame
FactoryAddress
=
common
.
Address
{
0x23
}
validAlphabetTrace
=
"abcdefgh"
validAlphabetTrace
=
"abcdefgh"
validCannonBin
=
"./bin/cannon"
validCannonBin
=
"./bin/cannon"
validCannonOpProgramBin
=
"./bin/op-program"
validCannonOpProgramBin
=
"./bin/op-program"
...
@@ -22,7 +22,7 @@ var (
...
@@ -22,7 +22,7 @@ var (
)
)
func
validConfig
(
traceType
TraceType
)
Config
{
func
validConfig
(
traceType
TraceType
)
Config
{
cfg
:=
NewConfig
(
valid
L1EthRpc
,
validGameAddress
,
traceType
,
agreeWithProposedOutput
)
cfg
:=
NewConfig
(
valid
GameFactoryAddress
,
validL1EthRpc
,
traceType
,
agreeWithProposedOutput
)
switch
traceType
{
switch
traceType
{
case
TraceTypeAlphabet
:
case
TraceTypeAlphabet
:
cfg
.
AlphabetTrace
=
validAlphabetTrace
cfg
.
AlphabetTrace
=
validAlphabetTrace
...
@@ -62,10 +62,16 @@ func TestL1EthRpcRequired(t *testing.T) {
...
@@ -62,10 +62,16 @@ func TestL1EthRpcRequired(t *testing.T) {
require
.
ErrorIs
(
t
,
config
.
Check
(),
ErrMissingL1EthRPC
)
require
.
ErrorIs
(
t
,
config
.
Check
(),
ErrMissingL1EthRPC
)
}
}
func
TestGameAddressRequired
(
t
*
testing
.
T
)
{
func
TestGameFactoryAddressRequired
(
t
*
testing
.
T
)
{
config
:=
validConfig
(
TraceTypeCannon
)
config
.
GameFactoryAddress
=
common
.
Address
{}
require
.
ErrorIs
(
t
,
config
.
Check
(),
ErrMissingGameFactoryAddress
)
}
func
TestGameAddressNotRequired
(
t
*
testing
.
T
)
{
config
:=
validConfig
(
TraceTypeCannon
)
config
:=
validConfig
(
TraceTypeCannon
)
config
.
GameAddress
=
common
.
Address
{}
config
.
GameAddress
=
common
.
Address
{}
require
.
ErrorIs
(
t
,
config
.
Check
(),
ErrMissingGameAddress
)
require
.
NoError
(
t
,
config
.
Check
()
)
}
}
func
TestAlphabetTraceRequired
(
t
*
testing
.
T
)
{
func
TestAlphabetTraceRequired
(
t
*
testing
.
T
)
{
...
...
op-challenger/fault/cannon/executor_test.go
View file @
37ca8449
...
@@ -21,7 +21,7 @@ const execTestCannonPrestate = "/foo/pre.json"
...
@@ -21,7 +21,7 @@ const execTestCannonPrestate = "/foo/pre.json"
func
TestGenerateProof
(
t
*
testing
.
T
)
{
func
TestGenerateProof
(
t
*
testing
.
T
)
{
input
:=
"starting.json"
input
:=
"starting.json"
cfg
:=
config
.
NewConfig
(
"http://localhost:8888"
,
common
.
Address
{
0xaa
}
,
config
.
TraceTypeCannon
,
true
)
cfg
:=
config
.
NewConfig
(
common
.
Address
{
0xbb
},
"http://localhost:8888"
,
config
.
TraceTypeCannon
,
true
)
cfg
.
CannonDatadir
=
t
.
TempDir
()
cfg
.
CannonDatadir
=
t
.
TempDir
()
cfg
.
CannonAbsolutePreState
=
"pre.json"
cfg
.
CannonAbsolutePreState
=
"pre.json"
cfg
.
CannonBin
=
"./bin/cannon"
cfg
.
CannonBin
=
"./bin/cannon"
...
...
op-challenger/flags/flags.go
View file @
37ca8449
...
@@ -10,6 +10,7 @@ import (
...
@@ -10,6 +10,7 @@ import (
openum
"github.com/ethereum-optimism/optimism/op-service/enum"
openum
"github.com/ethereum-optimism/optimism/op-service/enum"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum/go-ethereum/common"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
)
)
...
@@ -29,6 +30,11 @@ var (
...
@@ -29,6 +30,11 @@ var (
Usage
:
"HTTP provider URL for L1."
,
Usage
:
"HTTP provider URL for L1."
,
EnvVars
:
prefixEnvVars
(
"L1_ETH_RPC"
),
EnvVars
:
prefixEnvVars
(
"L1_ETH_RPC"
),
}
}
FactoryAddressFlag
=
&
cli
.
StringFlag
{
Name
:
"game-factory-address"
,
Usage
:
"Address of the fault game factory contract."
,
EnvVars
:
prefixEnvVars
(
"GAME_FACTORY_ADDRESS"
),
}
DGFAddressFlag
=
&
cli
.
StringFlag
{
DGFAddressFlag
=
&
cli
.
StringFlag
{
Name
:
"game-address"
,
Name
:
"game-address"
,
Usage
:
"Address of the Fault Game contract."
,
Usage
:
"Address of the Fault Game contract."
,
...
@@ -105,7 +111,7 @@ var (
...
@@ -105,7 +111,7 @@ var (
// requiredFlags are checked by [CheckRequired]
// requiredFlags are checked by [CheckRequired]
var
requiredFlags
=
[]
cli
.
Flag
{
var
requiredFlags
=
[]
cli
.
Flag
{
L1EthRpcFlag
,
L1EthRpcFlag
,
DGF
AddressFlag
,
Factory
AddressFlag
,
TraceTypeFlag
,
TraceTypeFlag
,
AgreeWithProposedOutputFlag
,
AgreeWithProposedOutputFlag
,
}
}
...
@@ -113,6 +119,7 @@ var requiredFlags = []cli.Flag{
...
@@ -113,6 +119,7 @@ var requiredFlags = []cli.Flag{
// optionalFlags is a list of unchecked cli flags
// optionalFlags is a list of unchecked cli flags
var
optionalFlags
=
[]
cli
.
Flag
{
var
optionalFlags
=
[]
cli
.
Flag
{
AlphabetFlag
,
AlphabetFlag
,
DGFAddressFlag
,
CannonNetworkFlag
,
CannonNetworkFlag
,
CannonRollupConfigFlag
,
CannonRollupConfigFlag
,
CannonL2GenesisFlag
,
CannonL2GenesisFlag
,
...
@@ -181,10 +188,17 @@ func NewConfigFromCLI(ctx *cli.Context) (*config.Config, error) {
...
@@ -181,10 +188,17 @@ func NewConfigFromCLI(ctx *cli.Context) (*config.Config, error) {
if
err
:=
CheckRequired
(
ctx
);
err
!=
nil
{
if
err
:=
CheckRequired
(
ctx
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
dgfAddress
,
err
:=
opservice
.
ParseAddress
(
ctx
.
String
(
DGF
AddressFlag
.
Name
))
gameFactoryAddress
,
err
:=
opservice
.
ParseAddress
(
ctx
.
String
(
Factory
AddressFlag
.
Name
))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
var
dgfAddress
common
.
Address
if
ctx
.
IsSet
(
DGFAddressFlag
.
Name
)
{
dgfAddress
,
err
=
opservice
.
ParseAddress
(
ctx
.
String
(
DGFAddressFlag
.
Name
))
if
err
!=
nil
{
return
nil
,
err
}
}
txMgrConfig
:=
txmgr
.
ReadCLIConfig
(
ctx
)
txMgrConfig
:=
txmgr
.
ReadCLIConfig
(
ctx
)
...
@@ -194,6 +208,7 @@ func NewConfigFromCLI(ctx *cli.Context) (*config.Config, error) {
...
@@ -194,6 +208,7 @@ func NewConfigFromCLI(ctx *cli.Context) (*config.Config, error) {
// Required Flags
// Required Flags
L1EthRpc
:
ctx
.
String
(
L1EthRpcFlag
.
Name
),
L1EthRpc
:
ctx
.
String
(
L1EthRpcFlag
.
Name
),
TraceType
:
traceTypeFlag
,
TraceType
:
traceTypeFlag
,
GameFactoryAddress
:
gameFactoryAddress
,
GameAddress
:
dgfAddress
,
GameAddress
:
dgfAddress
,
AlphabetTrace
:
ctx
.
String
(
AlphabetFlag
.
Name
),
AlphabetTrace
:
ctx
.
String
(
AlphabetFlag
.
Name
),
CannonNetwork
:
ctx
.
String
(
CannonNetworkFlag
.
Name
),
CannonNetwork
:
ctx
.
String
(
CannonNetworkFlag
.
Name
),
...
...
op-challenger/scripts/alphabet/charlie.sh
View file @
37ca8449
...
@@ -3,6 +3,7 @@ set -euo pipefail
...
@@ -3,6 +3,7 @@ set -euo pipefail
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
CHALLENGER_DIR
=
$(
echo
${
SOURCE_DIR
%/*/*
}
)
CHALLENGER_DIR
=
$(
echo
${
SOURCE_DIR
%/*/*
}
)
MONOREPO_DIR
=
$(
echo
${
SOURCE_DIR
%/*/*/*
}
)
# Check that the fault game address file exists
# Check that the fault game address file exists
FAULT_GAME_ADDR_FILE
=
"
$CHALLENGER_DIR
/.fault-game-address"
FAULT_GAME_ADDR_FILE
=
"
$CHALLENGER_DIR
/.fault-game-address"
...
@@ -14,6 +15,7 @@ fi
...
@@ -14,6 +15,7 @@ fi
# Charlie's Address: 0xF45B7537828CB2fffBC69996B054c2Aaf36DC778
# Charlie's Address: 0xF45B7537828CB2fffBC69996B054c2Aaf36DC778
CHARLIE_KEY
=
"74feb147d72bfae943e6b4e483410933d9e447d5dc47d52432dcc2c1454dabb7"
CHARLIE_KEY
=
"74feb147d72bfae943e6b4e483410933d9e447d5dc47d52432dcc2c1454dabb7"
DISPUTE_GAME_PROXY
=
$(
jq
-r
.DisputeGameFactoryProxy
$MONOREPO_DIR
/.devnet/addresses.json
)
FAULT_GAME_ADDRESS
=
$(
cat
$FAULT_GAME_ADDR_FILE
)
FAULT_GAME_ADDRESS
=
$(
cat
$FAULT_GAME_ADDR_FILE
)
echo
"Fault dispute game address:
$FAULT_GAME_ADDRESS
"
echo
"Fault dispute game address:
$FAULT_GAME_ADDRESS
"
...
@@ -21,6 +23,7 @@ $CHALLENGER_DIR/bin/op-challenger \
...
@@ -21,6 +23,7 @@ $CHALLENGER_DIR/bin/op-challenger \
--l1-eth-rpc
http://localhost:8545
\
--l1-eth-rpc
http://localhost:8545
\
--trace-type
=
"alphabet"
\
--trace-type
=
"alphabet"
\
--alphabet
"abcdefgh"
\
--alphabet
"abcdefgh"
\
--game-factory-address
$DISPUTE_GAME_PROXY
\
--game-address
$FAULT_GAME_ADDRESS
\
--game-address
$FAULT_GAME_ADDRESS
\
--private-key
$CHARLIE_KEY
\
--private-key
$CHARLIE_KEY
\
--num-confirmations
1
\
--num-confirmations
1
\
...
...
op-challenger/scripts/alphabet/mallory.sh
View file @
37ca8449
...
@@ -3,6 +3,7 @@ set -euo pipefail
...
@@ -3,6 +3,7 @@ set -euo pipefail
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
CHALLENGER_DIR
=
$(
echo
${
SOURCE_DIR
%/*/*
}
)
CHALLENGER_DIR
=
$(
echo
${
SOURCE_DIR
%/*/*
}
)
MONOREPO_DIR
=
$(
echo
${
SOURCE_DIR
%/*/*/*
}
)
# Check that the fault game address file exists
# Check that the fault game address file exists
FAULT_GAME_ADDR_FILE
=
"
$CHALLENGER_DIR
/.fault-game-address"
FAULT_GAME_ADDR_FILE
=
"
$CHALLENGER_DIR
/.fault-game-address"
...
@@ -14,6 +15,7 @@ fi
...
@@ -14,6 +15,7 @@ fi
# Mallory's Address: 0x4641c704a6c743f73ee1f36C7568Fbf4b80681e4
# Mallory's Address: 0x4641c704a6c743f73ee1f36C7568Fbf4b80681e4
MALLORY_KEY
=
"28d7045146193f5f4eeb151c4843544b1b0d30a7ac1680c845a416fac65a7715"
MALLORY_KEY
=
"28d7045146193f5f4eeb151c4843544b1b0d30a7ac1680c845a416fac65a7715"
DISPUTE_GAME_PROXY
=
$(
jq
-r
.DisputeGameFactoryProxy
$MONOREPO_DIR
/.devnet/addresses.json
)
FAULT_GAME_ADDRESS
=
$(
cat
$FAULT_GAME_ADDR_FILE
)
FAULT_GAME_ADDRESS
=
$(
cat
$FAULT_GAME_ADDR_FILE
)
echo
"Fault dispute game address:
$FAULT_GAME_ADDRESS
"
echo
"Fault dispute game address:
$FAULT_GAME_ADDRESS
"
...
@@ -21,6 +23,7 @@ $CHALLENGER_DIR/bin/op-challenger \
...
@@ -21,6 +23,7 @@ $CHALLENGER_DIR/bin/op-challenger \
--l1-eth-rpc
http://localhost:8545
\
--l1-eth-rpc
http://localhost:8545
\
--trace-type
=
"alphabet"
\
--trace-type
=
"alphabet"
\
--alphabet
"abcdexyz"
\
--alphabet
"abcdexyz"
\
--game-factory-address
$DISPUTE_GAME_PROXY
\
--game-address
$FAULT_GAME_ADDRESS
\
--game-address
$FAULT_GAME_ADDRESS
\
--private-key
$MALLORY_KEY
\
--private-key
$MALLORY_KEY
\
--num-confirmations
1
\
--num-confirmations
1
\
...
...
op-e2e/e2eutils/disputegame/alphabet_helper.go
View file @
37ca8449
...
@@ -15,6 +15,7 @@ type AlphabetGameHelper struct {
...
@@ -15,6 +15,7 @@ type AlphabetGameHelper struct {
func
(
g
*
AlphabetGameHelper
)
StartChallenger
(
ctx
context
.
Context
,
l1Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
func
(
g
*
AlphabetGameHelper
)
StartChallenger
(
ctx
context
.
Context
,
l1Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
opts
:=
[]
challenger
.
Option
{
opts
:=
[]
challenger
.
Option
{
func
(
c
*
config
.
Config
)
{
func
(
c
*
config
.
Config
)
{
c
.
GameFactoryAddress
=
g
.
factoryAddr
c
.
GameAddress
=
g
.
addr
c
.
GameAddress
=
g
.
addr
c
.
TraceType
=
config
.
TraceTypeAlphabet
c
.
TraceType
=
config
.
TraceTypeAlphabet
// By default the challenger agrees with the root claim (thus disagrees with the proposed output)
// By default the challenger agrees with the root claim (thus disagrees with the proposed output)
...
...
op-e2e/e2eutils/disputegame/cannon_helper.go
View file @
37ca8449
...
@@ -24,7 +24,7 @@ type CannonGameHelper struct {
...
@@ -24,7 +24,7 @@ type CannonGameHelper struct {
}
}
func
(
g
*
CannonGameHelper
)
StartChallenger
(
ctx
context
.
Context
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
l1Endpoint
string
,
l2Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
func
(
g
*
CannonGameHelper
)
StartChallenger
(
ctx
context
.
Context
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
l1Endpoint
string
,
l2Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
opts
:=
[]
challenger
.
Option
{
createConfigOption
(
g
.
t
,
rollupCfg
,
l2Genesis
,
g
.
addr
,
l2Endpoint
)}
opts
:=
[]
challenger
.
Option
{
createConfigOption
(
g
.
t
,
rollupCfg
,
l2Genesis
,
g
.
factoryAddr
,
g
.
addr
,
l2Endpoint
)}
opts
=
append
(
opts
,
options
...
)
opts
=
append
(
opts
,
options
...
)
c
:=
challenger
.
NewChallenger
(
g
.
t
,
ctx
,
l1Endpoint
,
name
,
opts
...
)
c
:=
challenger
.
NewChallenger
(
g
.
t
,
ctx
,
l1Endpoint
,
name
,
opts
...
)
g
.
t
.
Cleanup
(
func
()
{
g
.
t
.
Cleanup
(
func
()
{
...
@@ -34,7 +34,7 @@ func (g *CannonGameHelper) StartChallenger(ctx context.Context, rollupCfg *rollu
...
@@ -34,7 +34,7 @@ func (g *CannonGameHelper) StartChallenger(ctx context.Context, rollupCfg *rollu
}
}
func
(
g
*
CannonGameHelper
)
CreateHonestActor
(
ctx
context
.
Context
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
l1Client
bind
.
ContractCaller
,
l1Endpoint
string
,
l2Endpoint
string
,
options
...
challenger
.
Option
)
*
HonestHelper
{
func
(
g
*
CannonGameHelper
)
CreateHonestActor
(
ctx
context
.
Context
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
l1Client
bind
.
ContractCaller
,
l1Endpoint
string
,
l2Endpoint
string
,
options
...
challenger
.
Option
)
*
HonestHelper
{
opts
:=
[]
challenger
.
Option
{
createConfigOption
(
g
.
t
,
rollupCfg
,
l2Genesis
,
g
.
addr
,
l2Endpoint
)}
opts
:=
[]
challenger
.
Option
{
createConfigOption
(
g
.
t
,
rollupCfg
,
l2Genesis
,
g
.
factoryAddr
,
g
.
addr
,
l2Endpoint
)}
opts
=
append
(
opts
,
options
...
)
opts
=
append
(
opts
,
options
...
)
cfg
:=
challenger
.
NewChallengerConfig
(
g
.
t
,
l1Endpoint
,
opts
...
)
cfg
:=
challenger
.
NewChallengerConfig
(
g
.
t
,
l1Endpoint
,
opts
...
)
provider
,
err
:=
cannon
.
NewTraceProvider
(
ctx
,
testlog
.
Logger
(
g
.
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"CorrectTrace"
),
cfg
,
l1Client
)
provider
,
err
:=
cannon
.
NewTraceProvider
(
ctx
,
testlog
.
Logger
(
g
.
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"CorrectTrace"
),
cfg
,
l1Client
)
...
@@ -48,9 +48,17 @@ func (g *CannonGameHelper) CreateHonestActor(ctx context.Context, rollupCfg *rol
...
@@ -48,9 +48,17 @@ func (g *CannonGameHelper) CreateHonestActor(ctx context.Context, rollupCfg *rol
}
}
}
}
func
createConfigOption
(
t
*
testing
.
T
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
gameAddr
common
.
Address
,
l2Endpoint
string
)
challenger
.
Option
{
func
createConfigOption
(
t
*
testing
.
T
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
factoryAddr
common
.
Address
,
gameAddr
common
.
Address
,
l2Endpoint
string
,
)
challenger
.
Option
{
return
func
(
c
*
config
.
Config
)
{
return
func
(
c
*
config
.
Config
)
{
require
:=
require
.
New
(
t
)
require
:=
require
.
New
(
t
)
c
.
GameFactoryAddress
=
factoryAddr
c
.
GameAddress
=
gameAddr
c
.
GameAddress
=
gameAddr
c
.
TraceType
=
config
.
TraceTypeCannon
c
.
TraceType
=
config
.
TraceTypeCannon
c
.
AgreeWithProposedOutput
=
false
c
.
AgreeWithProposedOutput
=
false
...
...
op-e2e/e2eutils/disputegame/game_helper.go
View file @
37ca8449
...
@@ -17,12 +17,13 @@ import (
...
@@ -17,12 +17,13 @@ import (
)
)
type
FaultGameHelper
struct
{
type
FaultGameHelper
struct
{
t
*
testing
.
T
t
*
testing
.
T
require
*
require
.
Assertions
require
*
require
.
Assertions
client
*
ethclient
.
Client
client
*
ethclient
.
Client
opts
*
bind
.
TransactOpts
opts
*
bind
.
TransactOpts
game
*
bindings
.
FaultDisputeGame
game
*
bindings
.
FaultDisputeGame
addr
common
.
Address
factoryAddr
common
.
Address
addr
common
.
Address
}
}
func
(
g
*
FaultGameHelper
)
GameDuration
(
ctx
context
.
Context
)
time
.
Duration
{
func
(
g
*
FaultGameHelper
)
GameDuration
(
ctx
context
.
Context
)
time
.
Duration
{
...
...
op-e2e/e2eutils/disputegame/helper.go
View file @
37ca8449
...
@@ -119,12 +119,13 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
...
@@ -119,12 +119,13 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
return
&
AlphabetGameHelper
{
return
&
AlphabetGameHelper
{
FaultGameHelper
:
FaultGameHelper
{
FaultGameHelper
:
FaultGameHelper
{
t
:
h
.
t
,
t
:
h
.
t
,
require
:
h
.
require
,
require
:
h
.
require
,
client
:
h
.
client
,
client
:
h
.
client
,
opts
:
h
.
opts
,
opts
:
h
.
opts
,
game
:
game
,
game
:
game
,
addr
:
createdEvent
.
DisputeProxy
,
factoryAddr
:
h
.
factoryAddr
,
addr
:
createdEvent
.
DisputeProxy
,
},
},
claimedAlphabet
:
claimedAlphabet
,
claimedAlphabet
:
claimedAlphabet
,
}
}
...
@@ -137,7 +138,7 @@ func (h *FactoryHelper) StartCannonGame(ctx context.Context, rootClaim common.Ha
...
@@ -137,7 +138,7 @@ func (h *FactoryHelper) StartCannonGame(ctx context.Context, rootClaim common.Ha
func
(
h
*
FactoryHelper
)
StartCannonGameWithCorrectRoot
(
ctx
context
.
Context
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
l1Endpoint
string
,
l2Endpoint
string
,
options
...
challenger
.
Option
)
(
*
CannonGameHelper
,
*
HonestHelper
)
{
func
(
h
*
FactoryHelper
)
StartCannonGameWithCorrectRoot
(
ctx
context
.
Context
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
l1Endpoint
string
,
l2Endpoint
string
,
options
...
challenger
.
Option
)
(
*
CannonGameHelper
,
*
HonestHelper
)
{
l2BlockNumber
,
l1Head
:=
h
.
prepareCannonGame
(
ctx
)
l2BlockNumber
,
l1Head
:=
h
.
prepareCannonGame
(
ctx
)
challengerOpts
:=
[]
challenger
.
Option
{
createConfigOption
(
h
.
t
,
rollupCfg
,
l2Genesis
,
common
.
Address
{
0xaa
},
l2Endpoint
)}
challengerOpts
:=
[]
challenger
.
Option
{
createConfigOption
(
h
.
t
,
rollupCfg
,
l2Genesis
,
h
.
factoryAddr
,
common
.
Address
{
0xaa
},
l2Endpoint
)}
challengerOpts
=
append
(
challengerOpts
,
options
...
)
challengerOpts
=
append
(
challengerOpts
,
options
...
)
cfg
:=
challenger
.
NewChallengerConfig
(
h
.
t
,
l1Endpoint
,
challengerOpts
...
)
cfg
:=
challenger
.
NewChallengerConfig
(
h
.
t
,
l1Endpoint
,
challengerOpts
...
)
opts
:=
&
bind
.
CallOpts
{
Context
:
ctx
}
opts
:=
&
bind
.
CallOpts
{
Context
:
ctx
}
...
@@ -200,20 +201,20 @@ func (h *FactoryHelper) createCannonGame(ctx context.Context, l2BlockNumber uint
...
@@ -200,20 +201,20 @@ func (h *FactoryHelper) createCannonGame(ctx context.Context, l2BlockNumber uint
return
&
CannonGameHelper
{
return
&
CannonGameHelper
{
FaultGameHelper
:
FaultGameHelper
{
FaultGameHelper
:
FaultGameHelper
{
t
:
h
.
t
,
t
:
h
.
t
,
require
:
h
.
require
,
require
:
h
.
require
,
client
:
h
.
client
,
client
:
h
.
client
,
opts
:
h
.
opts
,
opts
:
h
.
opts
,
game
:
game
,
game
:
game
,
addr
:
createdEvent
.
DisputeProxy
,
factoryAddr
:
h
.
factoryAddr
,
addr
:
createdEvent
.
DisputeProxy
,
},
},
}
}
}
}
func
(
h
*
FactoryHelper
)
StartChallenger
(
ctx
context
.
Context
,
l1Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
func
(
h
*
FactoryHelper
)
StartChallenger
(
ctx
context
.
Context
,
l1Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
opts
:=
[]
challenger
.
Option
{
opts
:=
[]
challenger
.
Option
{
func
(
c
*
config
.
Config
)
{
func
(
c
*
config
.
Config
)
{
// Uncomment when challenger actually supports setting the game factory address
c
.
GameFactoryAddress
=
h
.
factoryAddr
//c.FactoryAddress = h.factoryAddr
c
.
TraceType
=
config
.
TraceTypeAlphabet
c
.
TraceType
=
config
.
TraceTypeAlphabet
},
},
}
}
...
...
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