Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions op-challenger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ Prints the list of current claims in a dispute game.
* `ROLLUP_RPC` - the RPC endpoint of the L2 consensus client to use
* `DATA_DIR` - the directory to use to store data
* `PRESTATES_URL` - the base URL to download required prestates from
* `RUN_CONFIG` - the trace providers and prestates to run. e.g. `cannon,asterisc-kona/kona-0.1.0-alpha.5/0x03c50fbef46a05f93ea7665fa89015c2108e10c1b4501799c0663774bd35a9c5`
* `RUN_CONFIG` - the trace providers and prestates to run. e.g. `cannon,cannon-kona/kona-0.1.0-alpha.5/0x03c50fbef46a05f93ea7665fa89015c2108e10c1b4501799c0663774bd35a9c5`

Testing utility that continuously runs the specified trace providers against real chain data. The trace providers can be
configured with multiple different prestates. This allows testing both the current and potential future prestates with
the fault proofs virtual machine used by the trace provider.

The same CLI options as `op-challenger` itself are supported to configure the trace providers. The additional `--run`
option allows specifying which prestates to use. The format is `gameType/name/prestateHash` where gameType is the
game type to use with the prestate (e.g cannon or asterisc-kona), name is an arbitrary name for the prestate to use
game type to use with the prestate (e.g cannon or cannon-kona), name is an arbitrary name for the prestate to use
when reporting metrics and prestateHash is the hex encoded absolute prestate commitment to use. If name is omitted the
game type name is used. If the prestateHash is omitted, the absolute prestate hash used for new games on-chain is used.

Expand Down
427 changes: 6 additions & 421 deletions op-challenger/cmd/main_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion op-challenger/cmd/run_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var (
RunTraceRunFlag = &cli.StringSliceFlag{
Name: "run",
Usage: "Specify a trace to run. Format is gameType/name/prestateHash where " +
"gameType is the game type to use with the prestate (e.g cannon or asterisc-kona), " +
"gameType is the game type to use with the prestate (e.g cannon or cannon-kona), " +
"name is an arbitrary name for the prestate to use when reporting metrics and" +
"prestateHash is the hex encoded absolute prestate commitment to use. " +
"If name is omitted the game type name is used." +
Expand Down
2 changes: 1 addition & 1 deletion op-challenger/cmd/run_trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestParseRunArg(t *testing.T) {
}{
{arg: "unknown/test1/0x1234", err: gameTypes.ErrUnknownGameType},
{arg: "cannon", expected: runner.RunConfig{GameType: gameTypes.CannonGameType, Name: gameTypes.CannonGameType.String()}},
{arg: "asterisc", expected: runner.RunConfig{GameType: gameTypes.AsteriscGameType, Name: gameTypes.AsteriscGameType.String()}},
{arg: "cannon-kona", expected: runner.RunConfig{GameType: gameTypes.CannonKonaGameType, Name: gameTypes.CannonKonaGameType.String()}},
{arg: "cannon/test1", expected: runner.RunConfig{GameType: gameTypes.CannonGameType, Name: "test1"}},
{arg: "cannon/test1/0x1234", expected: runner.RunConfig{GameType: gameTypes.CannonGameType, Name: "test1", Prestate: common.HexToHash("0x1234")}},
{arg: "cannon/test1/0xinvalid", err: ErrInvalidPrestateHash},
Expand Down
113 changes: 3 additions & 110 deletions op-challenger/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,12 @@ var (

ErrMissingRollupRpc = errors.New("missing rollup rpc url")
ErrMissingSupervisorRpc = errors.New("missing supervisor rpc url")

ErrMissingAsteriscAbsolutePreState = errors.New("missing asterisc absolute pre-state")
ErrMissingAsteriscSnapshotFreq = errors.New("missing asterisc snapshot freq")
ErrMissingAsteriscInfoFreq = errors.New("missing asterisc info freq")

ErrMissingAsteriscKonaAbsolutePreState = errors.New("missing asterisc kona absolute pre-state")
ErrMissingAsteriscKonaSnapshotFreq = errors.New("missing asterisc kona snapshot freq")
ErrMissingAsteriscKonaInfoFreq = errors.New("missing asterisc kona info freq")
)

const (
DefaultPollInterval = time.Second * 12
DefaultCannonSnapshotFreq = uint(1_000_000_000)
DefaultCannonInfoFreq = uint(10_000_000)
DefaultAsteriscSnapshotFreq = uint(1_000_000_000)
DefaultAsteriscInfoFreq = uint(10_000_000)
DefaultPollInterval = time.Second * 12
DefaultCannonSnapshotFreq = uint(1_000_000_000)
DefaultCannonInfoFreq = uint(10_000_000)
// DefaultGameWindow is the default maximum time duration in the past
// that the challenger will look for games to progress.
// The default value is 28 days. The worst case duration for a game is 16 days
Expand Down Expand Up @@ -94,14 +84,6 @@ type Config struct {
CannonKonaAbsolutePreState string // File to load the absolute pre-state for CannonKona traces from
CannonKonaAbsolutePreStateBaseURL *url.URL // Base URL to retrieve absolute pre-states for CannonKona traces from

// Specific to the asterisc trace provider
Asterisc vm.Config
AsteriscAbsolutePreState string // File to load the absolute pre-state for Asterisc traces from
AsteriscAbsolutePreStateBaseURL *url.URL // Base URL to retrieve absolute pre-states for Asterisc traces from
AsteriscKona vm.Config
AsteriscKonaAbsolutePreState string // File to load the absolute pre-state for AsteriscKona traces from
AsteriscKonaAbsolutePreStateBaseURL *url.URL // Base URL to retrieve absolute pre-states for AsteriscKona traces from

MaxPendingTx uint64 // Maximum number of pending transactions (0 == no limit)

TxMgrConfig txmgr.CLIConfig
Expand Down Expand Up @@ -170,24 +152,6 @@ func NewInteropConfig(
DebugInfo: true,
BinarySnapshots: true,
},
Asterisc: vm.Config{
VmType: gameTypes.AsteriscGameType,
L1: l1EthRpc,
L1Beacon: l1BeaconApi,
L2s: l2Rpcs,
SnapshotFreq: DefaultAsteriscSnapshotFreq,
InfoFreq: DefaultAsteriscInfoFreq,
BinarySnapshots: true,
},
AsteriscKona: vm.Config{
VmType: gameTypes.AsteriscKonaGameType,
L1: l1EthRpc,
L1Beacon: l1BeaconApi,
L2s: l2Rpcs,
SnapshotFreq: DefaultAsteriscSnapshotFreq,
InfoFreq: DefaultAsteriscInfoFreq,
BinarySnapshots: true,
},
GameWindow: DefaultGameWindow,
}
}
Expand Down Expand Up @@ -240,24 +204,6 @@ func NewConfig(
DebugInfo: true,
BinarySnapshots: true,
},
Asterisc: vm.Config{
VmType: gameTypes.AsteriscGameType,
L1: l1EthRpc,
L1Beacon: l1BeaconApi,
L2s: []string{l2EthRpc},
SnapshotFreq: DefaultAsteriscSnapshotFreq,
InfoFreq: DefaultAsteriscInfoFreq,
BinarySnapshots: true,
},
AsteriscKona: vm.Config{
VmType: gameTypes.AsteriscKonaGameType,
L1: l1EthRpc,
L1Beacon: l1BeaconApi,
L2s: []string{l2EthRpc},
SnapshotFreq: DefaultAsteriscSnapshotFreq,
InfoFreq: DefaultAsteriscInfoFreq,
BinarySnapshots: true,
},
GameWindow: DefaultGameWindow,
}
}
Expand Down Expand Up @@ -328,43 +274,6 @@ func (c Config) Check() error {
return err
}
}
if c.GameTypeEnabled(gameTypes.AsteriscGameType) {
if c.RollupRpc == "" {
return ErrMissingRollupRpc
}
if err := c.Asterisc.Check(); err != nil {
return fmt.Errorf("asterisc: %w", err)
}
if c.AsteriscAbsolutePreState == "" && c.AsteriscAbsolutePreStateBaseURL == nil {
return ErrMissingAsteriscAbsolutePreState
}
if c.Asterisc.SnapshotFreq == 0 {
return ErrMissingAsteriscSnapshotFreq
}
if c.Asterisc.InfoFreq == 0 {
return ErrMissingAsteriscInfoFreq
}
}
if c.GameTypeEnabled(gameTypes.AsteriscKonaGameType) {
if c.RollupRpc == "" {
return ErrMissingRollupRpc
}
if err := c.validateBaseAsteriscKonaOptions(); err != nil {
return err
}
}
if c.GameTypeEnabled(gameTypes.SuperAsteriscKonaGameType) {
if c.SupervisorRPC == "" {
return ErrMissingSupervisorRpc
}

if len(c.AsteriscKona.Networks) == 0 && c.AsteriscKona.DepsetConfigPath == "" {
return ErrMissingDepsetConfig
}
if err := c.validateBaseAsteriscKonaOptions(); err != nil {
return err
}
}
if c.GameTypeEnabled(gameTypes.OptimisticZKGameType) {
if c.RollupRpc == "" {
return ErrMissingRollupRpc
Expand Down Expand Up @@ -418,19 +327,3 @@ func (c Config) validateBaseCannonKonaOptions() error {
}
return nil
}

func (c Config) validateBaseAsteriscKonaOptions() error {
if err := c.AsteriscKona.Check(); err != nil {
return fmt.Errorf("asterisc kona: %w", err)
}
if c.AsteriscKonaAbsolutePreState == "" && c.AsteriscKonaAbsolutePreStateBaseURL == nil {
return ErrMissingAsteriscKonaAbsolutePreState
}
if c.AsteriscKona.SnapshotFreq == 0 {
return ErrMissingAsteriscKonaSnapshotFreq
}
if c.AsteriscKona.InfoFreq == 0 {
return ErrMissingAsteriscKonaInfoFreq
}
return nil
}
Loading