From 1294ccd49018e6067b7c3c03739ebe68d5c47df6 Mon Sep 17 00:00:00 2001 From: Dzung Do Date: Mon, 13 May 2024 18:12:17 +0700 Subject: [PATCH] fix lint error --- app/upgrades/v4/upgrades.go | 10 +++++++--- app/upgrades_test.go | 4 +--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/upgrades/v4/upgrades.go b/app/upgrades/v4/upgrades.go index c12fc77a..441c4919 100755 --- a/app/upgrades/v4/upgrades.go +++ b/app/upgrades/v4/upgrades.go @@ -15,7 +15,7 @@ func CreateUpgradeHandler( configurator module.Configurator, sk *stakingkeeper.Keeper, ) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info("Starting upgrade for multi staking...") fixMinCommisionRate(ctx, sk) return mm.RunMigrations(ctx, configurator, vm) @@ -28,11 +28,15 @@ func fixMinCommisionRate(ctx sdk.Context, staking *stakingkeeper.Keeper) { minComm := sdk.MustNewDecFromStr(NewMinCommisionRate) params := staking.GetParams(ctx) params.MinCommissionRate = minComm - staking.SetParams(ctx, params) + + err := staking.SetParams(ctx, params) + if err != nil { + panic(err) + } + for _, v := range validators { //nolint if v.Commission.Rate.LT(minComm) { - // We need to remove comm, err := updateValidatorCommission(ctx, staking, v, minComm) if err != nil { panic(err) diff --git a/app/upgrades_test.go b/app/upgrades_test.go index abbb9be3..ba0e468d 100644 --- a/app/upgrades_test.go +++ b/app/upgrades_test.go @@ -4,14 +4,12 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - v4 "github.com/realiotech/realio-network/app/upgrades/v4" + "github.com/stretchr/testify/require" ) func TestV4Upgrade(t *testing.T) {