Skip to content

Commit

Permalink
set infraction params for all consumer chains (#3471)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke authored Jan 9, 2025
1 parent 068f2c6 commit ae2f6d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions app/upgrades/v22/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions app/upgrades/v22/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
Expand Down

0 comments on commit ae2f6d9

Please sign in to comment.