From d392c79c266ff1b01a648c33521f9b827dbd7661 Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Tue, 2 Dec 2025 14:17:53 +1000 Subject: [PATCH] op-dispute-mon: Update list of output root game types --- .../extract/output_agreement_enricher_test.go | 2 +- .../extract/super_agreement_enricher_test.go | 2 +- op-dispute-mon/mon/types/types.go | 22 +++++++++++++++++-- op-dispute-mon/mon/types/types_test.go | 21 +++++++++++++++++- 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/op-dispute-mon/mon/extract/output_agreement_enricher_test.go b/op-dispute-mon/mon/extract/output_agreement_enricher_test.go index d0f665383c5..420f15d5754 100644 --- a/op-dispute-mon/mon/extract/output_agreement_enricher_test.go +++ b/op-dispute-mon/mon/extract/output_agreement_enricher_test.go @@ -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) { diff --git a/op-dispute-mon/mon/extract/super_agreement_enricher_test.go b/op-dispute-mon/mon/extract/super_agreement_enricher_test.go index 5ad80217a89..7fa06027862 100644 --- a/op-dispute-mon/mon/extract/super_agreement_enricher_test.go +++ b/op-dispute-mon/mon/extract/super_agreement_enricher_test.go @@ -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) { diff --git a/op-dispute-mon/mon/types/types.go b/op-dispute-mon/mon/types/types.go index e05d2fd509b..7b1874516c8 100644 --- a/op-dispute-mon/mon/types/types.go +++ b/op-dispute-mon/mon/types/types.go @@ -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 { @@ -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 diff --git a/op-dispute-mon/mon/types/types_test.go b/op-dispute-mon/mon/types/types_test.go index 99df937ea8e..1addef9c9a0 100644 --- a/op-dispute-mon/mon/types/types_test.go +++ b/op-dispute-mon/mon/types/types_test.go @@ -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()) }) @@ -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) + } + }) + } +}