From e5bd05ecf264d83c0d7f895d7a3e83840ba00803 Mon Sep 17 00:00:00 2001 From: Tom <54514587+GAtom22@users.noreply.github.com> Date: Wed, 22 Mar 2023 12:15:58 -0300 Subject: [PATCH] fix: lint issues (#1487) --- app/ante/evm/ante_test.go | 2 +- app/ante/evm/fee_checker_test.go | 4 +- app/ante/evm/utils_test.go | 45 ++++++++++--------- app/upgrades/v12/upgrades.go | 5 +-- app/upgrades/v9/upgrades.go | 5 +-- app/upgrades/v9_1/upgrades.go | 6 +-- client/keys/add.go | 6 +-- cmd/evmosd/init.go | 5 ++- ethereum/eip712/eip712_legacy.go | 6 +-- ibc/module_test.go | 45 +++++++++++++++---- ibc/testing/path.go | 11 +---- rpc/backend/client_test.go | 6 +-- rpc/backend/node_info.go | 2 +- rpc/namespaces/ethereum/eth/api.go | 8 ++-- .../ethereum/eth/filters/filters.go | 2 +- rpc/namespaces/ethereum/miner/unsupported.go | 6 +-- rpc/websockets.go | 2 +- testutil/contract.go | 1 - x/claims/keeper/hooks.go | 37 +++++++-------- x/claims/migrations/v3/migrate_test.go | 2 +- x/claims/module.go | 6 +-- x/claims/types/msg.go | 6 +-- x/epochs/keeper/setup_test.go | 2 +- x/epochs/keeper/utils_test.go | 3 +- x/epochs/module.go | 20 ++++----- x/epochs/types/identifier.go | 5 +-- x/erc20/keeper/evm_hooks.go | 2 +- x/erc20/keeper/grpc_query_test.go | 10 ++--- x/erc20/keeper/migrations_test.go | 2 +- x/erc20/keeper/mint_test.go | 2 +- x/erc20/keeper/mock_test.go | 27 +++++------ x/erc20/keeper/proposals.go | 4 +- x/erc20/keeper/proposals_test.go | 8 ++-- x/erc20/keeper/token_pairs_test.go | 18 ++++---- x/erc20/migrations/v3/migration_test.go | 2 +- x/erc20/module.go | 16 +++---- x/erc20/types/msg.go | 6 +-- x/erc20/types/token_pair.go | 8 +--- x/erc20/types/token_pair_test.go | 23 +++++----- x/evm/handler_test.go | 5 ++- x/evm/keeper/abci.go | 4 +- x/evm/keeper/config.go | 2 +- x/evm/keeper/grpc_query.go | 13 +++--- x/evm/keeper/hooks_test.go | 4 +- x/evm/migrations/v4/migrate_test.go | 2 +- x/evm/statedb/mock_test.go | 16 +++---- x/evm/statedb/statedb.go | 2 +- x/evm/types/access_list_tx.go | 6 +-- x/evm/types/legacy_tx.go | 6 +-- x/evm/types/tracer.go | 16 +++++++ x/evm/types/tx_args.go | 4 +- x/evm/types/utils_test.go | 4 +- x/feemarket/keeper/abci.go | 4 +- x/feemarket/migrations/v4/migrate_test.go | 2 +- x/ibc/transfer/keeper/keeper_test.go | 6 ++- x/incentives/migrations/v2/migrate_test.go | 2 +- x/incentives/module.go | 20 ++++----- x/incentives/types/msg.go | 6 +-- x/inflation/keeper/inflation.go | 2 +- x/inflation/keeper/migrations_test.go | 2 +- x/inflation/keeper/setup_test.go | 2 +- x/inflation/keeper/utils_test.go | 3 +- x/inflation/migrations/v2/migrate_test.go | 2 +- x/inflation/migrations/v2/types/params.go | 5 +-- x/inflation/module.go | 18 ++++---- x/inflation/types/params.go | 5 +-- x/recovery/keeper/mock_test.go | 2 +- x/recovery/migrations/v2/migrate_test.go | 2 +- x/recovery/module.go | 8 ++-- x/recovery/types/msg.go | 6 +-- x/revenue/v1/keeper/integration_test.go | 3 -- x/revenue/v1/migrations/v2/migrate_test.go | 2 +- x/revenue/v1/module.go | 18 ++++---- x/revenue/v1/types/msg.go | 6 +-- x/vesting/module.go | 2 +- 75 files changed, 292 insertions(+), 296 deletions(-) diff --git a/app/ante/evm/ante_test.go b/app/ante/evm/ante_test.go index f3b60d5c84..a7217be146 100644 --- a/app/ante/evm/ante_test.go +++ b/app/ante/evm/ante_test.go @@ -365,7 +365,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { from, grantee, &banktypes.SendAuthorization{SpendLimit: gasAmount}, &expiresAt, ) suite.Require().NoError(err) - builder, err := suite.CreateTestEIP712SingleMessageTxBuilder(from, privKey, suite.ctx.ChainID(), gas, gasAmount, msg) + builder, err := suite.CreateTestEIP712SingleMessageTxBuilder(privKey, suite.ctx.ChainID(), gas, gasAmount, msg) suite.Require().NoError(err) return builder.GetTx() diff --git a/app/ante/evm/fee_checker_test.go b/app/ante/evm/fee_checker_test.go index ce87ff6f5f..9cbd9eba95 100644 --- a/app/ante/evm/fee_checker_test.go +++ b/app/ante/evm/fee_checker_test.go @@ -25,14 +25,14 @@ type MockEVMKeeper struct { EnableLondonHF bool } -func (m MockEVMKeeper) GetBaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int { +func (m MockEVMKeeper) GetBaseFee(_ sdk.Context, _ *params.ChainConfig) *big.Int { if m.EnableLondonHF { return m.BaseFee } return nil } -func (m MockEVMKeeper) GetParams(ctx sdk.Context) evmtypes.Params { +func (m MockEVMKeeper) GetParams(_ sdk.Context) evmtypes.Params { return evmtypes.DefaultParams() } diff --git a/app/ante/evm/utils_test.go b/app/ante/evm/utils_test.go index 5e3d1c8f67..01ded6b728 100644 --- a/app/ante/evm/utils_test.go +++ b/app/ante/evm/utils_test.go @@ -78,6 +78,8 @@ func (suite *AnteTestSuite) BuildTestEthTx( } // CreateTestTx is a helper function to create a tx given multiple inputs. +// +//nolint:revive func (suite *AnteTestSuite) CreateTestTx( msg *evmtypes.MsgEthereumTx, priv cryptotypes.PrivKey, accNum uint64, signCosmosTx bool, unsetExtensionOptions ...bool, @@ -192,7 +194,7 @@ func (suite *AnteTestSuite) CreateTestEIP712TxBuilderMsgSend(from sdk.AccAddress // Build MsgSend recipient := sdk.AccAddress(common.Address{}.Bytes()) msgSend := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1)))) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgSend) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgSend) } func (suite *AnteTestSuite) CreateTestEIP712TxBuilderMsgDelegate(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { @@ -200,7 +202,7 @@ func (suite *AnteTestSuite) CreateTestEIP712TxBuilderMsgDelegate(from sdk.AccAdd valEthAddr := utiltx.GenerateAddress() valAddr := sdk.ValAddress(valEthAddr.Bytes()) msgSend := stakingtypes.NewMsgDelegate(from, valAddr, sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(20))) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgSend) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgSend) } func (suite *AnteTestSuite) CreateTestEIP712MsgCreateValidator(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { @@ -216,7 +218,7 @@ func (suite *AnteTestSuite) CreateTestEIP712MsgCreateValidator(from sdk.AccAddre sdk.OneInt(), ) suite.Require().NoError(err) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgCreate) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgCreate) } func (suite *AnteTestSuite) CreateTestEIP712MsgCreateValidator2(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { @@ -233,7 +235,7 @@ func (suite *AnteTestSuite) CreateTestEIP712MsgCreateValidator2(from sdk.AccAddr sdk.OneInt(), ) suite.Require().NoError(err) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgCreate) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgCreate) } func (suite *AnteTestSuite) CreateTestEIP712SubmitProposal(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins, deposit sdk.Coins) (client.TxBuilder, error) { @@ -241,7 +243,7 @@ func (suite *AnteTestSuite) CreateTestEIP712SubmitProposal(from sdk.AccAddress, suite.Require().True(ok) msgSubmit, err := govtypes.NewMsgSubmitProposal(proposal, deposit, from) suite.Require().NoError(err) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgSubmit) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgSubmit) } func (suite *AnteTestSuite) CreateTestEIP712GrantAllowance(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { @@ -255,7 +257,7 @@ func (suite *AnteTestSuite) CreateTestEIP712GrantAllowance(from sdk.AccAddress, grantedAddr := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, granted.Bytes()) msgGrant, err := feegrant.NewMsgGrantAllowance(basic, from, grantedAddr.GetAddress()) suite.Require().NoError(err) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgGrant) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgGrant) } func (suite *AnteTestSuite) CreateTestEIP712MsgEditValidator(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { @@ -266,7 +268,7 @@ func (suite *AnteTestSuite) CreateTestEIP712MsgEditValidator(from sdk.AccAddress nil, nil, ) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgEdit) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgEdit) } func (suite *AnteTestSuite) CreateTestEIP712MsgSubmitEvidence(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { @@ -279,12 +281,12 @@ func (suite *AnteTestSuite) CreateTestEIP712MsgSubmitEvidence(from sdk.AccAddres }) suite.Require().NoError(err) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgEvidence) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgEvidence) } func (suite *AnteTestSuite) CreateTestEIP712MsgVoteV1(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { msgVote := govtypesv1.NewMsgVote(from, 1, govtypesv1.VoteOption_VOTE_OPTION_YES, "") - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgVote) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgVote) } func (suite *AnteTestSuite) CreateTestEIP712SubmitProposalV1(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { @@ -323,20 +325,20 @@ func (suite *AnteTestSuite) CreateTestEIP712SubmitProposalV1(from sdk.AccAddress suite.Require().NoError(err) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgProposal) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgProposal) } func (suite *AnteTestSuite) CreateTestEIP712MsgExec(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { recipient := sdk.AccAddress(common.Address{}.Bytes()) msgSend := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1)))) msgExec := authz.NewMsgExec(from, []sdk.Msg{msgSend}) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, &msgExec) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, &msgExec) } func (suite *AnteTestSuite) CreateTestEIP712MultipleMsgSend(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { recipient := sdk.AccAddress(common.Address{}.Bytes()) msgSend := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1)))) - return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainID, gas, gasAmount, []sdk.Msg{msgSend, msgSend, msgSend}) + return suite.CreateTestEIP712CosmosTxBuilder(priv, chainID, gas, gasAmount, []sdk.Msg{msgSend, msgSend, msgSend}) } func (suite *AnteTestSuite) CreateTestEIP712MultipleDifferentMsgs(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { @@ -349,36 +351,36 @@ func (suite *AnteTestSuite) CreateTestEIP712MultipleDifferentMsgs(from sdk.AccAd valAddr := sdk.ValAddress(valEthAddr.Bytes()) msgDelegate := stakingtypes.NewMsgDelegate(from, valAddr, sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(20))) - return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainID, gas, gasAmount, []sdk.Msg{msgSend, msgVote, msgDelegate}) + return suite.CreateTestEIP712CosmosTxBuilder(priv, chainID, gas, gasAmount, []sdk.Msg{msgSend, msgVote, msgDelegate}) } func (suite *AnteTestSuite) CreateTestEIP712SameMsgDifferentSchemas(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { msgVote1 := govtypesv1.NewMsgVote(from, 1, govtypesv1.VoteOption_VOTE_OPTION_YES, "") msgVote2 := govtypesv1.NewMsgVote(from, 5, govtypesv1.VoteOption_VOTE_OPTION_ABSTAIN, "With Metadata") - return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainID, gas, gasAmount, []sdk.Msg{msgVote1, msgVote2}) + return suite.CreateTestEIP712CosmosTxBuilder(priv, chainID, gas, gasAmount, []sdk.Msg{msgVote1, msgVote2}) } func (suite *AnteTestSuite) CreateTestEIP712ZeroValueArray(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { recipient := sdk.AccAddress(common.Address{}.Bytes()) msgSend := banktypes.NewMsgSend(from, recipient, sdk.NewCoins()) - return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainID, gas, gasAmount, []sdk.Msg{msgSend}) + return suite.CreateTestEIP712CosmosTxBuilder(priv, chainID, gas, gasAmount, []sdk.Msg{msgSend}) } func (suite *AnteTestSuite) CreateTestEIP712ZeroValueNumber(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { msgVote := govtypesv1.NewMsgVote(from, 0, govtypesv1.VoteOption_VOTE_OPTION_NO, "") - return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainID, gas, gasAmount, []sdk.Msg{msgVote}) + return suite.CreateTestEIP712CosmosTxBuilder(priv, chainID, gas, gasAmount, []sdk.Msg{msgVote}) } func (suite *AnteTestSuite) CreateTestEIP712MsgTransfer(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { msgTransfer := suite.createMsgTransfer(from, "With Memo") - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgTransfer) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgTransfer) } func (suite *AnteTestSuite) CreateTestEIP712MsgTransferWithoutMemo(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error) { msgTransfer := suite.createMsgTransfer(from, "") - return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainID, gas, gasAmount, msgTransfer) + return suite.CreateTestEIP712SingleMessageTxBuilder(priv, chainID, gas, gasAmount, msgTransfer) } func (suite *AnteTestSuite) createMsgTransfer(from sdk.AccAddress, memo string) *ibctypes.MsgTransfer { @@ -391,7 +393,7 @@ func (suite *AnteTestSuite) CreateTestEIP712MultipleSignerMsgs(from sdk.AccAddre recipient := sdk.AccAddress(common.Address{}.Bytes()) msgSend1 := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1)))) msgSend2 := banktypes.NewMsgSend(recipient, from, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1)))) - return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainID, gas, gasAmount, []sdk.Msg{msgSend1, msgSend2}) + return suite.CreateTestEIP712CosmosTxBuilder(priv, chainID, gas, gasAmount, []sdk.Msg{msgSend1, msgSend2}) } // StdSignBytes returns the bytes to sign for a transaction. @@ -433,11 +435,10 @@ func StdSignBytes(cdc *codec.LegacyAmino, chainID string, accnum uint64, sequenc } func (suite *AnteTestSuite) CreateTestEIP712SingleMessageTxBuilder( - from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins, msg sdk.Msg, + priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins, msg sdk.Msg, ) (client.TxBuilder, error) { msgs := []sdk.Msg{msg} return suite.CreateTestEIP712CosmosTxBuilder( - from, priv, chainID, gas, @@ -447,7 +448,7 @@ func (suite *AnteTestSuite) CreateTestEIP712SingleMessageTxBuilder( } func (suite *AnteTestSuite) CreateTestEIP712CosmosTxBuilder( - from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins, msgs []sdk.Msg, + priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins, msgs []sdk.Msg, ) (client.TxBuilder, error) { txConf := suite.clientCtx.TxConfig cosmosTxArgs := utiltx.CosmosTxArgs{ diff --git a/app/upgrades/v12/upgrades.go b/app/upgrades/v12/upgrades.go index 06c3bdc452..cac48a85bf 100644 --- a/app/upgrades/v12/upgrades.go +++ b/app/upgrades/v12/upgrades.go @@ -77,8 +77,5 @@ func ReturnFundsFromCommunityPoolToAccount(ctx sdk.Context, dk distrKeeper.Keepe Amount: amount, } - if err := dk.DistributeFromFeePool(ctx, sdk.Coins{balance}, to); err != nil { - return err - } - return nil + return dk.DistributeFromFeePool(ctx, sdk.Coins{balance}, to) } diff --git a/app/upgrades/v9/upgrades.go b/app/upgrades/v9/upgrades.go index cb00c97888..5c398ffb0f 100644 --- a/app/upgrades/v9/upgrades.go +++ b/app/upgrades/v9/upgrades.go @@ -77,8 +77,5 @@ func ReturnFundsFromCommunityPoolToAccount(ctx sdk.Context, dk distrKeeper.Keepe Amount: amount, } - if err := dk.DistributeFromFeePool(ctx, sdk.Coins{balance}, to); err != nil { - return err - } - return nil + return dk.DistributeFromFeePool(ctx, sdk.Coins{balance}, to) } diff --git a/app/upgrades/v9_1/upgrades.go b/app/upgrades/v9_1/upgrades.go index f25e166e9b..2b58bb6660 100644 --- a/app/upgrades/v9_1/upgrades.go +++ b/app/upgrades/v9_1/upgrades.go @@ -95,9 +95,5 @@ func ReturnFundsFromCommunityPoolToAccount(ctx sdk.Context, dk distrKeeper.Keepe Denom: "aevmos", Amount: amount, } - - if err := dk.DistributeFromFeePool(ctx, sdk.Coins{balance}, to); err != nil { - return err - } - return nil + return dk.DistributeFromFeePool(ctx, sdk.Coins{balance}, to) } diff --git a/client/keys/add.go b/client/keys/add.go index b9d0229a94..6d077a5cbc 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -196,8 +196,8 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf // Get bip39 mnemonic var mnemonic, bip39Passphrase string - recover, _ := cmd.Flags().GetBool(flagRecover) - if recover { + recoverKey, _ := cmd.Flags().GetBool(flagRecover) + if recoverKey { mnemonic, err = input.GetString("Enter your bip39 mnemonic", inBuf) if err != nil { return err @@ -258,7 +258,7 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf } // Recover key from seed passphrase - if recover { + if recoverKey { // Hide mnemonic from output showMnemonic = false mnemonic = "" diff --git a/cmd/evmosd/init.go b/cmd/evmosd/init.go index b3bdfd09cc..06b070f5e7 100644 --- a/cmd/evmosd/init.go +++ b/cmd/evmosd/init.go @@ -117,8 +117,9 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { // Get bip39 mnemonic var mnemonic string - recover, _ := cmd.Flags().GetBool(genutilcli.FlagRecover) - if recover { + + recoverKey, _ := cmd.Flags().GetBool(genutilcli.FlagRecover) + if recoverKey { inBuf := bufio.NewReader(cmd.InOrStdin()) value, err := input.GetString("Enter your bip39 mnemonic", inBuf) if err != nil { diff --git a/ethereum/eip712/eip712_legacy.go b/ethereum/eip712/eip712_legacy.go index df44f4c0ec..84c0b498d4 100644 --- a/ethereum/eip712/eip712_legacy.go +++ b/ethereum/eip712/eip712_legacy.go @@ -358,16 +358,16 @@ func jsonNameFromTag(tag reflect.StructTag) string { // Unpack the given Any value with Type/Value deconstruction func unpackAny(cdc codectypes.AnyUnpacker, field reflect.Value) (reflect.Type, reflect.Value, error) { - any, ok := field.Interface().(*codectypes.Any) + anyData, ok := field.Interface().(*codectypes.Any) if !ok { return nil, reflect.Value{}, errorsmod.Wrapf(errortypes.ErrPackAny, "%T", field.Interface()) } anyWrapper := &cosmosAnyWrapper{ - Type: any.TypeUrl, + Type: anyData.TypeUrl, } - if err := cdc.UnpackAny(any, &anyWrapper.Value); err != nil { + if err := cdc.UnpackAny(anyData, &anyWrapper.Value); err != nil { return nil, reflect.Value{}, errorsmod.Wrap(err, "failed to unpack Any in msg struct") } diff --git a/ibc/module_test.go b/ibc/module_test.go index e48e82abbc..74d538a325 100644 --- a/ibc/module_test.go +++ b/ibc/module_test.go @@ -25,7 +25,10 @@ type MockIBCModule struct { // OnChanOpenInit implements the Module interface // It calls the underlying app's OnChanOpenInit callback. -func (m MockIBCModule) OnChanOpenInit( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnChanOpenInit( ctx sdk.Context, order channeltypes.Order, connectionHops []string, @@ -41,7 +44,10 @@ func (m MockIBCModule) OnChanOpenInit( //nolint:govet // we can copy locks here // OnChanOpenTry implements the Module interface. // It calls the underlying app's OnChanOpenTry callback. -func (m MockIBCModule) OnChanOpenTry( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnChanOpenTry( ctx sdk.Context, order channeltypes.Order, connectionHops []string, @@ -57,7 +63,10 @@ func (m MockIBCModule) OnChanOpenTry( //nolint:govet // we can copy locks here b // OnChanOpenAck implements the Module interface. // It calls the underlying app's OnChanOpenAck callback. -func (m MockIBCModule) OnChanOpenAck( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnChanOpenAck( ctx sdk.Context, portID, channelID, @@ -70,7 +79,10 @@ func (m MockIBCModule) OnChanOpenAck( //nolint:govet // we can copy locks here b // OnChanOpenConfirm implements the Module interface. // It calls the underlying app's OnChanOpenConfirm callback. -func (m MockIBCModule) OnChanOpenConfirm( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnChanOpenConfirm( ctx sdk.Context, portID, channelID string, @@ -81,7 +93,10 @@ func (m MockIBCModule) OnChanOpenConfirm( //nolint:govet // we can copy locks he // OnChanCloseInit implements the Module interface // It calls the underlying app's OnChanCloseInit callback. -func (m MockIBCModule) OnChanCloseInit( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnChanCloseInit( ctx sdk.Context, portID, channelID string, @@ -92,7 +107,10 @@ func (m MockIBCModule) OnChanCloseInit( //nolint:govet // we can copy locks here // OnChanCloseConfirm implements the Module interface. // It calls the underlying app's OnChanCloseConfirm callback. -func (m MockIBCModule) OnChanCloseConfirm( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnChanCloseConfirm( ctx sdk.Context, portID, channelID string, @@ -103,7 +121,10 @@ func (m MockIBCModule) OnChanCloseConfirm( //nolint:govet // we can copy locks h // OnRecvPacket implements the Module interface. // It calls the underlying app's OnRecvPacket callback. -func (m MockIBCModule) OnRecvPacket( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnRecvPacket( ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress, @@ -114,7 +135,10 @@ func (m MockIBCModule) OnRecvPacket( //nolint:govet // we can copy locks here be // OnAcknowledgementPacket implements the Module interface. // It calls the underlying app's OnAcknowledgementPacket callback. -func (m MockIBCModule) OnAcknowledgementPacket( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnAcknowledgementPacket( ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, @@ -126,7 +150,10 @@ func (m MockIBCModule) OnAcknowledgementPacket( //nolint:govet // we can copy lo // OnTimeoutPacket implements the Module interface. // It calls the underlying app's OnTimeoutPacket callback. -func (m MockIBCModule) OnTimeoutPacket( //nolint:govet // we can copy locks here because it is a test +// +//nolint:all // escaping govet since we can copy locks here as it is a test +// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface +func (m MockIBCModule) OnTimeoutPacket( ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress, diff --git a/ibc/testing/path.go b/ibc/testing/path.go index a0ebdae1e5..7932a7512a 100644 --- a/ibc/testing/path.go +++ b/ibc/testing/path.go @@ -58,11 +58,7 @@ func (path *Path) RelayPacket(packet channeltypes.Packet) error { return err } - if err := path.EndpointA.AcknowledgePacket(packet, ack); err != nil { - return err - } - - return nil + return path.EndpointA.AcknowledgePacket(packet, ack) } pc = path.EndpointB.Chain.App.GetIBCKeeper().ChannelKeeper.GetPacketCommitment(path.EndpointB.Chain.GetContext(), packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) @@ -83,10 +79,7 @@ func (path *Path) RelayPacket(packet channeltypes.Packet) error { return err } - if err := path.EndpointB.AcknowledgePacket(packet, ack); err != nil { - return err - } - return nil + return path.EndpointB.AcknowledgePacket(packet, ack) } return fmt.Errorf("packet commitment does not exist on either endpoint for provided packet") diff --git a/rpc/backend/client_test.go b/rpc/backend/client_test.go index aa1b7f36fd..2a5da9a093 100644 --- a/rpc/backend/client_test.go +++ b/rpc/backend/client_test.go @@ -234,7 +234,7 @@ func TestRegisterBlockResults(t *testing.T) { // BlockByHash func RegisterBlockByHash( client *mocks.Client, - hash common.Hash, + _ common.Hash, tx []byte, ) (*tmrpctypes.ResultBlock, error) { block := types.MakeBlock(1, []types.Tx{tx}, nil, nil) @@ -245,12 +245,12 @@ func RegisterBlockByHash( return resBlock, nil } -func RegisterBlockByHashError(client *mocks.Client, hash common.Hash, tx []byte) { +func RegisterBlockByHashError(client *mocks.Client, _ common.Hash, _ []byte) { client.On("BlockByHash", rpc.ContextWithHeight(1), []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). Return(nil, errortypes.ErrInvalidRequest) } -func RegisterBlockByHashNotFound(client *mocks.Client, hash common.Hash, tx []byte) { +func RegisterBlockByHashNotFound(client *mocks.Client, _ common.Hash, _ []byte) { client.On("BlockByHash", rpc.ContextWithHeight(1), []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}). Return(nil, nil) } diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index 5b3f0db35b..87b5f52100 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -249,7 +249,7 @@ func (b *Backend) ListAccounts() ([]common.Address, error) { // NewAccount will create a new account and returns the address for the new account. func (b *Backend) NewMnemonic(uid string, - language keyring.Language, + _ keyring.Language, hdPath, bip39Passphrase string, algo keyring.SignatureAlgo, diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 8f7d859766..6487475f52 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -353,22 +353,22 @@ func (e *PublicAPI) ChainId() (*hexutil.Big, error) { //nolint /////////////////////////////////////////////////////////////////////////////// // GetUncleByBlockHashAndIndex returns the uncle identified by hash and index. Always returns nil. -func (e *PublicAPI) GetUncleByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) map[string]interface{} { +func (e *PublicAPI) GetUncleByBlockHashAndIndex(_ common.Hash, _ hexutil.Uint) map[string]interface{} { return nil } // GetUncleByBlockNumberAndIndex returns the uncle identified by number and index. Always returns nil. -func (e *PublicAPI) GetUncleByBlockNumberAndIndex(number, idx hexutil.Uint) map[string]interface{} { +func (e *PublicAPI) GetUncleByBlockNumberAndIndex(_, _ hexutil.Uint) map[string]interface{} { return nil } // GetUncleCountByBlockHash returns the number of uncles in the block identified by hash. Always zero. -func (e *PublicAPI) GetUncleCountByBlockHash(hash common.Hash) hexutil.Uint { +func (e *PublicAPI) GetUncleCountByBlockHash(_ common.Hash) hexutil.Uint { return 0 } // GetUncleCountByBlockNumber returns the number of uncles in the block identified by number. Always zero. -func (e *PublicAPI) GetUncleCountByBlockNumber(blockNum rpctypes.BlockNumber) hexutil.Uint { +func (e *PublicAPI) GetUncleCountByBlockNumber(_ rpctypes.BlockNumber) hexutil.Uint { return 0 } diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go index e25dc7e5bc..1ae02b21d2 100644 --- a/rpc/namespaces/ethereum/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -107,7 +107,7 @@ const ( // Logs searches the blockchain for matching log entries, returning all from the // first block that contains matches, updating the start of the filter accordingly. -func (f *Filter) Logs(ctx context.Context, logLimit int, blockLimit int64) ([]*ethtypes.Log, error) { +func (f *Filter) Logs(_ context.Context, logLimit int, blockLimit int64) ([]*ethtypes.Log, error) { logs := []*ethtypes.Log{} var err error diff --git a/rpc/namespaces/ethereum/miner/unsupported.go b/rpc/namespaces/ethereum/miner/unsupported.go index c0eb057465..0acb828bb9 100644 --- a/rpc/namespaces/ethereum/miner/unsupported.go +++ b/rpc/namespaces/ethereum/miner/unsupported.go @@ -31,7 +31,7 @@ func (api *API) GetHashrate() uint64 { // SetExtra sets the extra data string that is included when this miner mines a block. // Unsupported in Ethermint -func (api *API) SetExtra(extra string) (bool, error) { +func (api *API) SetExtra(_ string) (bool, error) { api.logger.Debug("miner_setExtra") api.logger.Debug("Unsupported rpc function: miner_setExtra") return false, errors.New("unsupported rpc function: miner_setExtra") @@ -39,7 +39,7 @@ func (api *API) SetExtra(extra string) (bool, error) { // SetGasLimit sets the gaslimit to target towards during mining. // Unsupported in Ethermint -func (api *API) SetGasLimit(gasLimit hexutil.Uint64) bool { +func (api *API) SetGasLimit(_ hexutil.Uint64) bool { api.logger.Debug("miner_setGasLimit") api.logger.Debug("Unsupported rpc function: miner_setGasLimit") return false @@ -51,7 +51,7 @@ func (api *API) SetGasLimit(gasLimit hexutil.Uint64) bool { // number of threads allowed to use and updates the minimum price required by the // transaction pool. // Unsupported in Ethermint -func (api *API) Start(threads *int) error { +func (api *API) Start(_ *int) error { api.logger.Debug("miner_start") api.logger.Debug("Unsupported rpc function: miner_start") return errors.New("unsupported rpc function: miner_start") diff --git a/rpc/websockets.go b/rpc/websockets.go index 8cd2a8a5a3..83144ab75d 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -682,7 +682,7 @@ func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn, subID rpc.ID) return unsubFn, nil } -func (api *pubSubAPI) subscribeSyncing(wsConn *wsConn, subID rpc.ID) (pubsub.UnsubscribeFunc, error) { +func (api *pubSubAPI) subscribeSyncing(_ *wsConn, _ rpc.ID) (pubsub.UnsubscribeFunc, error) { return nil, errors.New("syncing subscription is not implemented") } diff --git a/testutil/contract.go b/testutil/contract.go index 2134347516..7fd07a3b03 100644 --- a/testutil/contract.go +++ b/testutil/contract.go @@ -75,7 +75,6 @@ func DeployContractWithFactory( evmosApp *app.Evmos, priv cryptotypes.PrivKey, factoryAddress common.Address, - queryClientEvm evm.QueryClient, ) (common.Address, abci.ResponseDeliverTx, error) { chainID := evmosApp.EvmKeeper.ChainID() from := common.BytesToAddress(priv.PubKey().Address().Bytes()) diff --git a/x/claims/keeper/hooks.go b/x/claims/keeper/hooks.go index 49f14a15ad..8053d33a7e 100644 --- a/x/claims/keeper/hooks.go +++ b/x/claims/keeper/hooks.go @@ -59,7 +59,7 @@ func (h Hooks) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr s // AfterProposalVote is called after a vote on a proposal is cast. Once the vote // is successfully included, the claimable amount for the user's claims record // vote action is claimed and the transferred to the user address. -func (k Keeper) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) { +func (k Keeper) AfterProposalVote(ctx sdk.Context, _ uint64, voterAddr sdk.AccAddress) { params := k.GetParams(ctx) claimsRecord, found := k.GetClaimsRecord(ctx, voterAddr) @@ -88,7 +88,7 @@ func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, // delegates their EVMOS tokens to a validator, the claimable amount for the // user's claims record delegation action is claimed and transferred to the user // address. -func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, _ sdk.ValAddress) error { params := k.GetParams(ctx) claimsRecord, found := k.GetClaimsRecord(ctx, delAddr) @@ -118,7 +118,7 @@ func (h Hooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *etht // After a EVM state transition is successfully processed, the claimable amount // for the users's claims record evm action is claimed and transferred to the // user address. -func (k Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (k Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, _ *ethtypes.Receipt) error { params := k.GetParams(ctx) fromAddr := sdk.AccAddress(msg.From().Bytes()) @@ -142,54 +142,55 @@ func (k Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *eth // ________________________________________________________________________________________ // governance hooks -func (h Hooks) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64) { +func (h Hooks) AfterProposalFailedMinDeposit(_ sdk.Context, _ uint64) { } -func (h Hooks) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64) { +func (h Hooks) AfterProposalVotingPeriodEnded(_ sdk.Context, _ uint64) { } -func (h Hooks) AfterProposalSubmission(ctx sdk.Context, proposalID uint64) {} +func (h Hooks) AfterProposalSubmission(_ sdk.Context, _ uint64) {} -func (h Hooks) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) { +func (h Hooks) AfterProposalDeposit(_ sdk.Context, _ uint64, _ sdk.AccAddress) { } -func (h Hooks) AfterProposalInactive(ctx sdk.Context, proposalID uint64) {} -func (h Hooks) AfterProposalActive(ctx sdk.Context, proposalID uint64) {} +func (h Hooks) AfterProposalInactive(_ sdk.Context, _ uint64) {} + +func (h Hooks) AfterProposalActive(_ sdk.Context, _ uint64) {} // staking hooks -func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorCreated(_ sdk.Context, _ sdk.ValAddress) error { return nil } -func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) error { return nil } -func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorRemoved(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { return nil } -func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { return nil } -func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { return nil } -func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { return nil } -func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { return nil } -func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { return nil } -func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { +func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.ValAddress, _ sdk.Dec) error { return nil } diff --git a/x/claims/migrations/v3/migrate_test.go b/x/claims/migrations/v3/migrate_test.go index 52192b0b7c..85be05343e 100644 --- a/x/claims/migrations/v3/migrate_test.go +++ b/x/claims/migrations/v3/migrate_test.go @@ -26,7 +26,7 @@ func newMockSubspace(ps v3types.V3Params, storeKey, transientKey storetypes.Stor return mockSubspace{ps: ps, storeKey: storeKey, transientKey: transientKey} } -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { *ps.(*v3types.V3Params) = ms.ps } diff --git a/x/claims/module.go b/x/claims/module.go index 3797e36e52..67b18a0c87 100644 --- a/x/claims/module.go +++ b/x/claims/module.go @@ -61,7 +61,7 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { } // RegisterInterfaces registers the module's interface types @@ -75,7 +75,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the claim module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -84,7 +84,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the claim module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. diff --git a/x/claims/types/msg.go b/x/claims/types/msg.go index 3f8604e768..c8e161ae3d 100644 --- a/x/claims/types/msg.go +++ b/x/claims/types/msg.go @@ -35,11 +35,7 @@ func (m *MsgUpdateParams) ValidateBasic() error { return errorsmod.Wrap(err, "invalid authority address") } - if err := m.Params.Validate(); err != nil { - return err - } - - return nil + return m.Params.Validate() } // GetSignBytes implements the LegacyMsg interface. diff --git a/x/epochs/keeper/setup_test.go b/x/epochs/keeper/setup_test.go index 4f1bf57651..7ad014a7fd 100644 --- a/x/epochs/keeper/setup_test.go +++ b/x/epochs/keeper/setup_test.go @@ -37,5 +37,5 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) + suite.DoSetupTest() } diff --git a/x/epochs/keeper/utils_test.go b/x/epochs/keeper/utils_test.go index 81190cb8ee..e7256574e7 100644 --- a/x/epochs/keeper/utils_test.go +++ b/x/epochs/keeper/utils_test.go @@ -8,11 +8,10 @@ import ( "github.com/evmos/evmos/v12/testutil" "github.com/evmos/evmos/v12/x/epochs/types" evm "github.com/evmos/evmos/v12/x/evm/types" - "github.com/stretchr/testify/require" ) // Test helpers -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { +func (suite *KeeperTestSuite) DoSetupTest() { checkTx := false // init app diff --git a/x/epochs/module.go b/x/epochs/module.go index 48f1c0bdd2..100be2c067 100644 --- a/x/epochs/module.go +++ b/x/epochs/module.go @@ -66,7 +66,7 @@ func (AppModuleBasic) Name() string { } // RegisterLegacyAminoCodec registers a legacy amino codec -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} // RegisterInterfaces registers the module's interface types func (AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {} @@ -77,7 +77,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the epochs module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -86,7 +86,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the epochs module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { @@ -144,7 +144,7 @@ func (am AppModule) Route() sdk.Route { func (AppModule) QuerierRoute() string { return "" } // LegacyQuerierHandler returns the epochs module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -181,7 +181,7 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { // EndBlock executes all ABCI EndBlock logic respective to the epochs module. It // returns no validator updates. -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } @@ -190,24 +190,24 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val // AppModuleSimulation functions // GenerateGenesisState creates a randomized GenState of theepochs module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) {} +func (AppModule) GenerateGenesisState(_ *module.SimulationState) {} // ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return []simtypes.WeightedProposalContent{} } // RandomizedParams creates randomizedepochs param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{} } // RegisterStoreDecoder registers a decoder for supply module's types -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } // WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return []simtypes.WeightedOperation{} } diff --git a/x/epochs/types/identifier.go b/x/epochs/types/identifier.go index 37b6201594..39c05cec78 100644 --- a/x/epochs/types/identifier.go +++ b/x/epochs/types/identifier.go @@ -37,11 +37,8 @@ func ValidateEpochIdentifierInterface(i interface{}) error { if !ok { return fmt.Errorf("invalid parameter type: %T", i) } - if err := ValidateEpochIdentifierString(v); err != nil { - return err - } - return nil + return ValidateEpochIdentifierString(v) } // ValidateEpochIdentifierInterface performs a stateless diff --git a/x/erc20/keeper/evm_hooks.go b/x/erc20/keeper/evm_hooks.go index 65222ca839..d8b36f3bbc 100644 --- a/x/erc20/keeper/evm_hooks.go +++ b/x/erc20/keeper/evm_hooks.go @@ -61,7 +61,7 @@ func (h Hooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *etht // `ConvertERC20` msg does not trigger the hook as it only calls `ApplyMessage`. func (k Keeper) PostTxProcessing( ctx sdk.Context, - msg core.Message, + _ core.Message, receipt *ethtypes.Receipt, ) error { params := k.GetParams(ctx) diff --git a/x/erc20/keeper/grpc_query_test.go b/x/erc20/keeper/grpc_query_test.go index 4ec5d17553..b18910972e 100644 --- a/x/erc20/keeper/grpc_query_test.go +++ b/x/erc20/keeper/grpc_query_test.go @@ -35,7 +35,7 @@ func (suite *KeeperTestSuite) TestTokenPairs() { req = &types.QueryTokenPairsRequest{ Pagination: &query.PageRequest{Limit: 10, CountTotal: true}, } - pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", true, types.OWNER_MODULE) + pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) expRes = &types.QueryTokenPairsResponse{ @@ -49,8 +49,8 @@ func (suite *KeeperTestSuite) TestTokenPairs() { "2 pairs registered wo/pagination", func() { req = &types.QueryTokenPairsRequest{} - pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", true, types.OWNER_MODULE) - pair2 := types.NewTokenPair(utiltx.GenerateAddress(), "coin2", true, types.OWNER_MODULE) + pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) + pair2 := types.NewTokenPair(utiltx.GenerateAddress(), "coin2", types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair2) @@ -114,7 +114,7 @@ func (suite *KeeperTestSuite) TestTokenPair() { "token pair found", func() { addr := utiltx.GenerateAddress() - pair := types.NewTokenPair(addr, "coin", true, types.OWNER_MODULE) + pair := types.NewTokenPair(addr, "coin", types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) suite.app.Erc20Keeper.SetERC20Map(suite.ctx, addr, pair.GetID()) suite.app.Erc20Keeper.SetDenomMap(suite.ctx, pair.Denom, pair.GetID()) @@ -130,7 +130,7 @@ func (suite *KeeperTestSuite) TestTokenPair() { "token pair not found - with erc20 existent", func() { addr := utiltx.GenerateAddress() - pair := types.NewTokenPair(addr, "coin", true, types.OWNER_MODULE) + pair := types.NewTokenPair(addr, "coin", types.OWNER_MODULE) suite.app.Erc20Keeper.SetERC20Map(suite.ctx, addr, pair.GetID()) suite.app.Erc20Keeper.SetDenomMap(suite.ctx, pair.Denom, pair.GetID()) diff --git a/x/erc20/keeper/migrations_test.go b/x/erc20/keeper/migrations_test.go index df7f23ce68..06544bde20 100644 --- a/x/erc20/keeper/migrations_test.go +++ b/x/erc20/keeper/migrations_test.go @@ -24,7 +24,7 @@ func newMockSubspace(ps v3types.V3Params, storeKey, transientKey storetypes.Stor return mockSubspace{ps: ps, storeKey: storeKey, transientKey: transientKey} } -func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSet(_ sdk.Context, ps types.LegacyParams) { *ps.(*v3types.V3Params) = ms.ps } diff --git a/x/erc20/keeper/mint_test.go b/x/erc20/keeper/mint_test.go index 4c4cc7d76e..b34e0456fd 100644 --- a/x/erc20/keeper/mint_test.go +++ b/x/erc20/keeper/mint_test.go @@ -13,7 +13,7 @@ import ( func (suite *KeeperTestSuite) TestMintingEnabled() { sender := sdk.AccAddress(utiltx.GenerateAddress().Bytes()) receiver := sdk.AccAddress(utiltx.GenerateAddress().Bytes()) - expPair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", true, types.OWNER_MODULE) + expPair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) id := expPair.GetID() testCases := []struct { diff --git a/x/erc20/keeper/mock_test.go b/x/erc20/keeper/mock_test.go index 936ce48525..9c30b223ec 100644 --- a/x/erc20/keeper/mock_test.go +++ b/x/erc20/keeper/mock_test.go @@ -20,12 +20,12 @@ type MockEVMKeeper struct { mock.Mock } -func (m *MockEVMKeeper) GetParams(ctx sdk.Context) evm.Params { +func (m *MockEVMKeeper) GetParams(_ sdk.Context) evm.Params { args := m.Called(mock.Anything) return args.Get(0).(evm.Params) } -func (m *MockEVMKeeper) GetAccountWithoutBalance(ctx sdk.Context, addr common.Address) *statedb.Account { +func (m *MockEVMKeeper) GetAccountWithoutBalance(_ sdk.Context, _ common.Address) *statedb.Account { args := m.Called(mock.Anything, mock.Anything) if args.Get(0) == nil { return nil @@ -33,7 +33,7 @@ func (m *MockEVMKeeper) GetAccountWithoutBalance(ctx sdk.Context, addr common.Ad return args.Get(0).(*statedb.Account) } -func (m *MockEVMKeeper) EstimateGas(c context.Context, req *evm.EthCallRequest) (*evm.EstimateGasResponse, error) { +func (m *MockEVMKeeper) EstimateGas(_ context.Context, _ *evm.EthCallRequest) (*evm.EstimateGasResponse, error) { args := m.Called(mock.Anything, mock.Anything) if args.Get(0) == nil { return nil, args.Error(1) @@ -41,7 +41,7 @@ func (m *MockEVMKeeper) EstimateGas(c context.Context, req *evm.EthCallRequest) return args.Get(0).(*evm.EstimateGasResponse), args.Error(1) } -func (m *MockEVMKeeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*evm.MsgEthereumTxResponse, error) { +func (m *MockEVMKeeper) ApplyMessage(_ sdk.Context, _ core.Message, _ vm.EVMLogger, _ bool) (*evm.MsgEthereumTxResponse, error) { args := m.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) if args.Get(0) == nil { @@ -56,50 +56,51 @@ type MockBankKeeper struct { mock.Mock } -func (b *MockBankKeeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error { +func (b *MockBankKeeper) SendCoinsFromModuleToAccount(_ sdk.Context, _ string, _ sdk.AccAddress, _ sdk.Coins) error { args := b.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) return args.Error(0) } -func (b *MockBankKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { +func (b *MockBankKeeper) SendCoinsFromAccountToModule(_ sdk.Context, _ sdk.AccAddress, _ string, _ sdk.Coins) error { args := b.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) return args.Error(0) } -func (b *MockBankKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { +func (b *MockBankKeeper) MintCoins(_ sdk.Context, _ string, _ sdk.Coins) error { args := b.Called(mock.Anything, mock.Anything, mock.Anything) return args.Error(0) } -func (b *MockBankKeeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { +func (b *MockBankKeeper) BurnCoins(_ sdk.Context, _ string, _ sdk.Coins) error { args := b.Called(mock.Anything, mock.Anything, mock.Anything) return args.Error(0) } -func (b *MockBankKeeper) IsSendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool { +func (b *MockBankKeeper) IsSendEnabledCoin(_ sdk.Context, _ sdk.Coin) bool { args := b.Called(mock.Anything, mock.Anything) return args.Bool(0) } -func (b *MockBankKeeper) BlockedAddr(addr sdk.AccAddress) bool { +func (b *MockBankKeeper) BlockedAddr(_ sdk.AccAddress) bool { args := b.Called(mock.Anything) return args.Bool(0) } +//nolint:all func (b *MockBankKeeper) GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) { args := b.Called(mock.Anything, mock.Anything) return args.Get(0).(banktypes.Metadata), args.Bool(1) } -func (b *MockBankKeeper) SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) { +func (b *MockBankKeeper) SetDenomMetaData(_ sdk.Context, _ banktypes.Metadata) { } -func (b *MockBankKeeper) HasSupply(ctx sdk.Context, denom string) bool { +func (b *MockBankKeeper) HasSupply(_ sdk.Context, _ string) bool { args := b.Called(mock.Anything, mock.Anything) return args.Bool(0) } -func (b *MockBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin { +func (b *MockBankKeeper) GetBalance(_ sdk.Context, _ sdk.AccAddress, _ string) sdk.Coin { args := b.Called(mock.Anything, mock.Anything) return args.Get(0).(sdk.Coin) } diff --git a/x/erc20/keeper/proposals.go b/x/erc20/keeper/proposals.go index e8bfdb785d..1278e000c9 100644 --- a/x/erc20/keeper/proposals.go +++ b/x/erc20/keeper/proposals.go @@ -59,7 +59,7 @@ func (k Keeper) RegisterCoin( ) } - pair := types.NewTokenPair(addr, coinMetadata.Base, true, types.OWNER_MODULE) + pair := types.NewTokenPair(addr, coinMetadata.Base, types.OWNER_MODULE) k.SetTokenPair(ctx, pair) k.SetDenomMap(ctx, pair.Denom, pair.GetID()) k.SetERC20Map(ctx, common.HexToAddress(pair.Erc20Address), pair.GetID()) @@ -87,7 +87,7 @@ func (k Keeper) RegisterERC20( ) } - pair := types.NewTokenPair(contract, metadata.Name, true, types.OWNER_EXTERNAL) + pair := types.NewTokenPair(contract, metadata.Name, types.OWNER_EXTERNAL) k.SetTokenPair(ctx, pair) k.SetDenomMap(ctx, pair.Denom, pair.GetID()) k.SetERC20Map(ctx, common.HexToAddress(pair.Erc20Address), pair.GetID()) diff --git a/x/erc20/keeper/proposals_test.go b/x/erc20/keeper/proposals_test.go index a0f482f066..4b0b2d6265 100644 --- a/x/erc20/keeper/proposals_test.go +++ b/x/erc20/keeper/proposals_test.go @@ -144,7 +144,7 @@ func (suite KeeperTestSuite) TestRegisterCoin() { //nolint:govet // we can copy { "denom already registered", func() { - regPair := types.NewTokenPair(utiltx.GenerateAddress(), metadata.Base, true, types.OWNER_MODULE) + regPair := types.NewTokenPair(utiltx.GenerateAddress(), metadata.Base, types.OWNER_MODULE) suite.app.Erc20Keeper.SetDenomMap(suite.ctx, regPair.Denom, regPair.GetID()) suite.Commit() }, @@ -313,7 +313,7 @@ func (suite KeeperTestSuite) TestRegisterERC20() { //nolint:govet // we can copy suite.Require().NoError(err) coinName := types.CreateDenom(contractAddr.String()) - pair = types.NewTokenPair(contractAddr, coinName, true, types.OWNER_EXTERNAL) + pair = types.NewTokenPair(contractAddr, coinName, types.OWNER_EXTERNAL) tc.malleate() @@ -360,7 +360,7 @@ func (suite KeeperTestSuite) TestToggleConverision() { //nolint:govet // we can contractAddr, err := suite.DeployContract(erc20Name, erc20Symbol, erc20Decimals) suite.Require().NoError(err) suite.Commit() - pair = types.NewTokenPair(contractAddr, cosmosTokenBase, true, types.OWNER_MODULE) + pair = types.NewTokenPair(contractAddr, cosmosTokenBase, types.OWNER_MODULE) }, false, false, @@ -371,7 +371,7 @@ func (suite KeeperTestSuite) TestToggleConverision() { //nolint:govet // we can contractAddr, err := suite.DeployContract(erc20Name, erc20Symbol, erc20Decimals) suite.Require().NoError(err) suite.Commit() - pair = types.NewTokenPair(contractAddr, cosmosTokenBase, true, types.OWNER_MODULE) + pair = types.NewTokenPair(contractAddr, cosmosTokenBase, types.OWNER_MODULE) suite.app.Erc20Keeper.SetERC20Map(suite.ctx, common.HexToAddress(pair.Erc20Address), pair.GetID()) }, false, diff --git a/x/erc20/keeper/token_pairs_test.go b/x/erc20/keeper/token_pairs_test.go index e45f47d150..f2a07386b3 100644 --- a/x/erc20/keeper/token_pairs_test.go +++ b/x/erc20/keeper/token_pairs_test.go @@ -23,7 +23,7 @@ func (suite *KeeperTestSuite) TestGetTokenPairs() { { "1 pair registered", func() { - pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", true, types.OWNER_MODULE) + pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) expRes = []types.TokenPair{pair} @@ -32,8 +32,8 @@ func (suite *KeeperTestSuite) TestGetTokenPairs() { { "2 pairs registered", func() { - pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", true, types.OWNER_MODULE) - pair2 := types.NewTokenPair(utiltx.GenerateAddress(), "coin2", true, types.OWNER_MODULE) + pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) + pair2 := types.NewTokenPair(utiltx.GenerateAddress(), "coin2", types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair2) @@ -54,7 +54,7 @@ func (suite *KeeperTestSuite) TestGetTokenPairs() { } func (suite *KeeperTestSuite) TestGetTokenPairID() { - pair := types.NewTokenPair(utiltx.GenerateAddress(), evmtypes.DefaultEVMDenom, true, types.OWNER_MODULE) + pair := types.NewTokenPair(utiltx.GenerateAddress(), evmtypes.DefaultEVMDenom, types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) testCases := []struct { @@ -77,7 +77,7 @@ func (suite *KeeperTestSuite) TestGetTokenPairID() { } func (suite *KeeperTestSuite) TestGetTokenPair() { - pair := types.NewTokenPair(utiltx.GenerateAddress(), evmtypes.DefaultEVMDenom, true, types.OWNER_MODULE) + pair := types.NewTokenPair(utiltx.GenerateAddress(), evmtypes.DefaultEVMDenom, types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) testCases := []struct { @@ -101,7 +101,7 @@ func (suite *KeeperTestSuite) TestGetTokenPair() { } func (suite *KeeperTestSuite) TestDeleteTokenPair() { - pair := types.NewTokenPair(utiltx.GenerateAddress(), evmtypes.DefaultEVMDenom, true, types.OWNER_MODULE) + pair := types.NewTokenPair(utiltx.GenerateAddress(), evmtypes.DefaultEVMDenom, types.OWNER_MODULE) id := pair.GetID() suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) suite.app.Erc20Keeper.SetERC20Map(suite.ctx, pair.GetERC20Contract(), id) @@ -138,7 +138,7 @@ func (suite *KeeperTestSuite) TestDeleteTokenPair() { } func (suite *KeeperTestSuite) TestIsTokenPairRegistered() { - pair := types.NewTokenPair(utiltx.GenerateAddress(), evmtypes.DefaultEVMDenom, true, types.OWNER_MODULE) + pair := types.NewTokenPair(utiltx.GenerateAddress(), evmtypes.DefaultEVMDenom, types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) testCases := []struct { @@ -161,7 +161,7 @@ func (suite *KeeperTestSuite) TestIsTokenPairRegistered() { func (suite *KeeperTestSuite) TestIsERC20Registered() { addr := utiltx.GenerateAddress() - pair := types.NewTokenPair(addr, "coin", true, types.OWNER_MODULE) + pair := types.NewTokenPair(addr, "coin", types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) suite.app.Erc20Keeper.SetERC20Map(suite.ctx, addr, pair.GetID()) suite.app.Erc20Keeper.SetDenomMap(suite.ctx, pair.Denom, pair.GetID()) @@ -198,7 +198,7 @@ func (suite *KeeperTestSuite) TestIsERC20Registered() { func (suite *KeeperTestSuite) TestIsDenomRegistered() { addr := utiltx.GenerateAddress() - pair := types.NewTokenPair(addr, "coin", true, types.OWNER_MODULE) + pair := types.NewTokenPair(addr, "coin", types.OWNER_MODULE) suite.app.Erc20Keeper.SetTokenPair(suite.ctx, pair) suite.app.Erc20Keeper.SetERC20Map(suite.ctx, addr, pair.GetID()) suite.app.Erc20Keeper.SetDenomMap(suite.ctx, pair.Denom, pair.GetID()) diff --git a/x/erc20/migrations/v3/migration_test.go b/x/erc20/migrations/v3/migration_test.go index 54c5b28918..c6a7b864f9 100644 --- a/x/erc20/migrations/v3/migration_test.go +++ b/x/erc20/migrations/v3/migration_test.go @@ -28,7 +28,7 @@ func newMockSubspace(ps v3types.V3Params, storeKey, transientKey storetypes.Stor return mockSubspace{ps: ps, storeKey: storeKey, transientKey: transientKey} } -func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSet(_ sdk.Context, ps types.LegacyParams) { *ps.(*v3types.V3Params) = ms.ps } diff --git a/x/erc20/module.go b/x/erc20/module.go index 03f889470c..128ecf3675 100644 --- a/x/erc20/module.go +++ b/x/erc20/module.go @@ -74,7 +74,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesisState()) } -func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genesisState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -129,7 +129,7 @@ func (AppModule) Name() string { return types.ModuleName } -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} func (am AppModule) NewHandler() sdk.Handler { return NewHandler(&am.keeper) @@ -143,7 +143,7 @@ func (am AppModule) QuerierRoute() string { return types.RouterKey } -func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -182,20 +182,20 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(gs) } -func (am AppModule) GenerateGenesisState(input *module.SimulationState) { +func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { } -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return []simtypes.WeightedProposalContent{} } -func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{} } -func (am AppModule) RegisterStoreDecoder(decoderRegistry sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return []simtypes.WeightedOperation{} } diff --git a/x/erc20/types/msg.go b/x/erc20/types/msg.go index 1bd7d306b7..bc286d4521 100644 --- a/x/erc20/types/msg.go +++ b/x/erc20/types/msg.go @@ -141,11 +141,7 @@ func (m *MsgUpdateParams) ValidateBasic() error { return errorsmod.Wrap(err, "Invalid authority address") } - if err := m.Params.Validate(); err != nil { - return err - } - - return nil + return m.Params.Validate() } // GetSignBytes implements the LegacyMsg interface. diff --git a/x/erc20/types/token_pair.go b/x/erc20/types/token_pair.go index fdf475de28..f6b8850f32 100644 --- a/x/erc20/types/token_pair.go +++ b/x/erc20/types/token_pair.go @@ -24,7 +24,7 @@ import ( ) // NewTokenPair returns an instance of TokenPair -func NewTokenPair(erc20Address common.Address, denom string, enabled bool, contractOwner Owner) TokenPair { +func NewTokenPair(erc20Address common.Address, denom string, contractOwner Owner) TokenPair { return TokenPair{ Erc20Address: erc20Address.String(), Denom: denom, @@ -50,11 +50,7 @@ func (tp TokenPair) Validate() error { return err } - if err := evmostypes.ValidateAddress(tp.Erc20Address); err != nil { - return err - } - - return nil + return evmostypes.ValidateAddress(tp.Erc20Address) } // IsNativeCoin returns true if the owner of the ERC20 contract is the diff --git a/x/erc20/types/token_pair_test.go b/x/erc20/types/token_pair_test.go index 74dd0c2c91..e1ba4d9c83 100644 --- a/x/erc20/types/token_pair_test.go +++ b/x/erc20/types/token_pair_test.go @@ -24,24 +24,23 @@ func (suite *TokenPairTestSuite) TestTokenPairNew() { msg string erc20Address common.Address denom string - enabled bool owner types.Owner expectPass bool }{ - {msg: "Register token pair - invalid starts with number", erc20Address: utiltx.GenerateAddress(), denom: "1test", enabled: true, owner: types.OWNER_MODULE, expectPass: false}, - {msg: "Register token pair - invalid char '('", erc20Address: utiltx.GenerateAddress(), denom: "(test", enabled: true, owner: types.OWNER_MODULE, expectPass: false}, - {msg: "Register token pair - invalid char '^'", erc20Address: utiltx.GenerateAddress(), denom: "^test", enabled: true, owner: types.OWNER_MODULE, expectPass: false}, + {msg: "Register token pair - invalid starts with number", erc20Address: utiltx.GenerateAddress(), denom: "1test", owner: types.OWNER_MODULE, expectPass: false}, + {msg: "Register token pair - invalid char '('", erc20Address: utiltx.GenerateAddress(), denom: "(test", owner: types.OWNER_MODULE, expectPass: false}, + {msg: "Register token pair - invalid char '^'", erc20Address: utiltx.GenerateAddress(), denom: "^test", owner: types.OWNER_MODULE, expectPass: false}, // TODO: (guille) should the "\" be allowed to support unicode names? - {msg: "Register token pair - invalid char '\\'", erc20Address: utiltx.GenerateAddress(), denom: "-test", enabled: true, owner: types.OWNER_MODULE, expectPass: false}, + {msg: "Register token pair - invalid char '\\'", erc20Address: utiltx.GenerateAddress(), denom: "-test", owner: types.OWNER_MODULE, expectPass: false}, // Invalid length - {msg: "Register token pair - invalid length token (0)", erc20Address: utiltx.GenerateAddress(), denom: "", enabled: true, owner: types.OWNER_MODULE, expectPass: false}, - {msg: "Register token pair - invalid length token (1)", erc20Address: utiltx.GenerateAddress(), denom: "a", enabled: true, owner: types.OWNER_MODULE, expectPass: false}, - {msg: "Register token pair - invalid length token (128)", erc20Address: utiltx.GenerateAddress(), denom: strings.Repeat("a", 129), enabled: true, owner: types.OWNER_MODULE, expectPass: false}, - {msg: "Register token pair - pass", erc20Address: utiltx.GenerateAddress(), denom: "test", enabled: true, owner: types.OWNER_MODULE, expectPass: true}, + {msg: "Register token pair - invalid length token (0)", erc20Address: utiltx.GenerateAddress(), denom: "", owner: types.OWNER_MODULE, expectPass: false}, + {msg: "Register token pair - invalid length token (1)", erc20Address: utiltx.GenerateAddress(), denom: "a", owner: types.OWNER_MODULE, expectPass: false}, + {msg: "Register token pair - invalid length token (128)", erc20Address: utiltx.GenerateAddress(), denom: strings.Repeat("a", 129), owner: types.OWNER_MODULE, expectPass: false}, + {msg: "Register token pair - pass", erc20Address: utiltx.GenerateAddress(), denom: "test", owner: types.OWNER_MODULE, expectPass: true}, } for i, tc := range testCases { - tp := types.NewTokenPair(tc.erc20Address, tc.denom, tc.enabled, tc.owner) + tp := types.NewTokenPair(tc.erc20Address, tc.denom, tc.owner) err := tp.Validate() if tc.expectPass { @@ -78,7 +77,7 @@ func (suite *TokenPairTestSuite) TestTokenPair() { func (suite *TokenPairTestSuite) TestGetID() { addr := utiltx.GenerateAddress() denom := "test" - pair := types.NewTokenPair(addr, denom, true, types.OWNER_MODULE) + pair := types.NewTokenPair(addr, denom, types.OWNER_MODULE) id := pair.GetID() expID := tmhash.Sum([]byte(addr.String() + "|" + denom)) suite.Require().Equal(expID, id) @@ -87,7 +86,7 @@ func (suite *TokenPairTestSuite) TestGetID() { func (suite *TokenPairTestSuite) TestGetERC20Contract() { expAddr := utiltx.GenerateAddress() denom := "test" - pair := types.NewTokenPair(expAddr, denom, true, types.OWNER_MODULE) + pair := types.NewTokenPair(expAddr, denom, types.OWNER_MODULE) addr := pair.GetERC20Contract() suite.Require().Equal(expAddr, addr) } diff --git a/x/evm/handler_test.go b/x/evm/handler_test.go index e5f37b5c26..cf5dbcffa5 100644 --- a/x/evm/handler_test.go +++ b/x/evm/handler_test.go @@ -545,6 +545,7 @@ func (suite *EvmTestSuite) TestOutOfGasWhenDeployContract() { suite.SignTx(tx) defer func() { + //nolint:revive // allow empty code block that just contains TODO in test code if r := recover(); r != nil { // TODO: snapshotting logic } else { @@ -766,13 +767,13 @@ func (suite *EvmTestSuite) TestContractDeploymentRevert() { // DummyHook implements EvmHooks interface type DummyHook struct{} -func (dh *DummyHook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (dh *DummyHook) PostTxProcessing(_ sdk.Context, _ core.Message, _ *ethtypes.Receipt) error { return nil } // FailureHook implements EvmHooks interface type FailureHook struct{} -func (dh *FailureHook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (dh *FailureHook) PostTxProcessing(_ sdk.Context, _ core.Message, _ *ethtypes.Receipt) error { return errors.New("mock error") } diff --git a/x/evm/keeper/abci.go b/x/evm/keeper/abci.go index 3e54b009aa..6d44651989 100644 --- a/x/evm/keeper/abci.go +++ b/x/evm/keeper/abci.go @@ -24,14 +24,14 @@ import ( ) // BeginBlock sets the sdk Context and EIP155 chain id to the Keeper. -func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (k *Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { k.WithChainID(ctx) } // EndBlock also retrieves the bloom filter value from the transient store and commits it to the // KVStore. The EVM end block logic doesn't update the validator set, thus it returns // an empty slice. -func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { +func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { // Gas costs are handled within msg handler so costs should be ignored infCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) diff --git a/x/evm/keeper/config.go b/x/evm/keeper/config.go index 9f25cd9b6e..5d7c645c6d 100644 --- a/x/evm/keeper/config.go +++ b/x/evm/keeper/config.go @@ -59,7 +59,7 @@ func (k *Keeper) TxConfig(ctx sdk.Context, txHash common.Hash) statedb.TxConfig // VMConfig creates an EVM configuration from the debug setting and the extra EIPs enabled on the // module parameters. The config generated uses the default JumpTable from the EVM. -func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger) vm.Config { +func (k Keeper) VMConfig(ctx sdk.Context, _ core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger) vm.Config { noBaseFee := true if types.IsLondon(cfg.ChainConfig, ctx.BlockHeight()) { noBaseFee = k.feeMarketKeeper.GetParams(ctx).NoBaseFee diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 20429bb2cc..d3e58b4a56 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -290,9 +290,9 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type // Binary search the gas requirement, as it may be higher than the amount used var ( - lo = ethparams.TxGas - 1 - hi uint64 - cap uint64 + lo = ethparams.TxGas - 1 + hi uint64 + gasCap uint64 ) // Determine the highest gas limit can be used during the estimation. @@ -314,7 +314,8 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type if req.GasCap != 0 && hi > req.GasCap { hi = req.GasCap } - cap = hi + + gasCap = hi cfg, err := k.EVMConfig(ctx, GetProposerAddress(ctx, req.ProposerAddress), chainID) if err != nil { return nil, status.Error(codes.Internal, "failed to load evm config") @@ -370,7 +371,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type } // Reject the transaction as invalid if it still fails at the highest allowance - if hi == cap { + if hi == gasCap { failed, result, err := executable(hi) if err != nil { return nil, err @@ -384,7 +385,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type return nil, errors.New(result.VmError) } // Otherwise, the specified gas cap is too low - return nil, fmt.Errorf("gas required exceeds allowance (%d)", cap) + return nil, fmt.Errorf("gas required exceeds allowance (%d)", gasCap) } } return &types.EstimateGasResponse{Gas: hi}, nil diff --git a/x/evm/keeper/hooks_test.go b/x/evm/keeper/hooks_test.go index 964e29d670..ebe520b62d 100644 --- a/x/evm/keeper/hooks_test.go +++ b/x/evm/keeper/hooks_test.go @@ -19,7 +19,7 @@ type LogRecordHook struct { Logs []*ethtypes.Log } -func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (dh *LogRecordHook) PostTxProcessing(_ sdk.Context, _ core.Message, receipt *ethtypes.Receipt) error { dh.Logs = receipt.Logs return nil } @@ -27,7 +27,7 @@ func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, msg core.Message, rec // FailureHook always fail type FailureHook struct{} -func (dh FailureHook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (dh FailureHook) PostTxProcessing(_ sdk.Context, _ core.Message, _ *ethtypes.Receipt) error { return errors.New("post tx processing failed") } diff --git a/x/evm/migrations/v4/migrate_test.go b/x/evm/migrations/v4/migrate_test.go index 3c89c09a59..c4275716fa 100644 --- a/x/evm/migrations/v4/migrate_test.go +++ b/x/evm/migrations/v4/migrate_test.go @@ -38,7 +38,7 @@ func newMockSubspace(ps types.Params) mockSubspace { return mockSubspace{ps: ps} } -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { *ps.(*types.Params) = ms.ps } diff --git a/x/evm/statedb/mock_test.go b/x/evm/statedb/mock_test.go index e4e0f3a7fc..a8b69200d0 100644 --- a/x/evm/statedb/mock_test.go +++ b/x/evm/statedb/mock_test.go @@ -34,7 +34,7 @@ func NewMockKeeper() *MockKeeper { } } -func (k MockKeeper) GetAccount(ctx sdk.Context, addr common.Address) *statedb.Account { +func (k MockKeeper) GetAccount(_ sdk.Context, addr common.Address) *statedb.Account { acct, ok := k.accounts[addr] if !ok { return nil @@ -42,15 +42,15 @@ func (k MockKeeper) GetAccount(ctx sdk.Context, addr common.Address) *statedb.Ac return &acct.account } -func (k MockKeeper) GetState(ctx sdk.Context, addr common.Address, key common.Hash) common.Hash { +func (k MockKeeper) GetState(_ sdk.Context, addr common.Address, key common.Hash) common.Hash { return k.accounts[addr].states[key] } -func (k MockKeeper) GetCode(ctx sdk.Context, codeHash common.Hash) []byte { +func (k MockKeeper) GetCode(_ sdk.Context, codeHash common.Hash) []byte { return k.codes[codeHash] } -func (k MockKeeper) ForEachStorage(ctx sdk.Context, addr common.Address, cb func(key, value common.Hash) bool) { +func (k MockKeeper) ForEachStorage(_ sdk.Context, addr common.Address, cb func(key, value common.Hash) bool) { if acct, ok := k.accounts[addr]; ok { for k, v := range acct.states { if !cb(k, v) { @@ -60,7 +60,7 @@ func (k MockKeeper) ForEachStorage(ctx sdk.Context, addr common.Address, cb func } } -func (k MockKeeper) SetAccount(ctx sdk.Context, addr common.Address, account statedb.Account) error { +func (k MockKeeper) SetAccount(_ sdk.Context, addr common.Address, account statedb.Account) error { if addr == errAddress { return errors.New("mock db error") } @@ -75,7 +75,7 @@ func (k MockKeeper) SetAccount(ctx sdk.Context, addr common.Address, account sta return nil } -func (k MockKeeper) SetState(ctx sdk.Context, addr common.Address, key common.Hash, value []byte) { +func (k MockKeeper) SetState(_ sdk.Context, addr common.Address, key common.Hash, value []byte) { if acct, ok := k.accounts[addr]; ok { if len(value) == 0 { delete(acct.states, key) @@ -85,11 +85,11 @@ func (k MockKeeper) SetState(ctx sdk.Context, addr common.Address, key common.Ha } } -func (k MockKeeper) SetCode(ctx sdk.Context, codeHash []byte, code []byte) { +func (k MockKeeper) SetCode(_ sdk.Context, codeHash []byte, code []byte) { k.codes[common.BytesToHash(codeHash)] = code } -func (k MockKeeper) DeleteAccount(ctx sdk.Context, addr common.Address) error { +func (k MockKeeper) DeleteAccount(_ sdk.Context, addr common.Address) error { if addr == errAddress { return errors.New("mock db error") } diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index a458bd3ee8..cba121eb0c 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -217,7 +217,7 @@ func (s *StateDB) HasSuicided(addr common.Address) bool { // AddPreimage performs a no-op since the EnablePreimageRecording flag is disabled // on the vm.Config during state transitions. No store trie preimages are written // to the database. -func (s *StateDB) AddPreimage(hash common.Hash, preimage []byte) {} +func (s *StateDB) AddPreimage(_ common.Hash, _ []byte) {} // getStateObject retrieves a state object given by the address, returning nil if // the object is not found. diff --git a/x/evm/types/access_list_tx.go b/x/evm/types/access_list_tx.go index 59f6510def..93775c0e18 100644 --- a/x/evm/types/access_list_tx.go +++ b/x/evm/types/access_list_tx.go @@ -258,16 +258,16 @@ func (tx AccessListTx) Cost() *big.Int { } // EffectiveGasPrice is the same as GasPrice for AccessListTx -func (tx AccessListTx) EffectiveGasPrice(baseFee *big.Int) *big.Int { +func (tx AccessListTx) EffectiveGasPrice(_ *big.Int) *big.Int { return tx.GetGasPrice() } // EffectiveFee is the same as Fee for AccessListTx -func (tx AccessListTx) EffectiveFee(baseFee *big.Int) *big.Int { +func (tx AccessListTx) EffectiveFee(_ *big.Int) *big.Int { return tx.Fee() } // EffectiveCost is the same as Cost for AccessListTx -func (tx AccessListTx) EffectiveCost(baseFee *big.Int) *big.Int { +func (tx AccessListTx) EffectiveCost(_ *big.Int) *big.Int { return tx.Cost() } diff --git a/x/evm/types/legacy_tx.go b/x/evm/types/legacy_tx.go index 1cc44b353a..b3889c98ee 100644 --- a/x/evm/types/legacy_tx.go +++ b/x/evm/types/legacy_tx.go @@ -235,16 +235,16 @@ func (tx LegacyTx) Cost() *big.Int { } // EffectiveGasPrice is the same as GasPrice for LegacyTx -func (tx LegacyTx) EffectiveGasPrice(baseFee *big.Int) *big.Int { +func (tx LegacyTx) EffectiveGasPrice(_ *big.Int) *big.Int { return tx.GetGasPrice() } // EffectiveFee is the same as Fee for LegacyTx -func (tx LegacyTx) EffectiveFee(baseFee *big.Int) *big.Int { +func (tx LegacyTx) EffectiveFee(_ *big.Int) *big.Int { return tx.Fee() } // EffectiveCost is the same as Cost for LegacyTx -func (tx LegacyTx) EffectiveCost(baseFee *big.Int) *big.Int { +func (tx LegacyTx) EffectiveCost(_ *big.Int) *big.Int { return tx.Cost() } diff --git a/x/evm/types/tracer.go b/x/evm/types/tracer.go index f636390392..d13cb5580b 100644 --- a/x/evm/types/tracer.go +++ b/x/evm/types/tracer.go @@ -75,6 +75,8 @@ func NewNoOpTracer() *NoOpTracer { } // CaptureStart implements vm.Tracer interface +// +//nolint:revive // allow unused parameters to indicate expected signature func (dt NoOpTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, @@ -85,25 +87,39 @@ func (dt NoOpTracer) CaptureStart(env *vm.EVM, } // CaptureState implements vm.Tracer interface +// +//nolint:revive // allow unused parameters to indicate expected signature func (dt NoOpTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) { } // CaptureFault implements vm.Tracer interface +// +//nolint:revive // allow unused parameters to indicate expected signature func (dt NoOpTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) { } // CaptureEnd implements vm.Tracer interface +// +//nolint:revive // allow unused parameters to indicate expected signature func (dt NoOpTracer) CaptureEnd(output []byte, gasUsed uint64, tm time.Duration, err error) {} // CaptureEnter implements vm.Tracer interface +// +//nolint:revive // allow unused parameters to indicate expected signature func (dt NoOpTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) { } // CaptureExit implements vm.Tracer interface +// +//nolint:revive // allow unused parameters to indicate expected signature func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error) {} // CaptureTxStart implements vm.Tracer interface +// +//nolint:revive // allow unused parameters to indicate expected signature func (dt NoOpTracer) CaptureTxStart(gasLimit uint64) {} // CaptureTxEnd implements vm.Tracer interface +// +//nolint:revive // allow unused parameters to indicate expected signature func (dt NoOpTracer) CaptureTxEnd(restGas uint64) {} diff --git a/x/evm/types/tx_args.go b/x/evm/types/tx_args.go index af3e6e3dbe..4ced1cf8df 100644 --- a/x/evm/types/tx_args.go +++ b/x/evm/types/tx_args.go @@ -150,7 +150,7 @@ func (args *TransactionArgs) ToTransaction() *MsgEthereumTx { } } - any, err := PackTxData(data) + anyData, err := PackTxData(data) if err != nil { return nil } @@ -160,7 +160,7 @@ func (args *TransactionArgs) ToTransaction() *MsgEthereumTx { } msg := MsgEthereumTx{ - Data: any, + Data: anyData, From: from, } msg.Hash = msg.AsTransaction().Hash().Hex() diff --git a/x/evm/types/utils_test.go b/x/evm/types/utils_test.go index d660b853c5..ac05097918 100644 --- a/x/evm/types/utils_test.go +++ b/x/evm/types/utils_test.go @@ -34,9 +34,9 @@ func TestEvmDataEncoding(t *testing.T) { Ret: ret, } - any := codectypes.UnsafePackAny(data) + anyData := codectypes.UnsafePackAny(data) txData := &sdk.TxMsgData{ - MsgResponses: []*codectypes.Any{any}, + MsgResponses: []*codectypes.Any{anyData}, } txDataBz, err := proto.Marshal(txData) diff --git a/x/feemarket/keeper/abci.go b/x/feemarket/keeper/abci.go index 03ce8314bf..d84c7da7f9 100644 --- a/x/feemarket/keeper/abci.go +++ b/x/feemarket/keeper/abci.go @@ -27,7 +27,7 @@ import ( ) // BeginBlock updates base fee -func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (k *Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { baseFee := k.CalculateBaseFee(ctx) // return immediately if base fee is nil @@ -53,7 +53,7 @@ func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { // EndBlock update block gas wanted. // The EVM end block logic doesn't update the validator set, thus it returns // an empty slice. -func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) { +func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) { if ctx.BlockGasMeter() == nil { k.Logger(ctx).Error("block gas meter is nil when setting block gas wanted") return diff --git a/x/feemarket/migrations/v4/migrate_test.go b/x/feemarket/migrations/v4/migrate_test.go index 0b273bd0c9..dc65c3f0c9 100644 --- a/x/feemarket/migrations/v4/migrate_test.go +++ b/x/feemarket/migrations/v4/migrate_test.go @@ -39,7 +39,7 @@ func newMockSubspace(ps types.Params) mockSubspace { return mockSubspace{ps: ps} } -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { *ps.(*types.Params) = ms.ps } diff --git a/x/ibc/transfer/keeper/keeper_test.go b/x/ibc/transfer/keeper/keeper_test.go index 920a2565c3..b0419c40a8 100644 --- a/x/ibc/transfer/keeper/keeper_test.go +++ b/x/ibc/transfer/keeper/keeper_test.go @@ -184,11 +184,13 @@ type MockChannelKeeper struct { mock.Mock } +//nolint:revive // allow unused parameters to indicate expected signature func (b *MockChannelKeeper) GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) { args := b.Called(mock.Anything, mock.Anything, mock.Anything) return args.Get(0).(channeltypes.Channel), true } +//nolint:revive // allow unused parameters to indicate expected signature func (b *MockChannelKeeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) { _ = b.Called(mock.Anything, mock.Anything, mock.Anything) return 1, true @@ -200,14 +202,16 @@ type MockICS4Wrapper struct { mock.Mock } -func (b *MockICS4Wrapper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet exported.PacketI, ack exported.Acknowledgement) error { +func (b *MockICS4Wrapper) WriteAcknowledgement(_ sdk.Context, _ *capabilitytypes.Capability, _ exported.PacketI, _ exported.Acknowledgement) error { return nil } +//nolint:revive // allow unused parameters to indicate expected signature func (b *MockICS4Wrapper) GetAppVersion(ctx sdk.Context, portID string, channelID string) (string, bool) { return "", false } +//nolint:revive // allow unused parameters to indicate expected signature func (b *MockICS4Wrapper) SendPacket( ctx sdk.Context, channelCap *capabilitytypes.Capability, diff --git a/x/incentives/migrations/v2/migrate_test.go b/x/incentives/migrations/v2/migrate_test.go index aae61aa37d..a4cbfce5b6 100644 --- a/x/incentives/migrations/v2/migrate_test.go +++ b/x/incentives/migrations/v2/migrate_test.go @@ -26,7 +26,7 @@ func newMockSubspace(ps v2types.V2Params, storeKey, transientKey storetypes.Stor return mockSubspace{ps: ps, storeKey: storeKey, transientKey: transientKey} } -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { *ps.(*v2types.V2Params) = ms.ps } diff --git a/x/incentives/module.go b/x/incentives/module.go index 1691f20bdc..e62fbd21a8 100644 --- a/x/incentives/module.go +++ b/x/incentives/module.go @@ -54,7 +54,7 @@ func (AppModuleBasic) Name() string { } // RegisterLegacyAminoCodec performs a no-op as the incentives doesn't support Amino encoding -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} // ConsensusVersion returns the consensus state-breaking version for the module. func (AppModuleBasic) ConsensusVersion() uint64 { @@ -73,7 +73,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesisState()) } -func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genesisState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -84,7 +84,7 @@ func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEnc // RegisterRESTRoutes performs a no-op as the incentives module doesn't expose REST // endpoints -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil { @@ -126,7 +126,7 @@ func (AppModule) Name() string { return types.ModuleName } -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // NewHandler returns nil incentives module doesn't expose tx gRPC endpoints func (am AppModule) NewHandler() sdk.Handler { @@ -141,7 +141,7 @@ func (am AppModule) QuerierRoute() string { return types.RouterKey } -func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -176,20 +176,20 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(gs) } -func (am AppModule) GenerateGenesisState(input *module.SimulationState) { +func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { } -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return []simtypes.WeightedProposalContent{} } -func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{} } -func (am AppModule) RegisterStoreDecoder(decoderRegistry sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return []simtypes.WeightedOperation{} } diff --git a/x/incentives/types/msg.go b/x/incentives/types/msg.go index 3f8604e768..c8e161ae3d 100644 --- a/x/incentives/types/msg.go +++ b/x/incentives/types/msg.go @@ -35,11 +35,7 @@ func (m *MsgUpdateParams) ValidateBasic() error { return errorsmod.Wrap(err, "invalid authority address") } - if err := m.Params.Validate(); err != nil { - return err - } - - return nil + return m.Params.Validate() } // GetSignBytes implements the LegacyMsg interface. diff --git a/x/inflation/keeper/inflation.go b/x/inflation/keeper/inflation.go index 99781b645a..23c6c5ce67 100644 --- a/x/inflation/keeper/inflation.go +++ b/x/inflation/keeper/inflation.go @@ -119,7 +119,7 @@ func (k Keeper) AllocateExponentialInflation( // GetAllocationProportion calculates the proportion of coins that is to be // allocated during inflation for a given distribution. func (k Keeper) GetProportions( - ctx sdk.Context, + _ sdk.Context, coin sdk.Coin, distribution sdk.Dec, ) sdk.Coin { diff --git a/x/inflation/keeper/migrations_test.go b/x/inflation/keeper/migrations_test.go index b1e2c7eda6..64fa365ab6 100644 --- a/x/inflation/keeper/migrations_test.go +++ b/x/inflation/keeper/migrations_test.go @@ -24,7 +24,7 @@ func newMockSubspace(ps v2types.V2Params, storeKey, transientKey storetypes.Stor return mockSubspace{ps: ps, storeKey: storeKey, transientKey: transientKey} } -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { *ps.(*v2types.V2Params) = ms.ps } diff --git a/x/inflation/keeper/setup_test.go b/x/inflation/keeper/setup_test.go index 0535c61326..e9c5b38391 100644 --- a/x/inflation/keeper/setup_test.go +++ b/x/inflation/keeper/setup_test.go @@ -39,5 +39,5 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) + suite.DoSetupTest() } diff --git a/x/inflation/keeper/utils_test.go b/x/inflation/keeper/utils_test.go index 065b3e6557..bbc0bf22a2 100644 --- a/x/inflation/keeper/utils_test.go +++ b/x/inflation/keeper/utils_test.go @@ -9,11 +9,10 @@ import ( epochstypes "github.com/evmos/evmos/v12/x/epochs/types" evm "github.com/evmos/evmos/v12/x/evm/types" "github.com/evmos/evmos/v12/x/inflation/types" - "github.com/stretchr/testify/require" ) // Test helpers -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { +func (suite *KeeperTestSuite) DoSetupTest() { checkTx := false // init app diff --git a/x/inflation/migrations/v2/migrate_test.go b/x/inflation/migrations/v2/migrate_test.go index 1f08e575f7..c00ad2d029 100644 --- a/x/inflation/migrations/v2/migrate_test.go +++ b/x/inflation/migrations/v2/migrate_test.go @@ -27,7 +27,7 @@ func newMockSubspace(ps v2types.V2Params, storeKey, transientKey storetypes.Stor return mockSubspace{ps: ps, storeKey: storeKey, transientKey: transientKey} } -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { *ps.(*v2types.V2Params) = ms.ps } diff --git a/x/inflation/migrations/v2/types/params.go b/x/inflation/migrations/v2/types/params.go index a1bfe4e07f..d0d0ba0dde 100644 --- a/x/inflation/migrations/v2/types/params.go +++ b/x/inflation/migrations/v2/types/params.go @@ -101,11 +101,8 @@ func validateMintDenom(i interface{}) error { if strings.TrimSpace(v) == "" { return errors.New("mint denom cannot be blank") } - if err := sdk.ValidateDenom(v); err != nil { - return err - } - return nil + return sdk.ValidateDenom(v) } func validateExponentialCalculation(i interface{}) error { diff --git a/x/inflation/module.go b/x/inflation/module.go index dd81c75022..eca2657d44 100644 --- a/x/inflation/module.go +++ b/x/inflation/module.go @@ -78,7 +78,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the inflation module. -func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genesisState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -89,7 +89,7 @@ func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEnc // RegisterRESTRoutes performs a no-op as the inflation module doesn't expose REST // endpoints -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the inflation module. func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) { @@ -140,7 +140,7 @@ func (AppModule) Name() string { } // RegisterInvariants registers the inflation module invariants. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // Route returns the message routing key for the inflation module. func (am AppModule) Route() sdk.Route { @@ -153,7 +153,7 @@ func (am AppModule) QuerierRoute() string { } // LegacyQuerierHandler returns the inflation module sdk.Querier. -func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -210,24 +210,24 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // AppModuleSimulation functions // GenerateGenesisState creates a randomized GenState of the inflation module. -func (am AppModule) GenerateGenesisState(input *module.SimulationState) { +func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return []simtypes.WeightedProposalContent{} } // RandomizedParams creates randomized inflation param changes for the simulator. -func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{} } // RegisterStoreDecoder registers a decoder for inflation module's types. -func (am AppModule) RegisterStoreDecoder(decoderRegistry sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } // WeightedOperations doesn't return any inflation module operation. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return []simtypes.WeightedOperation{} } diff --git a/x/inflation/types/params.go b/x/inflation/types/params.go index 35b82e74b8..a80fa6ed0d 100644 --- a/x/inflation/types/params.go +++ b/x/inflation/types/params.go @@ -77,11 +77,8 @@ func validateMintDenom(i interface{}) error { if strings.TrimSpace(v) == "" { return errors.New("mint denom cannot be blank") } - if err := sdk.ValidateDenom(v); err != nil { - return err - } - return nil + return sdk.ValidateDenom(v) } func validateExponentialCalculation(i interface{}) error { diff --git a/x/recovery/keeper/mock_test.go b/x/recovery/keeper/mock_test.go index 649aca5830..5e7c24ed4b 100644 --- a/x/recovery/keeper/mock_test.go +++ b/x/recovery/keeper/mock_test.go @@ -26,7 +26,7 @@ type MockTransferKeeper struct { bankkeeper.Keeper } -func (m *MockTransferKeeper) GetDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) (transfertypes.DenomTrace, bool) { +func (m *MockTransferKeeper) GetDenomTrace(_ sdk.Context, denomTraceHash tmbytes.HexBytes) (transfertypes.DenomTrace, bool) { args := m.Called(mock.Anything, denomTraceHash) return args.Get(0).(transfertypes.DenomTrace), args.Bool(1) } diff --git a/x/recovery/migrations/v2/migrate_test.go b/x/recovery/migrations/v2/migrate_test.go index 8175e08919..80e37ce917 100644 --- a/x/recovery/migrations/v2/migrate_test.go +++ b/x/recovery/migrations/v2/migrate_test.go @@ -26,7 +26,7 @@ func newMockSubspace(ps v2types.V2Params, storeKey, transientKey storetypes.Stor return mockSubspace{ps: ps, storeKey: storeKey, transientKey: transientKey} } -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { *ps.(*v2types.V2Params) = ms.ps } diff --git a/x/recovery/module.go b/x/recovery/module.go index 0f23795d04..f1a168417f 100644 --- a/x/recovery/module.go +++ b/x/recovery/module.go @@ -76,7 +76,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesisState()) } -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genesisState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -87,7 +87,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterRESTRoutes performs a no-op as the recovery module doesn't expose REST // endpoints -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} func (AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil { @@ -126,7 +126,7 @@ func (AppModule) Name() string { return types.ModuleName } -func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} +func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} func (am AppModule) Route() sdk.Route { return sdk.NewRoute(types.RouterKey, NewHandler(&am.keeper)) @@ -136,7 +136,7 @@ func (AppModule) QuerierRoute() string { return "" } -func (AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { +func (AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } diff --git a/x/recovery/types/msg.go b/x/recovery/types/msg.go index 3f8604e768..c8e161ae3d 100644 --- a/x/recovery/types/msg.go +++ b/x/recovery/types/msg.go @@ -35,11 +35,7 @@ func (m *MsgUpdateParams) ValidateBasic() error { return errorsmod.Wrap(err, "invalid authority address") } - if err := m.Params.Validate(); err != nil { - return err - } - - return nil + return m.Params.Validate() } // GetSignBytes implements the LegacyMsg interface. diff --git a/x/revenue/v1/keeper/integration_test.go b/x/revenue/v1/keeper/integration_test.go index 2851ce9509..7ff2c1e6dd 100644 --- a/x/revenue/v1/keeper/integration_test.go +++ b/x/revenue/v1/keeper/integration_test.go @@ -694,7 +694,6 @@ var _ = Describe("Fee distribution:", Ordered, func() { s.app, deployerKey, factoryAddress, - s.queryClientEvm, ) Expect(err).To(BeNil()) s.Commit() @@ -795,7 +794,6 @@ var _ = Describe("Fee distribution:", Ordered, func() { s.app, deployerKey1, factory1Address, - s.queryClientEvm, ) Expect(err).To(BeNil()) s.Commit() @@ -807,7 +805,6 @@ var _ = Describe("Fee distribution:", Ordered, func() { s.app, deployerKey1, factory2Address, - s.queryClientEvm, ) Expect(err).To(BeNil()) s.Commit() diff --git a/x/revenue/v1/migrations/v2/migrate_test.go b/x/revenue/v1/migrations/v2/migrate_test.go index 629ab915d9..4a9a7a6251 100644 --- a/x/revenue/v1/migrations/v2/migrate_test.go +++ b/x/revenue/v1/migrations/v2/migrate_test.go @@ -27,7 +27,7 @@ func newMockSubspace(ps v2types.V2Params, storeKey, transientKey storetypes.Stor return mockSubspace{ps: ps, storeKey: storeKey, transientKey: transientKey} } -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { +func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { *ps.(*v2types.V2Params) = ms.ps } diff --git a/x/revenue/v1/module.go b/x/revenue/v1/module.go index af56143557..656e52a574 100644 --- a/x/revenue/v1/module.go +++ b/x/revenue/v1/module.go @@ -80,7 +80,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the fees module. -func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genesisState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -91,7 +91,7 @@ func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEnc // RegisterRESTRoutes performs a no-op as the fees module doesn't expose REST // endpoints -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the fees // module. @@ -142,7 +142,7 @@ func (AppModule) Name() string { } // RegisterInvariants registers the fees module's invariants. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // NewHandler returns nil - fees module doesn't expose tx gRPC endpoints func (am AppModule) NewHandler() sdk.Handler { @@ -160,7 +160,7 @@ func (am AppModule) QuerierRoute() string { } // LegacyQuerierHandler returns the claim module's Querier. -func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -208,24 +208,24 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // AppModuleSimulation functions // GenerateGenesisState creates a randomized GenState of the fees module. -func (am AppModule) GenerateGenesisState(input *module.SimulationState) { +func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { } // ProposalContents returns content functions for governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return []simtypes.WeightedProposalContent{} } // RandomizedParams creates randomized fees param changes for the simulator. -func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{} } // RegisterStoreDecoder registers a decoder for fees module's types. -func (am AppModule) RegisterStoreDecoder(decoderRegistry sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } // WeightedOperations returns fees module weighted operations -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return []simtypes.WeightedOperation{} } diff --git a/x/revenue/v1/types/msg.go b/x/revenue/v1/types/msg.go index ef19d4cc9e..e95e0f9c24 100644 --- a/x/revenue/v1/types/msg.go +++ b/x/revenue/v1/types/msg.go @@ -201,11 +201,7 @@ func (m *MsgUpdateParams) ValidateBasic() error { return errorsmod.Wrap(err, "invalid authority address") } - if err := m.Params.Validate(); err != nil { - return err - } - - return nil + return m.Params.Validate() } // GetSignBytes implements the LegacyMsg interface. diff --git a/x/vesting/module.go b/x/vesting/module.go index e0fca47a4e..d28f33fff9 100644 --- a/x/vesting/module.go +++ b/x/vesting/module.go @@ -71,7 +71,7 @@ func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation. Currently, this is a no-op. -func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error { return nil }