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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestOutputAgreementEnricher(t *testing.T) {
})

t.Run("SkipNonOutputRootGameTypes", func(t *testing.T) {
gameTypes := []uint32{4, 5, 7, 8, 10, 49812}
gameTypes := []uint32{4, 5, 7, 9, 11, 49812}
for _, gameType := range gameTypes {
gameType := gameType
t.Run(fmt.Sprintf("GameType_%d", gameType), func(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestDetector_CheckSuperRootAgreement(t *testing.T) {
})

t.Run("FetchAllNonOutputRootGameTypes", func(t *testing.T) {
gameTypes := []uint32{4, 5, 7, 8, 10, 49812} // Treat unknown game types as using super roots
gameTypes := []uint32{4, 5, 7, 9, 11, 49812} // Treat unknown game types as using super roots
for _, gameType := range gameTypes {
gameType := gameType
t.Run(fmt.Sprintf("GameType_%d", gameType), func(t *testing.T) {
Expand Down
22 changes: 20 additions & 2 deletions op-dispute-mon/mon/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,25 @@ import (

// outputRootGameTypes lists the set of legacy game types that use output roots
// It is assumed that all other game types use super roots
var outputRootGameTypes = []uint32{0, 1, 2, 3, 6, 254, 255, 1337}
var outputRootGameTypes = []types.GameType{
types.CannonGameType,
types.PermissionedGameType,
types.AsteriscGameType,
types.AsteriscKonaGameType,
types.OPSuccinctGameType,
types.CannonKonaGameType,
types.OptimisticZKGameType,
types.FastGameType,
types.AlphabetGameType,
types.KailuaGameType,
}

var superRootGameTypes = []types.GameType{
types.SuperCannonGameType,
types.SuperPermissionedGameType,
types.SuperAsteriscKonaGameType,
types.SuperCannonKonaGameType,
}

// EnrichedClaim extends the faultTypes.Claim with additional context.
type EnrichedClaim struct {
Expand Down Expand Up @@ -87,7 +105,7 @@ type EnrichedGameData struct {

// UsesOutputRoots returns true if the game type is one of the known types that use output roots as proposals.
func (g EnrichedGameData) UsesOutputRoots() bool {
return slices.Contains(outputRootGameTypes, g.GameType)
return slices.Contains(outputRootGameTypes, types.GameType(g.GameType))
}

// HasMixedAvailability returns true if some rollup endpoints returned "not found" while others succeeded
Expand Down
21 changes: 20 additions & 1 deletion op-dispute-mon/mon/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestEnrichedGameData_UsesOutputRoots(t *testing.T) {
gameType := gameType
t.Run(fmt.Sprintf("GameType-%v", gameType), func(t *testing.T) {
data := EnrichedGameData{
GameMetadata: types.GameMetadata{GameType: gameType},
GameMetadata: types.GameMetadata{GameType: uint32(gameType)},
}
require.True(t, data.UsesOutputRoots())
})
Expand Down Expand Up @@ -177,3 +177,22 @@ func TestEnrichedGameData_HasMixedSafety(t *testing.T) {
})
}
}

func TestAllSupportedGameTypesAreOutputOrSuperRootType(t *testing.T) {
for _, gameType := range types.SupportedGameTypes {
t.Run(gameType.String(), func(t *testing.T) {
data := EnrichedGameData{
GameMetadata: types.GameMetadata{
GameType: uint32(gameType),
},
}
if data.UsesOutputRoots() {
require.Contains(t, outputRootGameTypes, gameType)
require.NotContains(t, superRootGameTypes, gameType)
} else {
require.Contains(t, superRootGameTypes, gameType)
require.NotContains(t, outputRootGameTypes, gameType)
}
})
}
}