From ae2f6d98b7d168b8e490c29696437c869dc8ab58 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Thu, 9 Jan 2025 10:49:18 +0100 Subject: [PATCH] set infraction params for all consumer chains (#3471) --- app/upgrades/v22/upgrades.go | 3 +-- app/upgrades/v22/upgrades_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/upgrades/v22/upgrades.go b/app/upgrades/v22/upgrades.go index 34a190c097..278c192d0c 100644 --- a/app/upgrades/v22/upgrades.go +++ b/app/upgrades/v22/upgrades.go @@ -44,8 +44,7 @@ func CreateUpgradeHandler( } func SetConsumerInfractionParams(ctx sdk.Context, pk providerkeeper.Keeper, infractionParameters providertypes.InfractionParameters) error { - activeConsumerIDs := pk.GetAllActiveConsumerIds(ctx) - for _, consumerID := range activeConsumerIDs { + for _, consumerID := range pk.GetAllConsumerIds(ctx) { if err := pk.SetInfractionParameters(ctx, consumerID, infractionParameters); err != nil { return err } diff --git a/app/upgrades/v22/upgrades_test.go b/app/upgrades/v22/upgrades_test.go index 1a3ecfe734..aa99c090c3 100644 --- a/app/upgrades/v22/upgrades_test.go +++ b/app/upgrades/v22/upgrades_test.go @@ -31,10 +31,10 @@ func TestSetDefaultConsumerInfractionParams(t *testing.T) { pk.SetConsumerChainId(ctx, stoppedConsumerID, "stopped-1") pk.SetConsumerPhase(ctx, stoppedConsumerID, providertypes.CONSUMER_PHASE_STOPPED) - activeConsumerIDs := pk.GetAllActiveConsumerIds(ctx) - require.Equal(t, 2, len(activeConsumerIDs)) + consumerIDs := pk.GetAllConsumerIds(ctx) + require.Equal(t, 3, len(consumerIDs)) - for _, consumerID := range activeConsumerIDs { + for _, consumerID := range consumerIDs { _, err := pk.GetInfractionParameters(ctx, consumerID) require.Error(t, err) } @@ -43,7 +43,7 @@ func TestSetDefaultConsumerInfractionParams(t *testing.T) { err := v22.SetConsumerInfractionParams(ctx, pk, testParams) require.NoError(t, err) - for _, consumerID := range activeConsumerIDs { + for _, consumerID := range consumerIDs { infractionParams, err := pk.GetInfractionParameters(ctx, consumerID) require.NoError(t, err) require.Equal(t, testParams, infractionParams)