From 66e0ee1eb61446146c191f13283663e76ebabb68 Mon Sep 17 00:00:00 2001 From: scorpioborn <97235353+scorpioborn@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:39:15 +0330 Subject: [PATCH] lint: golangci new version fixes --- .golangci.yml | 12 ++++++++++-- app/upgrades/v10/upgrades.go | 2 +- app/upgrades/v9/upgrades.go | 4 +--- cmd/sged/cmd/genaccounts_test.go | 1 - tests/e2e/bet/grpc.go | 1 - tests/e2e/bet/suite.go | 2 -- tests/e2e/house/grpc.go | 2 -- tests/e2e/house/suite.go | 8 -------- tests/e2e/market/grpc.go | 1 - tests/e2e/market/suite.go | 2 -- tests/e2e/reward/suite.go | 2 -- utils/fund.go | 2 +- x/bet/client/cli/query_bet.go | 2 +- x/bet/client/cli/query_bet_test.go | 2 -- x/bet/client/cli/query_params.go | 2 +- x/bet/client/cli/query_test.go | 1 - x/bet/client/cli/tx_bet_test.go | 1 - x/bet/client/cli/tx_test.go | 1 - x/bet/keeper/grpc_query_bet.go | 8 ++++---- x/bet/simulation/bet.go | 2 +- x/bet/simulation/decoder_test.go | 1 - x/bet/simulation/proposals.go | 9 +++++---- x/house/client/cli/query_deposit.go | 2 +- x/house/client/cli/query_params.go | 2 +- x/house/client/cli/query_params_test.go | 1 - x/house/client/cli/query_test.go | 1 - x/house/client/cli/tx_deposit_test.go | 1 - x/house/client/cli/tx_test.go | 1 - x/house/client/cli/tx_withdraw.go | 4 ++-- x/house/client/cli/tx_withdraw_test.go | 1 - x/house/keeper/grpc_query_deposit.go | 4 ++-- x/house/keeper/grpc_query_withdrawal.go | 2 +- x/house/simulation/decoder_test.go | 1 - x/house/simulation/proposals.go | 7 ++++--- x/market/client/cli/query_market.go | 2 +- x/market/client/cli/query_market_test.go | 1 - x/market/client/cli/query_params.go | 2 +- x/market/client/cli/query_params_test.go | 1 - x/market/client/cli/query_test.go | 1 - x/market/client/cli/tx_test.go | 1 - x/market/keeper/grpc_query_market.go | 2 +- x/market/simulation/decoder_test.go | 1 - x/market/simulation/market.go | 4 ++-- x/market/simulation/market_update.go | 2 +- x/mint/client/cli/query_minter.go | 8 ++++---- x/mint/client/cli/query_minter_test.go | 4 ---- x/mint/client/cli/query_params.go | 2 +- x/mint/client/cli/query_params_test.go | 1 - x/mint/client/cli/query_test.go | 1 - x/mint/simulation/decoder_test.go | 1 - x/mint/types/errors.go | 4 ++-- x/mint/types/params.go | 4 ++-- x/orderbook/client/cli/query_exposure_odds_test.go | 1 - x/orderbook/client/cli/query_orderbook.go | 2 +- x/orderbook/client/cli/query_orderbook_test.go | 1 - x/orderbook/client/cli/query_params.go | 2 +- x/orderbook/client/cli/query_params_test.go | 1 - x/orderbook/client/cli/query_participation_test.go | 1 - x/orderbook/client/cli/query_test.go | 1 - x/orderbook/keeper/fund.go | 4 ++-- x/orderbook/keeper/grpc_query_exposure_odds.go | 2 +- .../keeper/grpc_query_exposure_participation.go | 6 +++--- x/orderbook/keeper/grpc_query_orderbook.go | 2 +- x/orderbook/keeper/grpc_query_participation.go | 4 ++-- x/orderbook/keeper/grpc_query_participation_bet.go | 2 +- x/orderbook/simulation/decoder_test.go | 1 - x/orderbook/simulation/proposals.go | 7 ++++--- x/ovm/client/cli/query_params.go | 2 +- x/ovm/client/cli/query_params_test.go | 1 - x/ovm/client/cli/query_proposal_test.go | 1 - x/ovm/client/cli/query_pub_keys.go | 2 +- x/ovm/client/cli/query_test.go | 1 - x/ovm/client/cli/tx_test.go | 1 - x/ovm/keeper/grpc_query_pubkeys_proposal.go | 2 +- x/ovm/keeper/key_vault_test.go | 2 +- x/ovm/simulation/decoder_test.go | 1 - x/ovm/simulation/proposal.go | 2 +- x/ovm/types/export_test.go | 2 -- x/ovm/types/ticket_jwt.go | 2 +- x/reward/client/cli/query_campaign.go | 2 +- x/reward/client/cli/query_params.go | 2 +- x/reward/client/cli/query_promoter.go | 2 +- x/reward/client/cli/query_reward.go | 2 +- x/reward/keeper/query_campaign.go | 2 +- x/reward/keeper/query_promoter.go | 2 +- x/reward/keeper/query_reward.go | 8 ++++---- x/reward/simulation/campaign.go | 6 +++--- x/reward/types/ticket.go | 2 +- x/subaccount/client/cli/query_params.go | 2 +- x/subaccount/client/cli/tx.go | 6 +++--- x/subaccount/keeper/msg_server_balance_test.go | 8 +++----- x/subaccount/keeper/msg_server_subaccount_test.go | 5 ++--- x/subaccount/simulation/decoder_test.go | 1 - 93 files changed, 96 insertions(+), 147 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b9d5cb4d..521d5e6c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,7 +3,6 @@ run: timeout: 15m sort-results: true allow-parallel-runners: true - exclude-dir: testutil/testdata_pulsar concurrency: 4 linters: @@ -48,7 +47,16 @@ linters: - revive issues: - exclude-rules: [] + exclude-rules: + - path: (.+)_test.go + linters: + - gosec + - path: suite.go + linters: + - gosec + - path: testutil + linters: + - gosec max-issues-per-linter: 10000 max-same-issues: 10000 diff --git a/app/upgrades/v10/upgrades.go b/app/upgrades/v10/upgrades.go index f36ba774..60730e90 100644 --- a/app/upgrades/v10/upgrades.go +++ b/app/upgrades/v10/upgrades.go @@ -13,7 +13,7 @@ func CreateUpgradeHandler( configurator module.Configurator, _ *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return mm.RunMigrations(ctx, configurator, fromVM) } } diff --git a/app/upgrades/v9/upgrades.go b/app/upgrades/v9/upgrades.go index 8308f03b..5665de7b 100644 --- a/app/upgrades/v9/upgrades.go +++ b/app/upgrades/v9/upgrades.go @@ -43,12 +43,10 @@ func CreateUpgradeHandler( configurator module.Configurator, k *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { // https://github.com/cosmos/cosmos-sdk/pull/12363/files // Set param key table for params module migration for _, subspace := range k.ParamsKeeper.GetSubspaces() { - subspace := subspace - var keyTable paramstypes.KeyTable switch subspace.Name() { case authtypes.ModuleName: diff --git a/cmd/sged/cmd/genaccounts_test.go b/cmd/sged/cmd/genaccounts_test.go index 3464a1ac..299981b4 100644 --- a/cmd/sged/cmd/genaccounts_test.go +++ b/cmd/sged/cmd/genaccounts_test.go @@ -61,7 +61,6 @@ func TestSampleCMD(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/tests/e2e/bet/grpc.go b/tests/e2e/bet/grpc.go index 22ecb957..55c1bfbf 100644 --- a/tests/e2e/bet/grpc.go +++ b/tests/e2e/bet/grpc.go @@ -94,7 +94,6 @@ func (s *E2ETestSuite) TestBetsGRPCHandler() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) s.Require().NoError(err) diff --git a/tests/e2e/bet/suite.go b/tests/e2e/bet/suite.go index c6d5a203..9aba0e1c 100644 --- a/tests/e2e/bet/suite.go +++ b/tests/e2e/bet/suite.go @@ -369,8 +369,6 @@ func (s *E2ETestSuite) TestWagerTxCmd() { } for _, tc := range testCases { - tc := tc - s.Require().NoError(s.network.WaitForNextBlock()) s.Run(tc.name, func() { ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) diff --git a/tests/e2e/house/grpc.go b/tests/e2e/house/grpc.go index 192c8705..9227caab 100644 --- a/tests/e2e/house/grpc.go +++ b/tests/e2e/house/grpc.go @@ -54,7 +54,6 @@ func (s *E2ETestSuite) TestDepositsGRPCHandler() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) s.Require().NoError(err) @@ -93,7 +92,6 @@ func (s *E2ETestSuite) TestGRPCHandler() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) s.Require().NoError(err) diff --git a/tests/e2e/house/suite.go b/tests/e2e/house/suite.go index 7276221c..d2443a43 100644 --- a/tests/e2e/house/suite.go +++ b/tests/e2e/house/suite.go @@ -293,8 +293,6 @@ func (s *E2ETestSuite) TestDepositTxCmd() { } for _, tc := range testCases { - tc := tc - s.Require().NoError(s.network.WaitForNextBlock()) s.Run(tc.name, func() { ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) @@ -472,8 +470,6 @@ func (s *E2ETestSuite) TestDepositWithAuthzTxCmd() { } for _, tc := range testCases { - tc := tc - s.Require().NoError(s.network.WaitForNextBlock()) s.Run(tc.name, func() { ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) @@ -791,8 +787,6 @@ func (s *E2ETestSuite) TestWithdrawTxCmd() { } for _, tc := range testCases { - tc := tc - s.Require().NoError(s.network.WaitForNextBlock()) s.Run(tc.name, func() { ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) @@ -1000,8 +994,6 @@ func (s *E2ETestSuite) TestWithdrawWithAuthzTxCmd() { } for _, tc := range testCases { - tc := tc - s.Require().NoError(s.network.WaitForNextBlock()) s.Run(tc.name, func() { ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) diff --git a/tests/e2e/market/grpc.go b/tests/e2e/market/grpc.go index 2eb83ee5..872c396c 100644 --- a/tests/e2e/market/grpc.go +++ b/tests/e2e/market/grpc.go @@ -36,7 +36,6 @@ func (s *E2ETestSuite) TestMarketsGRPCHandler() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) s.Require().NoError(err) diff --git a/tests/e2e/market/suite.go b/tests/e2e/market/suite.go index 711f92d0..3e167ec6 100644 --- a/tests/e2e/market/suite.go +++ b/tests/e2e/market/suite.go @@ -181,8 +181,6 @@ func (s *E2ETestSuite) TestMarketAddTxCmd() { } for _, tc := range testCases { - tc := tc - s.Require().NoError(s.network.WaitForNextBlock()) s.Run(tc.name, func() { ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) diff --git a/tests/e2e/reward/suite.go b/tests/e2e/reward/suite.go index 31057b0c..8f792e15 100644 --- a/tests/e2e/reward/suite.go +++ b/tests/e2e/reward/suite.go @@ -174,8 +174,6 @@ func (s *E2ETestSuite) TestNewCampaignTxCmd() { } for _, tc := range testCases { - tc := tc - s.Require().NoError(s.network.WaitForNextBlock()) s.Run(tc.name, func() { clientCtx := val.ClientCtx diff --git a/utils/fund.go b/utils/fund.go index c2255b1f..124ebe72 100644 --- a/utils/fund.go +++ b/utils/fund.go @@ -67,7 +67,7 @@ func (f *ModuleAccFunder) Refund( // Transfer funds err := f.bk.SendCoinsFromModuleToAccount(ctx, mAcc, receiverAcc, amt) if err != nil { - return sdkerrors.Wrapf(f.bankError, err.Error()) + return sdkerrors.Wrap(f.bankError, err.Error()) } return nil diff --git a/x/bet/client/cli/query_bet.go b/x/bet/client/cli/query_bet.go index d3231f84..619bf0da 100644 --- a/x/bet/client/cli/query_bet.go +++ b/x/bet/client/cli/query_bet.go @@ -18,7 +18,7 @@ func CmdListBet() *cobra.Command { Use: "bets", Short: "get list of bets", Long: "Get list of bets in paginated response.", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) pageReq, err := client.ReadPageRequest(cmd.Flags()) diff --git a/x/bet/client/cli/query_bet_test.go b/x/bet/client/cli/query_bet_test.go index e10319a9..8d290631 100644 --- a/x/bet/client/cli/query_bet_test.go +++ b/x/bet/client/cli/query_bet_test.go @@ -125,7 +125,6 @@ func TestQueryBet(t *testing.T) { err: status.Error(codes.NotFound, "not found"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ tc.creator, @@ -371,7 +370,6 @@ func TestQueryBet(t *testing.T) { obj: objs, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ strings.Join(tc.items, ","), diff --git a/x/bet/client/cli/query_params.go b/x/bet/client/cli/query_params.go index 0f315630..1f96c169 100644 --- a/x/bet/client/cli/query_params.go +++ b/x/bet/client/cli/query_params.go @@ -17,7 +17,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) queryClient := types.NewQueryClient(clientCtx) diff --git a/x/bet/client/cli/query_test.go b/x/bet/client/cli/query_test.go index 1dcb3571..1cf6cc48 100644 --- a/x/bet/client/cli/query_test.go +++ b/x/bet/client/cli/query_test.go @@ -30,7 +30,6 @@ func TestGetQueryCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/bet/client/cli/tx_bet_test.go b/x/bet/client/cli/tx_bet_test.go index 45dc68ca..4263ad50 100644 --- a/x/bet/client/cli/tx_bet_test.go +++ b/x/bet/client/cli/tx_bet_test.go @@ -65,7 +65,6 @@ func TestTXBetCLI(t *testing.T) { err: fmt.Errorf("any error"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ tc.uid, diff --git a/x/bet/client/cli/tx_test.go b/x/bet/client/cli/tx_test.go index 2fab7773..3dadcacb 100644 --- a/x/bet/client/cli/tx_test.go +++ b/x/bet/client/cli/tx_test.go @@ -28,7 +28,6 @@ func TestGetTxCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/bet/keeper/grpc_query_bet.go b/x/bet/keeper/grpc_query_bet.go index e13d09de..2afdc483 100644 --- a/x/bet/keeper/grpc_query_bet.go +++ b/x/bet/keeper/grpc_query_bet.go @@ -32,7 +32,7 @@ func (k Keeper) Bets(c context.Context, req *types.QueryBetsRequest) (*types.Que betStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.BetListPrefix) - pageRes, err := query.Paginate(betStore, req.Pagination, func(key, value []byte) error { + pageRes, err := query.Paginate(betStore, req.Pagination, func(_, value []byte) error { var bet types.Bet if err := k.cdc.Unmarshal(value, &bet); err != nil { return err @@ -62,7 +62,7 @@ func (k Keeper) BetsByCreator( betStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.BetListByCreatorPrefix(req.Creator)) - pageRes, err := query.Paginate(betStore, req.Pagination, func(key, value []byte) error { + pageRes, err := query.Paginate(betStore, req.Pagination, func(_, value []byte) error { var bet types.Bet if err := k.cdc.Unmarshal(value, &bet); err != nil { return err @@ -153,7 +153,7 @@ func (k Keeper) PendingBets( pageRes, err := query.Paginate( pendingBetStore, req.Pagination, - func(key, value []byte) error { + func(_, value []byte) error { var pendingBet types.PendingBet if err := k.cdc.Unmarshal(value, &pendingBet); err != nil { return err @@ -197,7 +197,7 @@ func (k Keeper) SettledBetsOfHeight( pageRes, err := query.Paginate( settledBetStore, req.Pagination, - func(key, value []byte) error { + func(_, value []byte) error { var settledBet types.SettledBet if err := k.cdc.Unmarshal(value, &settledBet); err != nil { return err diff --git a/x/bet/simulation/bet.go b/x/bet/simulation/bet.go index 8cd39de5..9a6daf77 100644 --- a/x/bet/simulation/bet.go +++ b/x/bet/simulation/bet.go @@ -21,7 +21,7 @@ func SimulateMsgWager( bk types.BankKeeper, k keeper.Keeper, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) diff --git a/x/bet/simulation/decoder_test.go b/x/bet/simulation/decoder_test.go index fc6893ad..100e7d5f 100644 --- a/x/bet/simulation/decoder_test.go +++ b/x/bet/simulation/decoder_test.go @@ -81,7 +81,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: diff --git a/x/bet/simulation/proposals.go b/x/bet/simulation/proposals.go index 060b2dc1..9e17960c 100644 --- a/x/bet/simulation/proposals.go +++ b/x/bet/simulation/proposals.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/spf13/cast" "github.com/sge-network/sge/x/bet/types" ) @@ -36,11 +37,11 @@ func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) var authority sdk.AccAddress = address.Module("gov") params := types.DefaultParams() - params.BatchSettlementCount = uint32(r.Intn(10000)) - params.MaxBetByUidQueryCount = uint32(r.Intn(1000)) + params.BatchSettlementCount = cast.ToUint32(r.Intn(10000)) + params.MaxBetByUidQueryCount = cast.ToUint32(r.Intn(1000)) params.Constraints = types.Constraints{ - MinAmount: sdkmath.NewInt(int64(r.Intn(1000))), - Fee: sdkmath.NewInt(int64(r.Intn(99))), + MinAmount: sdkmath.NewInt(cast.ToInt64(r.Intn(1000))), + Fee: sdkmath.NewInt(cast.ToInt64(r.Intn(99))), } return &types.MsgUpdateParams{ diff --git a/x/house/client/cli/query_deposit.go b/x/house/client/cli/query_deposit.go index 6b58f896..7cfaf600 100644 --- a/x/house/client/cli/query_deposit.go +++ b/x/house/client/cli/query_deposit.go @@ -29,7 +29,7 @@ $ %s query house deposits version.AppName, ), ), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err diff --git a/x/house/client/cli/query_params.go b/x/house/client/cli/query_params.go index cefaa2d6..9815995f 100644 --- a/x/house/client/cli/query_params.go +++ b/x/house/client/cli/query_params.go @@ -17,7 +17,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) queryClient := types.NewQueryClient(clientCtx) diff --git a/x/house/client/cli/query_params_test.go b/x/house/client/cli/query_params_test.go index 37b2b502..d5a6171b 100644 --- a/x/house/client/cli/query_params_test.go +++ b/x/house/client/cli/query_params_test.go @@ -29,7 +29,6 @@ func TestQueryParams(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string args = append(args, tc.args...) diff --git a/x/house/client/cli/query_test.go b/x/house/client/cli/query_test.go index 16bac795..1f9d1b79 100644 --- a/x/house/client/cli/query_test.go +++ b/x/house/client/cli/query_test.go @@ -30,7 +30,6 @@ func TestGetQueryCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string args = append(args, tc.args...) diff --git a/x/house/client/cli/tx_deposit_test.go b/x/house/client/cli/tx_deposit_test.go index 2dd926ff..78b80db5 100644 --- a/x/house/client/cli/tx_deposit_test.go +++ b/x/house/client/cli/tx_deposit_test.go @@ -65,7 +65,6 @@ func TestTXDepositCLI(t *testing.T) { err: fmt.Errorf("any error"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ tc.marketUID, diff --git a/x/house/client/cli/tx_test.go b/x/house/client/cli/tx_test.go index bf375c7c..4021e3ab 100644 --- a/x/house/client/cli/tx_test.go +++ b/x/house/client/cli/tx_test.go @@ -28,7 +28,6 @@ func TestGetTxCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string args = append(args, tc.args...) diff --git a/x/house/client/cli/tx_withdraw.go b/x/house/client/cli/tx_withdraw.go index 6295124f..170af3f5 100644 --- a/x/house/client/cli/tx_withdraw.go +++ b/x/house/client/cli/tx_withdraw.go @@ -45,13 +45,13 @@ func CmdWithdraw() *cobra.Command { argTicket := args[2] - mode, err := cast.ToInt64E(args[3]) + mode, err := cast.ToInt32E(args[3]) if err != nil { return fmt.Errorf("mode provided must be a non-negative-integer: %v", mode) } var argAmountCosmosInt sdkmath.Int - if mode == int64(types.WithdrawalMode_WITHDRAWAL_MODE_PARTIAL) { + if mode == int32(types.WithdrawalMode_WITHDRAWAL_MODE_PARTIAL) { if len(args) != 5 { return fmt.Errorf("amount is mandatory for partial mode") } diff --git a/x/house/client/cli/tx_withdraw_test.go b/x/house/client/cli/tx_withdraw_test.go index 3bf826bd..92b7eb9c 100644 --- a/x/house/client/cli/tx_withdraw_test.go +++ b/x/house/client/cli/tx_withdraw_test.go @@ -70,7 +70,6 @@ func TestTXWithdrawCLI(t *testing.T) { err: fmt.Errorf("any error"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ tc.marketUID, diff --git a/x/house/keeper/grpc_query_deposit.go b/x/house/keeper/grpc_query_deposit.go index 48ea96bb..1d828035 100644 --- a/x/house/keeper/grpc_query_deposit.go +++ b/x/house/keeper/grpc_query_deposit.go @@ -27,7 +27,7 @@ func (k Keeper) Deposits( ctx := sdk.UnwrapSDKContext(c) store := k.getDepositStore(ctx) - pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { + pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { var deposit types.Deposit if err := k.cdc.Unmarshal(value, &deposit); err != nil { return err @@ -55,7 +55,7 @@ func (k Keeper) DepositsByAccount(c context.Context, ctx := sdk.UnwrapSDKContext(c) store := prefix.NewStore(k.getDepositStore(ctx), types.GetDepositListPrefix(req.Address)) - pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { + pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { var deposit types.Deposit if err := k.cdc.Unmarshal(value, &deposit); err != nil { return err diff --git a/x/house/keeper/grpc_query_withdrawal.go b/x/house/keeper/grpc_query_withdrawal.go index 077e9117..0e7651c5 100644 --- a/x/house/keeper/grpc_query_withdrawal.go +++ b/x/house/keeper/grpc_query_withdrawal.go @@ -26,7 +26,7 @@ func (k Keeper) WithdrawalsByAccount(c context.Context, ctx := sdk.UnwrapSDKContext(c) store := prefix.NewStore(k.getWithdrawalStore(ctx), types.GetWithdrawalListPrefix(req.Address)) - pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { + pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { var withdrawal types.Withdrawal if err := k.cdc.Unmarshal(value, &withdrawal); err != nil { return err diff --git a/x/house/simulation/decoder_test.go b/x/house/simulation/decoder_test.go index 6256162d..d2101423 100644 --- a/x/house/simulation/decoder_test.go +++ b/x/house/simulation/decoder_test.go @@ -55,7 +55,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: diff --git a/x/house/simulation/proposals.go b/x/house/simulation/proposals.go index e1acf047..77aa3185 100644 --- a/x/house/simulation/proposals.go +++ b/x/house/simulation/proposals.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/spf13/cast" "github.com/sge-network/sge/x/house/types" ) @@ -36,9 +37,9 @@ func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) var authority sdk.AccAddress = address.Module("gov") params := types.DefaultParams() - params.MaxWithdrawalCount = uint64(r.Intn(10000)) - params.HouseParticipationFee = sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.NewInt(int64(r.Intn(1000))), 2) - params.MinDeposit = sdkmath.NewInt(int64(r.Intn(1000))) + params.MaxWithdrawalCount = cast.ToUint64(r.Intn(10000)) + params.HouseParticipationFee = sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.NewInt(cast.ToInt64(r.Intn(1000))), 2) + params.MinDeposit = sdkmath.NewInt(cast.ToInt64(r.Intn(1000))) return &types.MsgUpdateParams{ Authority: authority.String(), diff --git a/x/market/client/cli/query_market.go b/x/market/client/cli/query_market.go index 0404dcad..8c4dea97 100644 --- a/x/market/client/cli/query_market.go +++ b/x/market/client/cli/query_market.go @@ -18,7 +18,7 @@ func CmdListMarkets() *cobra.Command { Use: "markets", Short: "list markets", Long: "Get list of markets in paginated response.", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) pageReq, err := client.ReadPageRequest(cmd.Flags()) diff --git a/x/market/client/cli/query_market_test.go b/x/market/client/cli/query_market_test.go index c8b30fca..2b453546 100644 --- a/x/market/client/cli/query_market_test.go +++ b/x/market/client/cli/query_market_test.go @@ -69,7 +69,6 @@ func TestQueryMarketCLI(t *testing.T) { err: status.Error(codes.NotFound, "not found"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ tc.idUID, diff --git a/x/market/client/cli/query_params.go b/x/market/client/cli/query_params.go index 2fc3feb4..d7fd4833 100644 --- a/x/market/client/cli/query_params.go +++ b/x/market/client/cli/query_params.go @@ -17,7 +17,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) queryClient := types.NewQueryClient(clientCtx) diff --git a/x/market/client/cli/query_params_test.go b/x/market/client/cli/query_params_test.go index 2efe1568..a3f331e5 100644 --- a/x/market/client/cli/query_params_test.go +++ b/x/market/client/cli/query_params_test.go @@ -29,7 +29,6 @@ func TestQueryParams(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/market/client/cli/query_test.go b/x/market/client/cli/query_test.go index 0377677a..65b3074b 100644 --- a/x/market/client/cli/query_test.go +++ b/x/market/client/cli/query_test.go @@ -28,7 +28,6 @@ func TestGetQueryCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/market/client/cli/tx_test.go b/x/market/client/cli/tx_test.go index d8003081..5381358c 100644 --- a/x/market/client/cli/tx_test.go +++ b/x/market/client/cli/tx_test.go @@ -28,7 +28,6 @@ func TestGetTxCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/market/keeper/grpc_query_market.go b/x/market/keeper/grpc_query_market.go index 2bf1ffdb..1dd3881b 100644 --- a/x/market/keeper/grpc_query_market.go +++ b/x/market/keeper/grpc_query_market.go @@ -27,7 +27,7 @@ func (k Keeper) Markets( marketStore := k.getMarketsStore(ctx) - pageRes, err := query.Paginate(marketStore, req.Pagination, func(key, value []byte) error { + pageRes, err := query.Paginate(marketStore, req.Pagination, func(_, value []byte) error { var market types.Market if err := k.cdc.Unmarshal(value, &market); err != nil { return err diff --git a/x/market/simulation/decoder_test.go b/x/market/simulation/decoder_test.go index a4bf0f94..0211aeb3 100644 --- a/x/market/simulation/decoder_test.go +++ b/x/market/simulation/decoder_test.go @@ -59,7 +59,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: diff --git a/x/market/simulation/market.go b/x/market/simulation/market.go index abdab2fa..e5bd2e06 100644 --- a/x/market/simulation/market.go +++ b/x/market/simulation/market.go @@ -18,7 +18,7 @@ func SimulateMsgAdd( _ types.BankKeeper, _ keeper.Keeper, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + return func(r *rand.Rand, _ *baseapp.BaseApp, _ sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgAdd{ @@ -41,7 +41,7 @@ func SimulateMsgResolve( _ types.BankKeeper, _ keeper.Keeper, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + return func(r *rand.Rand, _ *baseapp.BaseApp, _ sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgResolve{ diff --git a/x/market/simulation/market_update.go b/x/market/simulation/market_update.go index 49fd8f1d..1dc4eb44 100644 --- a/x/market/simulation/market_update.go +++ b/x/market/simulation/market_update.go @@ -18,7 +18,7 @@ func SimulateMsgUpdate( _ types.BankKeeper, _ keeper.Keeper, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + return func(r *rand.Rand, _ *baseapp.BaseApp, _ sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgUpdate{ diff --git a/x/mint/client/cli/query_minter.go b/x/mint/client/cli/query_minter.go index 8c256ef1..0a47ce50 100644 --- a/x/mint/client/cli/query_minter.go +++ b/x/mint/client/cli/query_minter.go @@ -17,7 +17,7 @@ func GetCmdQueryInflation() *cobra.Command { Use: "inflation", Short: "Query the current minting inflation value", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err @@ -46,7 +46,7 @@ func GetCmdQueryPhaseStep() *cobra.Command { Use: "phase-step", Short: "Query the current minting phase step", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err @@ -75,7 +75,7 @@ func GetCmdQueryPhaseProvisions() *cobra.Command { Use: "phase-provisions", Short: "Query the current minting phase provisions value", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err @@ -104,7 +104,7 @@ func GetCmdQueryEndPhaseStatus() *cobra.Command { Use: "endphase-status", Short: "Query the current status of end phase", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err diff --git a/x/mint/client/cli/query_minter_test.go b/x/mint/client/cli/query_minter_test.go index 841da800..cdf8866c 100644 --- a/x/mint/client/cli/query_minter_test.go +++ b/x/mint/client/cli/query_minter_test.go @@ -40,7 +40,6 @@ func TestQueryInflation(t *testing.T) { err: errors.New("rpc error: code = Unknown desc = cannot query with height in the future; please provide a valid height: invalid height"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := append([]string(nil), tc.args...) res, err := clitestutil.ExecTestCLICmd(ctx, cli.GetCmdQueryInflation(), args) @@ -81,7 +80,6 @@ func TestQueryPhaseStep(t *testing.T) { err: errors.New("rpc error: code = Unknown desc = cannot query with height in the future; please provide a valid height: invalid height"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := append([]string(nil), tc.args...) res, err := clitestutil.ExecTestCLICmd(ctx, cli.GetCmdQueryPhaseStep(), args) @@ -122,7 +120,6 @@ func TestQueryPhaseProvision(t *testing.T) { err: errors.New("rpc error: code = Unknown desc = cannot query with height in the future; please provide a valid height: invalid height"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := append([]string(nil), tc.args...) res, err := clitestutil.ExecTestCLICmd(ctx, cli.GetCmdQueryPhaseProvisions(), args) @@ -163,7 +160,6 @@ func TestQueryEndPhaseStatus(t *testing.T) { err: errors.New("rpc error: code = Unknown desc = cannot query with height in the future; please provide a valid height: invalid height"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := append([]string(nil), tc.args...) res, err := clitestutil.ExecTestCLICmd(ctx, cli.GetCmdQueryEndPhaseStatus(), args) diff --git a/x/mint/client/cli/query_params.go b/x/mint/client/cli/query_params.go index a8079812..42c5d96d 100644 --- a/x/mint/client/cli/query_params.go +++ b/x/mint/client/cli/query_params.go @@ -17,7 +17,7 @@ func GetCmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) queryClient := types.NewQueryClient(clientCtx) diff --git a/x/mint/client/cli/query_params_test.go b/x/mint/client/cli/query_params_test.go index e91d1eaa..3b485c63 100644 --- a/x/mint/client/cli/query_params_test.go +++ b/x/mint/client/cli/query_params_test.go @@ -30,7 +30,6 @@ func TestQueryParams(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/mint/client/cli/query_test.go b/x/mint/client/cli/query_test.go index ae639d98..b01ce291 100644 --- a/x/mint/client/cli/query_test.go +++ b/x/mint/client/cli/query_test.go @@ -28,7 +28,6 @@ func TestGetQueryCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/mint/simulation/decoder_test.go b/x/mint/simulation/decoder_test.go index 813823dd..0cf16243 100644 --- a/x/mint/simulation/decoder_test.go +++ b/x/mint/simulation/decoder_test.go @@ -35,7 +35,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: diff --git a/x/mint/types/errors.go b/x/mint/types/errors.go index a89ea40b..fd29b770 100644 --- a/x/mint/types/errors.go +++ b/x/mint/types/errors.go @@ -17,7 +17,7 @@ const ( ErrTextExcludeAmountMustBePositive = "exclude amount must be positive: %s" ErrTextPhasesShouldHaveValue = "phases should have value: %v" ErrTextMintParamInflationShouldBePositive = "mint parameter Inflation should be positive, is %s" - ErrTextYearCoefficientMustBePositive = "year coefficient should be non-zero and positive value" - ErrTextEndPhaseParamNotAllowed = "adding phase with equal values with end phase is not allowed" + ErrTextYearCoefficientMustBePositive = "year coefficient should be non-zero and positive value %s" + ErrTextEndPhaseParamNotAllowed = "adding phase with equal values with end phase is not allowed %s" ErrTextNilMinter = "stored minter should not be nil" ) diff --git a/x/mint/types/params.go b/x/mint/types/params.go index 12504060..3d84211b 100644 --- a/x/mint/types/params.go +++ b/x/mint/types/params.go @@ -277,10 +277,10 @@ func validatePhases(i interface{}) error { for _, p := range v { if !p.YearCoefficient.GT(sdkmath.LegacyZeroDec()) { - return fmt.Errorf(ErrTextYearCoefficientMustBePositive) + return fmt.Errorf(ErrTextYearCoefficientMustBePositive, p.YearCoefficient) } if IsEndPhase(p) { - return fmt.Errorf(ErrTextEndPhaseParamNotAllowed) + return fmt.Errorf(ErrTextEndPhaseParamNotAllowed, p.Inflation) } } diff --git a/x/orderbook/client/cli/query_exposure_odds_test.go b/x/orderbook/client/cli/query_exposure_odds_test.go index bba5b5ec..6c9a2384 100644 --- a/x/orderbook/client/cli/query_exposure_odds_test.go +++ b/x/orderbook/client/cli/query_exposure_odds_test.go @@ -80,7 +80,6 @@ func TestQueryOddsExposure(t *testing.T) { err: status.Error(codes.NotFound, "not found"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ tc.orderBookUID, diff --git a/x/orderbook/client/cli/query_orderbook.go b/x/orderbook/client/cli/query_orderbook.go index d78cbd8f..048bf073 100644 --- a/x/orderbook/client/cli/query_orderbook.go +++ b/x/orderbook/client/cli/query_orderbook.go @@ -28,7 +28,7 @@ $ %s query orderbook orderbooks version.AppName, ), ), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err diff --git a/x/orderbook/client/cli/query_orderbook_test.go b/x/orderbook/client/cli/query_orderbook_test.go index 2095bd33..4114af29 100644 --- a/x/orderbook/client/cli/query_orderbook_test.go +++ b/x/orderbook/client/cli/query_orderbook_test.go @@ -80,7 +80,6 @@ func TestQueryOrderBook(t *testing.T) { err: status.Error(codes.NotFound, "not found"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ tc.obj.UID, diff --git a/x/orderbook/client/cli/query_params.go b/x/orderbook/client/cli/query_params.go index 1983bdcb..5e685a77 100644 --- a/x/orderbook/client/cli/query_params.go +++ b/x/orderbook/client/cli/query_params.go @@ -17,7 +17,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) queryClient := types.NewQueryClient(clientCtx) diff --git a/x/orderbook/client/cli/query_params_test.go b/x/orderbook/client/cli/query_params_test.go index 55f08a10..a193158e 100644 --- a/x/orderbook/client/cli/query_params_test.go +++ b/x/orderbook/client/cli/query_params_test.go @@ -29,7 +29,6 @@ func TestQueryParams(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string args = append(args, tc.args...) diff --git a/x/orderbook/client/cli/query_participation_test.go b/x/orderbook/client/cli/query_participation_test.go index a9fbfa20..043ba55a 100644 --- a/x/orderbook/client/cli/query_participation_test.go +++ b/x/orderbook/client/cli/query_participation_test.go @@ -98,7 +98,6 @@ func TestQueryParticipation(t *testing.T) { err: status.Error(codes.NotFound, "not found"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ tc.orderBookUID, diff --git a/x/orderbook/client/cli/query_test.go b/x/orderbook/client/cli/query_test.go index aadc5295..13a6de9f 100644 --- a/x/orderbook/client/cli/query_test.go +++ b/x/orderbook/client/cli/query_test.go @@ -30,7 +30,6 @@ func TestGetQueryCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string args = append(args, tc.args...) diff --git a/x/orderbook/keeper/fund.go b/x/orderbook/keeper/fund.go index 5c486fd6..6fd518ab 100644 --- a/x/orderbook/keeper/fund.go +++ b/x/orderbook/keeper/fund.go @@ -62,7 +62,7 @@ func (k *Keeper) refund( // If module account has insufficient balance, return error if balance.Amount.LT(amt.AmountOf(params.DefaultBondDenom)) { - return sdkerrors.Wrapf(types.ErrInsufficientBalanceInModuleAccount, + return sdkerrors.Wrapf(types.ErrInsufficientBalanceInModuleAccount, "%s", mAcc) } @@ -70,7 +70,7 @@ func (k *Keeper) refund( err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, mAcc, receiverAcc, amt) if err != nil { - return sdkerrors.Wrapf(types.ErrFromBankModule, err.Error()) + return sdkerrors.Wrapf(types.ErrFromBankModule, ": %s", err) } return nil diff --git a/x/orderbook/keeper/grpc_query_exposure_odds.go b/x/orderbook/keeper/grpc_query_exposure_odds.go index eec7ff04..ed5bdbd8 100644 --- a/x/orderbook/keeper/grpc_query_exposure_odds.go +++ b/x/orderbook/keeper/grpc_query_exposure_odds.go @@ -65,7 +65,7 @@ func (k Keeper) OrderBookExposures( pageRes, err := query.FilteredPaginate( exposureStore, req.Pagination, - func(key, value []byte, accumulate bool) (bool, error) { + func(_, value []byte, accumulate bool) (bool, error) { var orderBookExposure types.OrderBookOddsExposure if err := k.cdc.Unmarshal(value, &orderBookExposure); err != nil { return false, err diff --git a/x/orderbook/keeper/grpc_query_exposure_participation.go b/x/orderbook/keeper/grpc_query_exposure_participation.go index fcdf49b8..44ff1018 100644 --- a/x/orderbook/keeper/grpc_query_exposure_participation.go +++ b/x/orderbook/keeper/grpc_query_exposure_participation.go @@ -37,7 +37,7 @@ func (k Keeper) OrderBookParticipationExposures( pageRes, err := query.FilteredPaginate( exposureStore, req.Pagination, - func(key, value []byte, accumulate bool) (bool, error) { + func(_, value []byte, accumulate bool) (bool, error) { var participationExposure types.ParticipationExposure if err := k.cdc.Unmarshal(value, &participationExposure); err != nil { return false, err @@ -87,7 +87,7 @@ func (k Keeper) ParticipationExposures( pageRes, err := query.FilteredPaginate( exposureStore, req.Pagination, - func(key, value []byte, accumulate bool) (bool, error) { + func(_, value []byte, accumulate bool) (bool, error) { var participationExposure types.ParticipationExposure if err := k.cdc.Unmarshal(value, &participationExposure); err != nil { return false, err @@ -131,7 +131,7 @@ func (k Keeper) HistoricalParticipationExposures( pageRes, err := query.FilteredPaginate( exposureStore, req.Pagination, - func(key, value []byte, accumulate bool) (bool, error) { + func(_, value []byte, accumulate bool) (bool, error) { var participationExposure types.ParticipationExposure if err := k.cdc.Unmarshal(value, &participationExposure); err != nil { return false, err diff --git a/x/orderbook/keeper/grpc_query_orderbook.go b/x/orderbook/keeper/grpc_query_orderbook.go index 9c461a11..e0b9a035 100644 --- a/x/orderbook/keeper/grpc_query_orderbook.go +++ b/x/orderbook/keeper/grpc_query_orderbook.go @@ -62,7 +62,7 @@ func (k Keeper) OrderBooks( pageRes, err := query.FilteredPaginate( bookStore, req.Pagination, - func(key, value []byte, accumulate bool) (bool, error) { + func(_, value []byte, accumulate bool) (bool, error) { orderBook, err := types.UnmarshalOrderBook(k.cdc, value) if err != nil { return false, err diff --git a/x/orderbook/keeper/grpc_query_participation.go b/x/orderbook/keeper/grpc_query_participation.go index ed15afef..d815b91b 100644 --- a/x/orderbook/keeper/grpc_query_participation.go +++ b/x/orderbook/keeper/grpc_query_participation.go @@ -71,7 +71,7 @@ func (k Keeper) OrderBookParticipations( pageRes, err := query.FilteredPaginate( participationStore, req.Pagination, - func(key, value []byte, accumulate bool) (bool, error) { + func(_, value []byte, accumulate bool) (bool, error) { var bookParticipation types.OrderBookParticipation if err := k.cdc.Unmarshal(value, &bookParticipation); err != nil { return false, err @@ -113,7 +113,7 @@ func (k Keeper) SettledOrderBookParticipationsOfHeight( pageRes, err := query.Paginate( settledOrderbookParticipationStore, req.Pagination, - func(key []byte, value []byte) error { + func(_ []byte, value []byte) error { var settledOrderbookParticipation types.SettledOrderbookParticipation if err := k.cdc.Unmarshal(value, &settledOrderbookParticipation); err != nil { return err diff --git a/x/orderbook/keeper/grpc_query_participation_bet.go b/x/orderbook/keeper/grpc_query_participation_bet.go index bd1123e3..05001339 100644 --- a/x/orderbook/keeper/grpc_query_participation_bet.go +++ b/x/orderbook/keeper/grpc_query_participation_bet.go @@ -42,7 +42,7 @@ func (k Keeper) ParticipationFulfilledBets( pageRes, err := query.FilteredPaginate( betsStore, req.Pagination, - func(key, value []byte, accumulate bool) (bool, error) { + func(_, value []byte, accumulate bool) (bool, error) { var participationBet types.ParticipationBetPair if err := k.cdc.Unmarshal(value, &participationBet); err != nil { return false, err diff --git a/x/orderbook/simulation/decoder_test.go b/x/orderbook/simulation/decoder_test.go index bf861b21..8cbf082e 100644 --- a/x/orderbook/simulation/decoder_test.go +++ b/x/orderbook/simulation/decoder_test.go @@ -117,7 +117,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: diff --git a/x/orderbook/simulation/proposals.go b/x/orderbook/simulation/proposals.go index 86b99778..c3ab31d6 100644 --- a/x/orderbook/simulation/proposals.go +++ b/x/orderbook/simulation/proposals.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/spf13/cast" "github.com/sge-network/sge/x/orderbook/types" ) @@ -35,9 +36,9 @@ func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) var authority sdk.AccAddress = address.Module("gov") params := types.DefaultParams() - params.BatchSettlementCount = uint64(r.Intn(10000)) - params.MaxOrderBookParticipations = uint64(r.Intn(1000)) - params.RequeueThreshold = uint64(r.Intn(1000)) + params.BatchSettlementCount = cast.ToUint64(r.Intn(10000)) + params.MaxOrderBookParticipations = cast.ToUint64(r.Intn(1000)) + params.RequeueThreshold = cast.ToUint64(r.Intn(1000)) return &types.MsgUpdateParams{ Authority: authority.String(), diff --git a/x/ovm/client/cli/query_params.go b/x/ovm/client/cli/query_params.go index 3d215641..5effe47d 100644 --- a/x/ovm/client/cli/query_params.go +++ b/x/ovm/client/cli/query_params.go @@ -17,7 +17,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) queryClient := types.NewQueryClient(clientCtx) diff --git a/x/ovm/client/cli/query_params_test.go b/x/ovm/client/cli/query_params_test.go index f020ee3d..6f15d0cf 100644 --- a/x/ovm/client/cli/query_params_test.go +++ b/x/ovm/client/cli/query_params_test.go @@ -29,7 +29,6 @@ func TestQueryParams(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/ovm/client/cli/query_proposal_test.go b/x/ovm/client/cli/query_proposal_test.go index 57a84065..fc1579c6 100644 --- a/x/ovm/client/cli/query_proposal_test.go +++ b/x/ovm/client/cli/query_proposal_test.go @@ -84,7 +84,6 @@ func TestCmdQueryPubkeysChangeProposal(t *testing.T) { err: status.Error(codes.NotFound, "not found"), }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { args := []string{ cast.ToString(cast.ToInt32(tc.status)), diff --git a/x/ovm/client/cli/query_pub_keys.go b/x/ovm/client/cli/query_pub_keys.go index 9fd2ed26..23034ce2 100644 --- a/x/ovm/client/cli/query_pub_keys.go +++ b/x/ovm/client/cli/query_pub_keys.go @@ -15,7 +15,7 @@ func CmdPubKeysList() *cobra.Command { Use: "pubkeys", Short: "Query public keys list", Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) (err error) { + RunE: func(cmd *cobra.Command, _ []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/ovm/client/cli/query_test.go b/x/ovm/client/cli/query_test.go index 2894135e..f5bf1f57 100644 --- a/x/ovm/client/cli/query_test.go +++ b/x/ovm/client/cli/query_test.go @@ -28,7 +28,6 @@ func TestGetQueryCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/ovm/client/cli/tx_test.go b/x/ovm/client/cli/tx_test.go index c8aa7d74..4bc5075a 100644 --- a/x/ovm/client/cli/tx_test.go +++ b/x/ovm/client/cli/tx_test.go @@ -28,7 +28,6 @@ func TestGetTxCmd(t *testing.T) { args: []string{}, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var args []string diff --git a/x/ovm/keeper/grpc_query_pubkeys_proposal.go b/x/ovm/keeper/grpc_query_pubkeys_proposal.go index af5947bf..572df1a9 100644 --- a/x/ovm/keeper/grpc_query_pubkeys_proposal.go +++ b/x/ovm/keeper/grpc_query_pubkeys_proposal.go @@ -51,7 +51,7 @@ func (k Keeper) PublicKeysChangeProposals( marketStore := k.getPubKeysChangeProposalStore(ctx) proposalStore := prefix.NewStore(marketStore, types.PubkeysChangeProposalPrefix(req.Status)) - pageRes, err := query.Paginate(proposalStore, req.Pagination, func(key, value []byte) error { + pageRes, err := query.Paginate(proposalStore, req.Pagination, func(_, value []byte) error { var proposal types.PublicKeysChangeProposal if err := k.cdc.Unmarshal(value, &proposal); err != nil { return err diff --git a/x/ovm/keeper/key_vault_test.go b/x/ovm/keeper/key_vault_test.go index db4c8dc3..cf9bd397 100644 --- a/x/ovm/keeper/key_vault_test.go +++ b/x/ovm/keeper/key_vault_test.go @@ -50,7 +50,7 @@ func TestQueryPublicKeys(t *testing.T) { func TestSetKeys(t *testing.T) { k, ctx := setupKeeper(t) - t.Run("valid", func(t *testing.T) { + t.Run("valid", func(_ *testing.T) { k.SetKeyVault(ctx, types.KeyVault{ PublicKeys: []string{ "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+9wlxVu9a8lzUO2kcFLu\nUBIuV0+DpUdgEmsyQXr4y65sPSx/XjbK3GSZS1fB4irYPPG8EPHa6Z9KwWJLrTBr\nHayQcUBV5GQPf7nDktCkljYEBRmJZ+x3tlTf2kyKf3JMPAYgSFcs792dMpx8EiuE\n683QzUyeCutmiSWj1e7/IR9tjD4X/XFGkLES6wtqpQpOsL10z3hZllQEqZif8pDZ\nZcDvF97dg0l+JIWW3jBINL/UzuBRmdtDMuS1d57bpaMNb7L9HLUDBiwlZTGhs1+v\n9eTMY6IEdIzQ6M1KTFDeLYdnpGWP0ttBpt7SesLNpsKStbZ7QkbNtzlkTN8eJ6qu\nJQIDAQAB\n-----END PUBLIC KEY-----", diff --git a/x/ovm/simulation/decoder_test.go b/x/ovm/simulation/decoder_test.go index f4582de0..2596dd6f 100644 --- a/x/ovm/simulation/decoder_test.go +++ b/x/ovm/simulation/decoder_test.go @@ -67,7 +67,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: diff --git a/x/ovm/simulation/proposal.go b/x/ovm/simulation/proposal.go index 3ee0e1ea..c0a04613 100644 --- a/x/ovm/simulation/proposal.go +++ b/x/ovm/simulation/proposal.go @@ -18,7 +18,7 @@ func SimulateMsgChangePubkeysListProposal( _ types.BankKeeper, _ keeper.Keeper, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + return func(r *rand.Rand, _ *baseapp.BaseApp, _ sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgSubmitPubkeysChangeProposalRequest{ diff --git a/x/ovm/types/export_test.go b/x/ovm/types/export_test.go index 790dee47..3ed507c4 100644 --- a/x/ovm/types/export_test.go +++ b/x/ovm/types/export_test.go @@ -5,8 +5,6 @@ package types type JwtTestToken = jwtTicket // NewTestJwtToken create new jwt token object -// -//nolint:revive func NewTestJwtToken(header, payload, signature string) *JwtTestToken { return &jwtTicket{ header: header, diff --git a/x/ovm/types/ticket_jwt.go b/x/ovm/types/ticket_jwt.go index 705c14b6..1f518088 100644 --- a/x/ovm/types/ticket_jwt.go +++ b/x/ovm/types/ticket_jwt.go @@ -129,7 +129,7 @@ func (t *jwtTicket) verifyJwtKey(key string) (bool, error) { parser := jwt.NewParser( jwt.WithoutClaimsValidation(), ) - parsedToken, err := parser.Parse(token, func(t *jwt.Token) (interface{}, error) { + parsedToken, err := parser.Parse(token, func(_ *jwt.Token) (interface{}, error) { parsedPubKey, err := jwt.ParseEdPublicKeyFromPEM([]byte(key)) if err != nil { return nil, err diff --git a/x/reward/client/cli/query_campaign.go b/x/reward/client/cli/query_campaign.go index 524c96bc..c7c3c2fa 100644 --- a/x/reward/client/cli/query_campaign.go +++ b/x/reward/client/cli/query_campaign.go @@ -15,7 +15,7 @@ func CmdListCampaign() *cobra.Command { cmd := &cobra.Command{ Use: "campaigns", Short: "list all campaigns", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) pageReq, err := client.ReadPageRequest(cmd.Flags()) diff --git a/x/reward/client/cli/query_params.go b/x/reward/client/cli/query_params.go index 6edd3325..2aa5f8d8 100644 --- a/x/reward/client/cli/query_params.go +++ b/x/reward/client/cli/query_params.go @@ -16,7 +16,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) queryClient := types.NewQueryClient(clientCtx) diff --git a/x/reward/client/cli/query_promoter.go b/x/reward/client/cli/query_promoter.go index 426fb77b..0e41c208 100644 --- a/x/reward/client/cli/query_promoter.go +++ b/x/reward/client/cli/query_promoter.go @@ -15,7 +15,7 @@ func CmdListPromoters() *cobra.Command { cmd := &cobra.Command{ Use: "promoters", Short: "list all promoters", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) pageReq, err := client.ReadPageRequest(cmd.Flags()) diff --git a/x/reward/client/cli/query_reward.go b/x/reward/client/cli/query_reward.go index 8522170c..a3a80676 100644 --- a/x/reward/client/cli/query_reward.go +++ b/x/reward/client/cli/query_reward.go @@ -16,7 +16,7 @@ func CmdListReward() *cobra.Command { cmd := &cobra.Command{ Use: "rewards", Short: "list all rewards", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) pageReq, err := client.ReadPageRequest(cmd.Flags()) diff --git a/x/reward/keeper/query_campaign.go b/x/reward/keeper/query_campaign.go index 7c692b3b..7dc1d316 100644 --- a/x/reward/keeper/query_campaign.go +++ b/x/reward/keeper/query_campaign.go @@ -23,7 +23,7 @@ func (k Keeper) Campaigns(goCtx context.Context, req *types.QueryCampaignsReques store := ctx.KVStore(k.storeKey) campaignStore := prefix.NewStore(store, types.CampaignKeyPrefix) - pageRes, err := query.Paginate(campaignStore, req.Pagination, func(key []byte, value []byte) error { + pageRes, err := query.Paginate(campaignStore, req.Pagination, func(_ []byte, value []byte) error { var campaign types.Campaign if err := k.cdc.Unmarshal(value, &campaign); err != nil { return err diff --git a/x/reward/keeper/query_promoter.go b/x/reward/keeper/query_promoter.go index dfedf679..e61e84d9 100644 --- a/x/reward/keeper/query_promoter.go +++ b/x/reward/keeper/query_promoter.go @@ -22,7 +22,7 @@ func (k Keeper) Promoters(goCtx context.Context, req *types.QueryPromotersReques store := ctx.KVStore(k.storeKey) promoterStore := prefix.NewStore(store, types.PromoterKeyPrefix) - pageRes, err := query.Paginate(promoterStore, req.Pagination, func(key []byte, value []byte) error { + pageRes, err := query.Paginate(promoterStore, req.Pagination, func(_ []byte, value []byte) error { var promoter types.Promoter if err := k.cdc.Unmarshal(value, &promoter); err != nil { return err diff --git a/x/reward/keeper/query_reward.go b/x/reward/keeper/query_reward.go index 8ea7acba..b94ba110 100644 --- a/x/reward/keeper/query_reward.go +++ b/x/reward/keeper/query_reward.go @@ -22,7 +22,7 @@ func (k Keeper) Rewards(goCtx context.Context, req *types.QueryRewardsRequest) ( store := ctx.KVStore(k.storeKey) rewardStore := prefix.NewStore(store, types.RewardKeyPrefix) - pageRes, err := query.Paginate(rewardStore, req.Pagination, func(key []byte, value []byte) error { + pageRes, err := query.Paginate(rewardStore, req.Pagination, func(_ []byte, value []byte) error { var reward types.Reward if err := k.cdc.Unmarshal(value, &reward); err != nil { return err @@ -66,7 +66,7 @@ func (k Keeper) RewardsByAddress(goCtx context.Context, req *types.QueryRewardsB store := k.getRewardByReceiverAndCategoryStore(ctx) rewardStore := prefix.NewStore(store, types.GetRewardsOfReceiverByPromoterPrefix(req.PromoterUid, req.Address)) - pageRes, err := query.Paginate(rewardStore, req.Pagination, func(key []byte, value []byte) error { + pageRes, err := query.Paginate(rewardStore, req.Pagination, func(_ []byte, value []byte) error { var reward types.RewardByCategory if err := k.cdc.Unmarshal(value, &reward); err != nil { return err @@ -93,7 +93,7 @@ func (k Keeper) RewardsByAddressAndCategory(goCtx context.Context, req *types.Qu store := k.getRewardByReceiverAndCategoryStore(ctx) rewardStore := prefix.NewStore(store, types.GetRewardsOfReceiverByPromoterAndCategoryPrefix(req.PromoterUid, req.Address, req.Category)) - pageRes, err := query.Paginate(rewardStore, req.Pagination, func(key []byte, value []byte) error { + pageRes, err := query.Paginate(rewardStore, req.Pagination, func(_ []byte, value []byte) error { var reward types.RewardByCategory if err := k.cdc.Unmarshal(value, &reward); err != nil { return err @@ -120,7 +120,7 @@ func (k Keeper) RewardsByCampaign(goCtx context.Context, req *types.QueryRewards store := k.getRewardsByCampaignStore(ctx) rewardStore := prefix.NewStore(store, types.GetRewardsByCampaignPrefix(req.CampaignUid)) - pageRes, err := query.Paginate(rewardStore, req.Pagination, func(key []byte, value []byte) error { + pageRes, err := query.Paginate(rewardStore, req.Pagination, func(_ []byte, value []byte) error { var reward types.RewardByCampaign if err := k.cdc.Unmarshal(value, &reward); err != nil { return err diff --git a/x/reward/simulation/campaign.go b/x/reward/simulation/campaign.go index f3407ac5..4107c822 100644 --- a/x/reward/simulation/campaign.go +++ b/x/reward/simulation/campaign.go @@ -25,7 +25,7 @@ func SimulateMsgCreateCampaign( bk types.BankKeeper, k keeper.Keeper, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) @@ -63,7 +63,7 @@ func SimulateMsgUpdateCampaign( bk types.BankKeeper, k keeper.Keeper, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { var ( simAccount = simtypes.Account{} @@ -109,7 +109,7 @@ func SimulateMsgDeleteCampaign( bk types.BankKeeper, k keeper.Keeper, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, _ string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { var ( simAccount = simtypes.Account{} diff --git a/x/reward/types/ticket.go b/x/reward/types/ticket.go index 91abf72e..a617d1ec 100644 --- a/x/reward/types/ticket.go +++ b/x/reward/types/ticket.go @@ -27,7 +27,7 @@ func (payload *CreateCampaignPayload) Validate(blockTime uint64) error { } if err := payload.validateRewardCategory(); err != nil { - return sdkerrors.Wrapf(sdkerrtypes.ErrInvalidRequest, err.Error()) + return sdkerrors.Wrap(sdkerrtypes.ErrInvalidRequest, err.Error()) } switch payload.RewardAmountType { diff --git a/x/subaccount/client/cli/query_params.go b/x/subaccount/client/cli/query_params.go index 53eeb1fb..2205f025 100644 --- a/x/subaccount/client/cli/query_params.go +++ b/x/subaccount/client/cli/query_params.go @@ -16,7 +16,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx := client.GetClientContextFromCmd(cmd) queryClient := types.NewQueryClient(clientCtx) diff --git a/x/subaccount/client/cli/tx.go b/x/subaccount/client/cli/tx.go index 9800a700..dbecabd0 100644 --- a/x/subaccount/client/cli/tx.go +++ b/x/subaccount/client/cli/tx.go @@ -153,7 +153,7 @@ func TxWithdraw() *cobra.Command { Long: `Withdraw unlocked funds from a subaccount.`, Example: fmt.Sprintf(`$ %s tx subaccount withdraw --from subaccount-owner-key`, version.AppName), Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err @@ -270,13 +270,13 @@ func TxHouseWithdraw() *cobra.Command { argTicket := args[2] - mode, err := cast.ToInt64E(args[3]) + mode, err := cast.ToInt32E(args[3]) if err != nil { return fmt.Errorf("mode provided must be a non-negative-integer: %v", mode) } var argAmountCosmosInt sdkmath.Int - if mode == int64(housetypes.WithdrawalMode_WITHDRAWAL_MODE_PARTIAL) { + if mode == int32(housetypes.WithdrawalMode_WITHDRAWAL_MODE_PARTIAL) { if len(args) != 5 { return fmt.Errorf("amount is mandatory for partial mode") } diff --git a/x/subaccount/keeper/msg_server_balance_test.go b/x/subaccount/keeper/msg_server_balance_test.go index 8c1ed9db..ff47dad5 100644 --- a/x/subaccount/keeper/msg_server_balance_test.go +++ b/x/subaccount/keeper/msg_server_balance_test.go @@ -141,13 +141,12 @@ func TestMsgServer_WithdrawUnlockedBalances_Errors(t *testing.T) { msg: types.MsgWithdrawUnlockedBalances{ Creator: creatorAddr, }, - prepare: func(ctx sdk.Context, keeper keeper.Keeper) {}, + prepare: func(_ sdk.Context, _ keeper.Keeper) {}, expectedErr: types.ErrSubaccountDoesNotExist.Error(), }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { _, k, msgServer, ctx := setupMsgServerAndApp(t) @@ -235,7 +234,7 @@ func TestNewMsgServerTopUp_Errors(t *testing.T) { }, }, }, - prepare: func(ctx sdk.Context, msgServer types.MsgServer) {}, + prepare: func(_ sdk.Context, _ types.MsgServer) {}, expectedErr: types.ErrUnlockTokenTimeExpired.Error(), }, { @@ -250,7 +249,7 @@ func TestNewMsgServerTopUp_Errors(t *testing.T) { }, }, }, - prepare: func(ctx sdk.Context, msgServer types.MsgServer) {}, + prepare: func(_ sdk.Context, _ types.MsgServer) {}, expectedErr: types.ErrSubaccountDoesNotExist.Error(), }, { @@ -280,7 +279,6 @@ func TestNewMsgServerTopUp_Errors(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { _, _, msgServer, ctx := setupMsgServerAndApp(t) diff --git a/x/subaccount/keeper/msg_server_subaccount_test.go b/x/subaccount/keeper/msg_server_subaccount_test.go index 41858487..cd0ef3e0 100644 --- a/x/subaccount/keeper/msg_server_subaccount_test.go +++ b/x/subaccount/keeper/msg_server_subaccount_test.go @@ -94,7 +94,7 @@ func TestMsgServer_CreateSubaccount_Errors(t *testing.T) { }, }, }, - prepare: func(ctx sdk.Context, k *keeper.Keeper) {}, + prepare: func(_ sdk.Context, _ *keeper.Keeper) {}, expectedErr: types.ErrUnlockTokenTimeExpired.Error(), }, { @@ -126,13 +126,12 @@ func TestMsgServer_CreateSubaccount_Errors(t *testing.T) { }, }, }, - prepare: func(ctx sdk.Context, k *keeper.Keeper) {}, + prepare: func(_ sdk.Context, _ *keeper.Keeper) {}, expectedErr: "invalid request", }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { _, k, msgServer, ctx := setupMsgServerAndApp(t) diff --git a/x/subaccount/simulation/decoder_test.go b/x/subaccount/simulation/decoder_test.go index 74eefb6e..cd42a1ff 100644 --- a/x/subaccount/simulation/decoder_test.go +++ b/x/subaccount/simulation/decoder_test.go @@ -58,7 +58,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: