diff --git a/.circleci/config.yml b/.circleci/config.yml index a63bcb49ca..45fb8d2bda 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,7 +63,7 @@ jobs: lint: docker: - - image: golangci/golangci-lint:v1.52.2 + - image: golangci/golangci-lint:v1.54.2 steps: - checkout - run: diff --git a/x/wasm/client/cli/gov_tx_test.go b/x/wasm/client/cli/gov_tx_test.go index 759e4626fb..d6dea668ef 100644 --- a/x/wasm/client/cli/gov_tx_test.go +++ b/x/wasm/client/cli/gov_tx_test.go @@ -5,11 +5,10 @@ import ( "strings" "testing" - "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/client/cli/tx_test.go b/x/wasm/client/cli/tx_test.go index 8732ecaeb4..75b6a4eadd 100644 --- a/x/wasm/client/cli/tx_test.go +++ b/x/wasm/client/cli/tx_test.go @@ -4,14 +4,13 @@ import ( "encoding/hex" "testing" - "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/ioutils" + "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/genesis.go b/x/wasm/keeper/genesis.go index 03e54bb2d1..f6953e8238 100644 --- a/x/wasm/keeper/genesis.go +++ b/x/wasm/keeper/genesis.go @@ -47,7 +47,7 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]ab if err != nil { return nil, errorsmod.Wrapf(err, "address in contract number %d", i) } - err = keeper.importContract(ctx, contractAddr, &contract.ContractInfo, contract.ContractState, contract.ContractCodeHistory) + err = keeper.importContract(ctx, contractAddr, &contract.ContractInfo, contract.ContractState, contract.ContractCodeHistory) //nolint:gosec if err != nil { return nil, errorsmod.Wrapf(err, "contract number %d", i) } diff --git a/x/wasm/keeper/handler_plugin_test.go b/x/wasm/keeper/handler_plugin_test.go index 8d21ed8682..9fc666b101 100644 --- a/x/wasm/keeper/handler_plugin_test.go +++ b/x/wasm/keeper/handler_plugin_test.go @@ -307,7 +307,7 @@ func TestIBCRawPacketHandler(t *testing.T) { capturedPacket = nil // when h := NewIBCRawPacketHandler(capturePacketsSenderMock, spec.chanKeeper, spec.capKeeper) - evts, data, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &spec.srcMsg}}) + evts, data, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &spec.srcMsg}}) //nolint:gosec // then require.True(t, spec.expErr.Is(gotErr), "exp %v but got %#+v", spec.expErr, gotErr) if spec.expErr != nil { @@ -390,7 +390,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { k.wasmVM = &wasmtesting.MockWasmEngine{ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { return &wasmvmtypes.Response{ Messages: []wasmvmtypes.SubMsg{ - {Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{Burn: &spec.msg}}, ReplyOn: wasmvmtypes.ReplyNever}, + {Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{Burn: &spec.msg}}, ReplyOn: wasmvmtypes.ReplyNever}, //nolint:gosec }, }, 0, nil }} diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 9096539b68..f2eda5bbdb 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -11,8 +11,6 @@ import ( "testing" "time" - "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" - wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/types" abci "github.com/cometbft/cometbft/abci/types" @@ -36,6 +34,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -549,7 +548,7 @@ func TestInstantiateWithPermissions(t *testing.T) { accKeeper, bankKeeper, keeper := keepers.AccountKeeper, keepers.BankKeeper, keepers.ContractKeeper fundAccounts(t, ctx, accKeeper, bankKeeper, spec.srcActor, deposit) - contractID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, &spec.srcPermission) + contractID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, &spec.srcPermission) //nolint:gosec require.NoError(t, err) _, _, err = keepers.ContractKeeper.Instantiate(ctx, contractID, spec.srcActor, nil, initMsgBz, "demo contract 1", nil) diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go index 72fa71dd63..ef7f0a4b0d 100644 --- a/x/wasm/keeper/msg_server_integration_test.go +++ b/x/wasm/keeper/msg_server_integration_test.go @@ -132,7 +132,7 @@ func TestUpdateParams(t *testing.T) { require.NoError(t, err) // when - rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) + rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec require.NoError(t, err) var result types.MsgUpdateParamsResponse require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result)) @@ -223,7 +223,7 @@ func TestAddCodeUploadParamsAddresses(t *testing.T) { require.NoError(t, err) // when - rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) + rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec if spec.expErr { require.Error(t, err) require.Nil(t, rsp) @@ -319,7 +319,7 @@ func TestRemoveCodeUploadParamsAddresses(t *testing.T) { require.NoError(t, err) // when - rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) + rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec if spec.expErr { require.Error(t, err) require.Nil(t, rsp) diff --git a/x/wasm/keeper/options_test.go b/x/wasm/keeper/options_test.go index 620087b77e..aedcc9396c 100644 --- a/x/wasm/keeper/options_test.go +++ b/x/wasm/keeper/options_test.go @@ -4,9 +4,8 @@ import ( "reflect" "testing" - "github.com/prometheus/client_golang/prometheus" - wasmvm "github.com/CosmWasm/wasmvm" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go index 1c3f153348..76af5f3e3c 100644 --- a/x/wasm/keeper/proposal_integration_test.go +++ b/x/wasm/keeper/proposal_integration_test.go @@ -8,8 +8,6 @@ import ( "os" "testing" - "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" - wasmvm "github.com/CosmWasm/wasmvm" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -20,6 +18,7 @@ import ( v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -639,7 +638,7 @@ func TestAdminProposals(t *testing.T) { }, } - require.NoError(t, wasmKeeper.importContract(ctx, contractAddr, &spec.state, []types.Model{}, entries)) + require.NoError(t, wasmKeeper.importContract(ctx, contractAddr, &spec.state, []types.Model{}, entries)) //nolint:gosec // when mustSubmitAndExecuteLegacyProposal(t, ctx, spec.srcProposal, otherAddress.String(), keepers) diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 8cd046831f..1dae8ff2fe 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -522,7 +522,7 @@ func TestQueryContractHistory(t *testing.T) { // when q := Querier(keeper) - got, err := q.ContractHistory(sdk.WrapSDKContext(xCtx), &spec.req) + got, err := q.ContractHistory(sdk.WrapSDKContext(xCtx), &spec.req) //nolint:gosec // then if spec.expContent == nil { @@ -597,7 +597,7 @@ func TestQueryCodeList(t *testing.T) { } // when q := Querier(keeper) - got, err := q.Codes(sdk.WrapSDKContext(xCtx), &spec.req) + got, err := q.Codes(sdk.WrapSDKContext(xCtx), &spec.req) //nolint:gosec // then require.NoError(t, err) @@ -664,7 +664,7 @@ func TestQueryContractInfo(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { xCtx, _ := ctx.CacheContext() - k.storeContractInfo(xCtx, contractAddr, &spec.stored) + k.storeContractInfo(xCtx, contractAddr, &spec.stored) //nolint:gosec // when gotRsp, gotErr := querier.ContractInfo(sdk.WrapSDKContext(xCtx), spec.src) if spec.expErr { diff --git a/x/wasm/keeper/query_plugin_integration_test.go b/x/wasm/keeper/query_plugin_integration_test.go index e54c0c46d0..496643bbd3 100644 --- a/x/wasm/keeper/query_plugin_integration_test.go +++ b/x/wasm/keeper/query_plugin_integration_test.go @@ -7,17 +7,17 @@ import ( "strings" "testing" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -506,7 +506,7 @@ func TestDistributionQuery(t *testing.T) { }, "delegator address - withdrawal addr set": { setup: func(t *testing.T, ctx sdk.Context) sdk.Context { - keepers.DistKeeper.SetWithdrawAddr(ctx, delegator, otherAddr) + require.NoError(t, keepers.DistKeeper.SetWithdrawAddr(ctx, delegator, otherAddr)) return ctx }, query: &wasmvmtypes.DistributionQuery{ diff --git a/x/wasm/keeper/query_plugins_test.go b/x/wasm/keeper/query_plugins_test.go index b6ae4b7410..d8e94ce8f9 100644 --- a/x/wasm/keeper/query_plugins_test.go +++ b/x/wasm/keeper/query_plugins_test.go @@ -9,14 +9,19 @@ import ( "testing" "time" - errorsmod "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/libs/rand" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/gogoproto/proto" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" @@ -27,10 +32,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/gogoproto/proto" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/CosmWasm/wasmd/app" "github.com/CosmWasm/wasmd/x/wasm/keeper" @@ -809,7 +810,7 @@ func TestDistributionQuerier(t *testing.T) { var mock types.DistributionKeeper q := keeper.DistributionQuerier(mock) - gotBz, gotErr := q(ctx, &spec.q) + gotBz, gotErr := q(ctx, &spec.q) //nolint:gosec if spec.expErr { require.Error(t, gotErr) return diff --git a/x/wasm/keeper/reflect_test.go b/x/wasm/keeper/reflect_test.go index 2b492f0723..e5cf79ff65 100644 --- a/x/wasm/keeper/reflect_test.go +++ b/x/wasm/keeper/reflect_test.go @@ -5,9 +5,12 @@ import ( "os" "testing" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + errorsmod "cosmossdk.io/errors" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,8 +18,6 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" "github.com/CosmWasm/wasmd/x/wasm/types" diff --git a/x/wasm/types/proposal_test.go b/x/wasm/types/proposal_test.go index 5268adaa23..622485886f 100644 --- a/x/wasm/types/proposal_test.go +++ b/x/wasm/types/proposal_test.go @@ -992,7 +992,7 @@ code_ids: } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - v, err := yaml.Marshal(&spec.src) + v, err := yaml.Marshal(&spec.src) //nolint:gosec require.NoError(t, err) assert.Equal(t, spec.exp, string(v)) })