diff --git a/Makefile b/Makefile index 59a6914743..944a70c996 100644 --- a/Makefile +++ b/Makefile @@ -379,7 +379,7 @@ benchmark: ### Linting ### ############################################################################### -golangci_version=v2.5.0 +golangci_version=v2.6.0 lint-install: @echo "--> Installing golangci-lint $(golangci_version)" diff --git a/client/context.go b/client/context.go index 7148c9ea1e..4779d8a15b 100644 --- a/client/context.go +++ b/client/context.go @@ -348,6 +348,7 @@ func (ctx Context) PrintProto(toPrint proto.Message) error { // PrintObjectLegacy is a variant of PrintProto that doesn't require a proto.Message type // and uses amino JSON encoding. +// // Deprecated: It will be removed in the near future! func (ctx Context) PrintObjectLegacy(toPrint any) error { out, err := ctx.LegacyAmino.MarshalJSON(toPrint) diff --git a/client/keys/add_ledger_test.go b/client/keys/add_ledger_test.go index 1c78bb75b3..35b4003a53 100644 --- a/client/keys/add_ledger_test.go +++ b/client/keys/add_ledger_test.go @@ -1,5 +1,4 @@ //go:build ledger || test_ledger_mock -// +build ledger test_ledger_mock package keys diff --git a/codec/proto_codec.go b/codec/proto_codec.go index 6d22ee1d49..9f49564c39 100644 --- a/codec/proto_codec.go +++ b/codec/proto_codec.go @@ -23,6 +23,7 @@ import ( // ProtoCodecMarshaler defines an interface for codecs that utilize Protobuf for both // binary and JSON encoding. +// // Deprecated: Use Codec instead. type ProtoCodecMarshaler interface { Codec diff --git a/crypto/keyring/keyring_ledger_test.go b/crypto/keyring/keyring_ledger_test.go index 0b123bd20e..0395e3e416 100644 --- a/crypto/keyring/keyring_ledger_test.go +++ b/crypto/keyring/keyring_ledger_test.go @@ -1,5 +1,4 @@ //go:build ledger || test_ledger_mock -// +build ledger test_ledger_mock package keyring diff --git a/crypto/keyring/keyring_linux.go b/crypto/keyring/keyring_linux.go index de7c1c9ee1..99110c536d 100644 --- a/crypto/keyring/keyring_linux.go +++ b/crypto/keyring/keyring_linux.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package keyring diff --git a/crypto/keyring/keyring_linux_test.go b/crypto/keyring/keyring_linux_test.go index a6695b6b94..b9d7ce83df 100644 --- a/crypto/keyring/keyring_linux_test.go +++ b/crypto/keyring/keyring_linux_test.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package keyring diff --git a/crypto/keyring/keyring_other.go b/crypto/keyring/keyring_other.go index 9c25a1e954..84bfe17966 100644 --- a/crypto/keyring/keyring_other.go +++ b/crypto/keyring/keyring_other.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package keyring diff --git a/crypto/keys/secp256k1/secp256k1_cgo.go b/crypto/keys/secp256k1/secp256k1_cgo.go index 050cc1b213..ec8381447b 100644 --- a/crypto/keys/secp256k1/secp256k1_cgo.go +++ b/crypto/keys/secp256k1/secp256k1_cgo.go @@ -1,5 +1,4 @@ //go:build libsecp256k1_sdk -// +build libsecp256k1_sdk package secp256k1 diff --git a/crypto/keys/secp256k1/secp256k1_cgo_test.go b/crypto/keys/secp256k1/secp256k1_cgo_test.go index 92579a3edf..996c2d3547 100644 --- a/crypto/keys/secp256k1/secp256k1_cgo_test.go +++ b/crypto/keys/secp256k1/secp256k1_cgo_test.go @@ -1,5 +1,4 @@ //go:build libsecp256k1_sdk -// +build libsecp256k1_sdk package secp256k1 diff --git a/crypto/keys/secp256k1/secp256k1_nocgo.go b/crypto/keys/secp256k1/secp256k1_nocgo.go index bad10212b6..51d7af6636 100644 --- a/crypto/keys/secp256k1/secp256k1_nocgo.go +++ b/crypto/keys/secp256k1/secp256k1_nocgo.go @@ -1,5 +1,4 @@ //go:build !libsecp256k1_sdk -// +build !libsecp256k1_sdk package secp256k1 diff --git a/crypto/keys/secp256k1/secp256k1_nocgo_test.go b/crypto/keys/secp256k1/secp256k1_nocgo_test.go index 9aff83f9f3..b0140b92c8 100644 --- a/crypto/keys/secp256k1/secp256k1_nocgo_test.go +++ b/crypto/keys/secp256k1/secp256k1_nocgo_test.go @@ -1,5 +1,4 @@ //go:build !libsecp256k1_sdk -// +build !libsecp256k1_sdk package secp256k1 diff --git a/crypto/ledger/ledger_mock.go b/crypto/ledger/ledger_mock.go index b67b53b053..98eff806e8 100644 --- a/crypto/ledger/ledger_mock.go +++ b/crypto/ledger/ledger_mock.go @@ -1,5 +1,4 @@ //go:build ledger && test_ledger_mock -// +build ledger,test_ledger_mock package ledger diff --git a/crypto/ledger/ledger_notavail.go b/crypto/ledger/ledger_notavail.go index 35a60cf356..035d17d566 100644 --- a/crypto/ledger/ledger_notavail.go +++ b/crypto/ledger/ledger_notavail.go @@ -1,5 +1,4 @@ //go:build !cgo || !ledger -// +build !cgo !ledger // test_ledger_mock diff --git a/crypto/ledger/ledger_real.go b/crypto/ledger/ledger_real.go index ad8f8fdf23..bdee0ecf8a 100644 --- a/crypto/ledger/ledger_real.go +++ b/crypto/ledger/ledger_real.go @@ -1,5 +1,4 @@ //go:build cgo && ledger && !test_ledger_mock -// +build cgo,ledger,!test_ledger_mock package ledger diff --git a/crypto/ledger/ledger_test.go b/crypto/ledger/ledger_test.go index 4d3fd3e67c..bbadcc1f9d 100644 --- a/crypto/ledger/ledger_test.go +++ b/crypto/ledger/ledger_test.go @@ -1,5 +1,4 @@ //go:build ledger -// +build ledger package ledger diff --git a/math/int_internal_test.go b/math/int_internal_test.go index f4c32f1bee..db59603397 100644 --- a/math/int_internal_test.go +++ b/math/int_internal_test.go @@ -121,7 +121,7 @@ func (s *internalIntTestSuite) TestImmutabilityArithInt() { bi := new(big.Int).SetInt64(n) for j := 0; j < size; j++ { - op := ops[rand.Intn(len(ops))] + op := ops[rand.Intn(len(ops))] //nolint:gosec // testing uis[j], bis[j] = op(ui, bi) } diff --git a/math/legacy_dec.go b/math/legacy_dec.go index 27f7c38e3b..5cef73ab57 100644 --- a/math/legacy_dec.go +++ b/math/legacy_dec.go @@ -22,6 +22,7 @@ const ( // LegacyDecimalPrecisionBits bits required to represent the above precision // Ceiling[Log2[10^Precision - 1]] + // // Deprecated: This is unused and will be removed LegacyDecimalPrecisionBits = 60 diff --git a/runtime/app.go b/runtime/app.go index 8c63e2623d..5b3cc47050 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -62,7 +62,7 @@ type App struct { // RegisterModules registers the provided modules with the module manager and // the basic module manager. This is the primary hook for integrating with // modules which are not registered using the app config. -func (a *App) RegisterModules(modules ...module.AppModule) error { +func (a *App) RegisterModules(modules ...module.AppModule) error { //nolint:staticcheck // needed for legacy compatibility for _, appModule := range modules { name := appModule.Name() if _, ok := a.ModuleManager.Modules[name]; ok { diff --git a/server/api/server.go b/server/api/server.go index 0aa1cf1709..84de24c407 100644 --- a/server/api/server.go +++ b/server/api/server.go @@ -11,7 +11,7 @@ import ( cmtrpcserver "github.com/cometbft/cometbft/rpc/jsonrpc/server" gateway "github.com/cosmos/gogogateway" - "github.com/golang/protobuf/proto" //nolint:staticcheck // keep for compat + "github.com/golang/protobuf/proto" //nolint:staticcheck // needed for compatibility "github.com/gorilla/handlers" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" diff --git a/server/api/server_test.go b/server/api/server_test.go index d4f891ce92..c7df73bab9 100644 --- a/server/api/server_test.go +++ b/server/api/server_test.go @@ -14,7 +14,7 @@ import ( "strings" "testing" - "github.com/golang/protobuf/proto" //nolint:staticcheck // keep for compat + "github.com/golang/protobuf/proto" //nolint:staticcheck // needed for testing "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "google.golang.org/grpc/codes" diff --git a/simapp/params/amino.go b/simapp/params/amino.go index c7d8ba0045..6575b5726a 100644 --- a/simapp/params/amino.go +++ b/simapp/params/amino.go @@ -1,5 +1,4 @@ //go:build test_amino -// +build test_amino package params diff --git a/simapp/params/proto.go b/simapp/params/proto.go index 25f788ab18..37310f85eb 100644 --- a/simapp/params/proto.go +++ b/simapp/params/proto.go @@ -1,5 +1,4 @@ //go:build !test_amino -// +build !test_amino package params diff --git a/store/cachekv/store_test.go b/store/cachekv/store_test.go index f2c63e4b9c..6bf0b801c5 100644 --- a/store/cachekv/store_test.go +++ b/store/cachekv/store_test.go @@ -475,18 +475,18 @@ func doOp(t *testing.T, st types.CacheKVStore, truth dbm.DB, op int, args ...int require.NoError(t, err) case opSetRange: require.True(t, len(args) > 1) - start := args[0] - end := args[1] //nolint:gosec // this is not out of range + start := args[0] //nolint:gosec // this is not out of range + end := args[1] //nolint:gosec // this is not out of range setRange(t, st, truth, start, end) case opDel: - k := args[0] + k := args[0] //nolint:gosec // this is not out of range st.Delete(keyFmt(k)) err := truth.Delete(keyFmt(k)) require.NoError(t, err) case opDelRange: require.True(t, len(args) > 1) - start := args[0] - end := args[1] //nolint:gosec // this is not out of range + start := args[0] //nolint:gosec // this is not out of range + end := args[1] //nolint:gosec // this is not out of range deleteRange(t, st, truth, start, end) case opWrite: st.Write() diff --git a/tests/e2e/auth/cli_test.go b/tests/e2e/auth/cli_test.go index a029338e3d..4ef983d137 100644 --- a/tests/e2e/auth/cli_test.go +++ b/tests/e2e/auth/cli_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package auth diff --git a/tests/e2e/authz/cli_test.go b/tests/e2e/authz/cli_test.go index 55348c99bd..3cf95354ae 100644 --- a/tests/e2e/authz/cli_test.go +++ b/tests/e2e/authz/cli_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package authz diff --git a/tests/e2e/bank/cli_test.go b/tests/e2e/bank/cli_test.go index 4560aea6bf..0a198e206a 100644 --- a/tests/e2e/bank/cli_test.go +++ b/tests/e2e/bank/cli_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package client diff --git a/tests/e2e/client/grpc/cmtservice/service_test.go b/tests/e2e/client/grpc/cmtservice/service_test.go index d4c97dfae4..8b4fe5ef32 100644 --- a/tests/e2e/client/grpc/cmtservice/service_test.go +++ b/tests/e2e/client/grpc/cmtservice/service_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package cmtservice_test diff --git a/tests/e2e/distribution/cli_test.go b/tests/e2e/distribution/cli_test.go index 09f0ecf134..a2fc465fea 100644 --- a/tests/e2e/distribution/cli_test.go +++ b/tests/e2e/distribution/cli_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package distribution diff --git a/tests/e2e/gov/cli_test.go b/tests/e2e/gov/cli_test.go index 4f6f8b125d..f50a97117d 100644 --- a/tests/e2e/gov/cli_test.go +++ b/tests/e2e/gov/cli_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package gov diff --git a/tests/e2e/gov/tx.go b/tests/e2e/gov/tx.go index 30bc06c821..934b08dd34 100644 --- a/tests/e2e/gov/tx.go +++ b/tests/e2e/gov/tx.go @@ -260,7 +260,7 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := cli.NewCmdSubmitLegacyProposal() + cmd := cli.NewCmdSubmitLegacyProposal() //nolint:staticcheck // needed for legacy testing clientCtx := val.ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) diff --git a/tests/e2e/mint/cli_test.go b/tests/e2e/mint/cli_test.go index 08158c2796..f559a33c8a 100644 --- a/tests/e2e/mint/cli_test.go +++ b/tests/e2e/mint/cli_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package mint diff --git a/tests/e2e/server/export_test.go b/tests/e2e/server/export_test.go index f50e369593..df7538c336 100644 --- a/tests/e2e/server/export_test.go +++ b/tests/e2e/server/export_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package server_test diff --git a/tests/e2e/staking/cli_test.go b/tests/e2e/staking/cli_test.go index 0705c5645e..d30c0f2e5b 100644 --- a/tests/e2e/staking/cli_test.go +++ b/tests/e2e/staking/cli_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e package testutil diff --git a/tests/e2e/tx/service_test.go b/tests/e2e/tx/service_test.go index 5708eff7b5..f176604db8 100644 --- a/tests/e2e/tx/service_test.go +++ b/tests/e2e/tx/service_test.go @@ -1144,6 +1144,7 @@ func (s *E2ETestSuite) mkTxBuilder() client.TxBuilder { // protoTxProvider is a type which can provide a proto transaction. It is a // workaround to get access to the wrapper TxBuilder's method GetProtoTx(). +// // Deprecated: It's only used for testing the deprecated Simulate gRPC endpoint // using a proto Tx field. type protoTxProvider interface { @@ -1151,6 +1152,7 @@ type protoTxProvider interface { } // txBuilderToProtoTx converts a txBuilder into a proto tx.Tx. +// // Deprecated: It's used for testing the deprecated Simulate gRPC endpoint // using a proto Tx field and for testing the TxEncode endpoint. func txBuilderToProtoTx(txBuilder client.TxBuilder) (*tx.Tx, error) { diff --git a/tests/integration/tx/aminojson/aminojson_test.go b/tests/integration/tx/aminojson/aminojson_test.go index 2932d4d460..965859306a 100644 --- a/tests/integration/tx/aminojson/aminojson_test.go +++ b/tests/integration/tx/aminojson/aminojson_test.go @@ -162,7 +162,7 @@ func TestAminoJSON_Equivalence(t *testing.T) { signBz, err := handler.GetSignBytes(context.Background(), signerData, txData) require.NoError(t, err) - legacyHandler := tx.NewSignModeLegacyAminoJSONHandler() + legacyHandler := tx.NewSignModeLegacyAminoJSONHandler() //nolint:staticcheck // needed for legacy testing txBuilder := encCfg.TxConfig.NewTxBuilder() require.NoError(t, txBuilder.SetMsgs([]types.Msg{tt.Gogo}...)) txBuilder.SetMemo(handlerOptions.Memo) @@ -457,7 +457,7 @@ func TestAminoJSON_LegacyParity(t *testing.T) { require.Equal(t, string(gogoBytes), string(newGogoBytes)) // test amino json signer handler equivalence - msg, ok := tc.gogo.(legacytx.LegacyMsg) + msg, ok := tc.gogo.(legacytx.LegacyMsg) //nolint:staticcheck // needed for legacy testing if !ok { // not signable return @@ -482,7 +482,7 @@ func TestAminoJSON_LegacyParity(t *testing.T) { signBz, err := handler.GetSignBytes(context.Background(), signerData, txData) require.NoError(t, err) - legacyHandler := tx.NewSignModeLegacyAminoJSONHandler() + legacyHandler := tx.NewSignModeLegacyAminoJSONHandler() //nolint:staticcheck // needed for legacy testing txBuilder := encCfg.TxConfig.NewTxBuilder() require.NoError(t, txBuilder.SetMsgs([]types.Msg{msg}...)) txBuilder.SetMemo(handlerOptions.Memo) diff --git a/testutil/sims/simulation_helpers.go b/testutil/sims/simulation_helpers.go index ef5fa4ab58..5c7a4f98d0 100644 --- a/testutil/sims/simulation_helpers.go +++ b/testutil/sims/simulation_helpers.go @@ -52,6 +52,7 @@ func SetupSimulation(config simtypes.Config, dirPrefix, dbName string, verbose, // SimulationOperations retrieves the simulation params from the provided file path // and returns all the modules weighted operations +// // Deprecated: use BuildSimulationOperations with TxConfig func SimulationOperations(app runtime.AppI, cdc codec.JSONCodec, config simtypes.Config) []simtypes.WeightedOperation { return BuildSimulationOperations(app, cdc, config, moduletestutil.MakeTestTxConfig()) diff --git a/testutil/x/counter/module.go b/testutil/x/counter/module.go index 54b0123a1a..b2eccf7910 100644 --- a/testutil/x/counter/module.go +++ b/testutil/x/counter/module.go @@ -38,6 +38,7 @@ func NewAppModule(keeper *keeper.Keeper) AppModule { func (AppModule) ConsensusVersion() uint64 { return 1 } // Name returns the module's name. +// // Deprecated: kept for legacy reasons. func (AppModule) Name() string { return types.ModuleName } diff --git a/types/coin.go b/types/coin.go index a9054ac506..dd153ddb3b 100644 --- a/types/coin.go +++ b/types/coin.go @@ -109,6 +109,7 @@ func (coin Coin) IsLTE(other Coin) bool { } // IsEqual returns true if the two sets of Coins have the same value +// // Deprecated: Use Coin.Equal instead. func (coin Coin) IsEqual(other Coin) bool { return coin.Equal(other) @@ -700,6 +701,7 @@ func (coins Coins) AmountOf(denom string) math.Int { // AmountOfNoDenomValidation returns the amount of a denom from coins // without validating the denomination. +// // Deprecated: use AmountOf func (coins Coins) AmountOfNoDenomValidation(denom string) math.Int { return coins.AmountOf(denom) diff --git a/types/collections.go b/types/collections.go index 661835481a..5f69d43412 100644 --- a/types/collections.go +++ b/types/collections.go @@ -39,6 +39,7 @@ var ( LegacyDecValue collcodec.ValueCodec[math.LegacyDec] = legacyDecValueCodec{} // TimeKey represents a collections.KeyCodec to work with time.Time + // // Deprecated: exists only for state compatibility reasons, should not // be used for new storage keys using time. Please use the time KeyCodec // provided in the collections package. diff --git a/types/dec_coin.go b/types/dec_coin.go index ba4d0cb629..8f460d453c 100644 --- a/types/dec_coin.go +++ b/types/dec_coin.go @@ -82,6 +82,7 @@ func (coin DecCoin) IsLT(other DecCoin) bool { } // IsEqual returns true if the two sets of Coins have the same value. +// // Deprecated: Use DecCoin.Equal instead. func (coin DecCoin) IsEqual(other DecCoin) bool { return coin.Equal(other) diff --git a/types/module/module.go b/types/module/module.go index 7d49b53374..b3b3cccb37 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -198,6 +198,7 @@ type HasABCIGenesis interface { // AppModule is the form for an application module. Most of // its functionality has been moved to extension interfaces. +// // Deprecated: use appmodule.AppModule with a combination of extension interfaces instead. type AppModule interface { appmodule.AppModule @@ -229,6 +230,7 @@ type HasConsensusVersion interface { } // HasABCIEndblock is a released typo of HasABCIEndBlock. +// // Deprecated: use HasABCIEndBlock instead. type HasABCIEndblock HasABCIEndBlock diff --git a/types/result_test.go b/types/result_test.go index 8ebbfc7fc6..645c66530b 100644 --- a/types/result_test.go +++ b/types/result_test.go @@ -11,7 +11,7 @@ import ( cmtt "github.com/cometbft/cometbft/proto/tendermint/types" coretypes "github.com/cometbft/cometbft/rpc/core/types" cmt "github.com/cometbft/cometbft/types" - "github.com/golang/protobuf/proto" //nolint:staticcheck // keep for compat + "github.com/golang/protobuf/proto" //nolint:staticcheck // needed for testing "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/x/auth/migrations/legacytx/stdsign.go b/x/auth/migrations/legacytx/stdsign.go index 3491dc72ef..011cafb44e 100644 --- a/x/auth/migrations/legacytx/stdsign.go +++ b/x/auth/migrations/legacytx/stdsign.go @@ -19,6 +19,7 @@ import ( // LegacyMsg defines the old interface a message must fulfill, // containing Amino signing method. +// // Deprecated: Please use `Msg` instead. type LegacyMsg interface { sdk.Msg @@ -59,6 +60,7 @@ func mustSortJSON(bz []byte) []byte { } // StdSignBytes returns the bytes to sign for a transaction. +// // Deprecated: Please use x/tx/signing/aminojson instead. func StdSignBytes(chainID string, accnum, sequence, timeout uint64, fee StdFee, msgs []sdk.Msg, memo string) []byte { if RegressionTestingAminoCodec == nil { diff --git a/x/auth/tx/legacy_amino_json.go b/x/auth/tx/legacy_amino_json.go index 0c76158e5d..f37bdb7b80 100644 --- a/x/auth/tx/legacy_amino_json.go +++ b/x/auth/tx/legacy_amino_json.go @@ -22,6 +22,7 @@ type signModeLegacyAminoJSONHandler struct{} // NewSignModeLegacyAminoJSONHandler returns a new signModeLegacyAminoJSONHandler. // Note: The public constructor is only used for testing. +// // Deprecated: Please use x/tx/signing/aminojson instead. func NewSignModeLegacyAminoJSONHandler() signing.SignModeHandler { return signModeLegacyAminoJSONHandler{} diff --git a/x/auth/tx/legacy_amino_json_test.go b/x/auth/tx/legacy_amino_json_test.go index 9fe79c2326..55215e3bea 100644 --- a/x/auth/tx/legacy_amino_json_test.go +++ b/x/auth/tx/legacy_amino_json_test.go @@ -56,28 +56,32 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) { expectedSignBz []byte }{ { - "signer which is also fee payer (no tips)", addr1.String(), - func(w *wrapper) {}, - legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas}, []sdk.Msg{msg}, memo), + name: "signer which is also fee payer (no tips)", + signer: addr1.String(), + malleate: func(w *wrapper) {}, + expectedSignBz: legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas}, []sdk.Msg{msg}, memo), //nolint:staticcheck // needed for legacy testing }, { - "explicit fee payer", addr1.String(), - func(w *wrapper) { w.SetFeePayer(addr2) }, - legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Payer: addr2.String()}, []sdk.Msg{msg}, memo), + name: "explicit fee payer", + signer: addr1.String(), + malleate: func(w *wrapper) { w.SetFeePayer(addr2) }, + expectedSignBz: legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Payer: addr2.String()}, []sdk.Msg{msg}, memo), //nolint:staticcheck // needed for legacy testing }, { - "explicit fee granter", addr1.String(), - func(w *wrapper) { w.SetFeeGranter(addr2) }, - legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Granter: addr2.String()}, []sdk.Msg{msg}, memo), + name: "explicit fee granter", + signer: addr1.String(), + malleate: func(w *wrapper) { w.SetFeeGranter(addr2) }, + expectedSignBz: legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Granter: addr2.String()}, []sdk.Msg{msg}, memo), //nolint:staticcheck // needed for legacy testing }, { - "explicit fee payer and fee granter", addr1.String(), - func(w *wrapper) { + name: "explicit fee payer and fee granter", + signer: addr1.String(), + malleate: func(w *wrapper) { w.SetFeePayer(addr2) w.SetFeeGranter(addr2) }, - legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Payer: addr2.String(), Granter: addr2.String()}, []sdk.Msg{msg}, memo), + expectedSignBz: legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Payer: addr2.String(), Granter: addr2.String()}, []sdk.Msg{msg}, memo), //nolint:staticcheck // needed for legacy testing }, } @@ -156,28 +160,32 @@ func TestLegacyAminoJSONHandler_AllGetSignBytesComparison(t *testing.T) { expectedSignBz []byte }{ { - "signer which is also fee payer (no tips)", addr1.String(), - func(w *wrapper) {}, - legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas}, []sdk.Msg{msg}, memo), + name: "signer which is also fee payer (no tips)", + signer: addr1.String(), + malleate: func(w *wrapper) {}, + expectedSignBz: legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas}, []sdk.Msg{msg}, memo), // nolint:staticcheck // maintain for legacy testing }, { - "explicit fee payer", addr1.String(), - func(w *wrapper) { w.SetFeePayer(addr2) }, - legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Payer: addr2.String()}, []sdk.Msg{msg}, memo), + name: "explicit fee payer", + signer: addr1.String(), + malleate: func(w *wrapper) { w.SetFeePayer(addr2) }, + expectedSignBz: legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Payer: addr2.String()}, []sdk.Msg{msg}, memo), // nolint:staticcheck // maintain for legacy testing }, { - "explicit fee granter", addr1.String(), - func(w *wrapper) { w.SetFeeGranter(addr2) }, - legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Granter: addr2.String()}, []sdk.Msg{msg}, memo), + name: "explicit fee granter", + signer: addr1.String(), + malleate: func(w *wrapper) { w.SetFeeGranter(addr2) }, + expectedSignBz: legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Granter: addr2.String()}, []sdk.Msg{msg}, memo), // nolint:staticcheck // maintain for legacy testing }, { - "explicit fee payer and fee granter", addr1.String(), - func(w *wrapper) { + name: "explicit fee payer and fee granter", + signer: addr1.String(), + malleate: func(w *wrapper) { w.SetFeePayer(addr2) w.SetFeeGranter(addr2) }, - legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Payer: addr2.String(), Granter: addr2.String()}, []sdk.Msg{msg}, memo), + expectedSignBz: legacytx.StdSignBytes(chainID, accNum, seqNum, timeout, legacytx.StdFee{Amount: coins, Gas: gas, Payer: addr2.String(), Granter: addr2.String()}, []sdk.Msg{msg}, memo), // nolint:staticcheck // maintain for legacy testing }, } diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 41b5e3c398..3952a8de76 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -6,7 +6,7 @@ import ( "strings" gogogrpc "github.com/cosmos/gogoproto/grpc" - "github.com/golang/protobuf/proto" //nolint:staticcheck // keep for compat + "github.com/golang/protobuf/proto" //nolint:staticcheck // needed for testing "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/x/authz/msgs_test.go b/x/authz/msgs_test.go index 4979e6cb85..a6570d6a06 100644 --- a/x/authz/msgs_test.go +++ b/x/authz/msgs_test.go @@ -111,7 +111,7 @@ func TestAminoJSON(t *testing.T) { for i, tt := range tests { t.Run(fmt.Sprintf("case %d", i), func(t *testing.T) { tx.Msgs = []sdk.Msg{tt.msg} - legacyJSON := string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{tt.msg}, "memo")) + legacyJSON := string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{tt.msg}, "memo")) // nolint:staticcheck // maintain for legacy testing require.Equal(t, tt.exp, legacyJSON) legacyAny, err := cdctypes.NewAnyWithValue(tt.msg) diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index 51650ce420..76ab09dbfe 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -72,7 +72,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() { types.NewQueryBalanceRequest(addr, barDenom), "", func(res *types.QueryBalanceResponse) { - suite.True(res.Balance.IsEqual(newBarCoin(30))) + suite.True(res.Balance.Equal(newBarCoin(30))) }, }, } diff --git a/x/bank/types/params_legacy.go b/x/bank/types/params_legacy.go index b8f8d183f5..cdbac68788 100644 --- a/x/bank/types/params_legacy.go +++ b/x/bank/types/params_legacy.go @@ -10,6 +10,7 @@ import ( var ( // KeySendEnabled is store's key for SendEnabled Params + // // Deprecated: Use the SendEnabled functionality in the keeper. KeySendEnabled = []byte("SendEnabled") // KeyDefaultSendEnabled is store's key for the DefaultSendEnabled option diff --git a/x/epochs/module.go b/x/epochs/module.go index 2f9fc081dc..a01560be2c 100644 --- a/x/epochs/module.go +++ b/x/epochs/module.go @@ -47,6 +47,7 @@ func NewAppModule(keeper *keeper.Keeper) AppModule { func (am AppModule) IsAppModule() {} // Name returns the epochs module's name. +// // Deprecated: kept for legacy reasons. func (AppModule) Name() string { return types.ModuleName diff --git a/x/feegrant/client/cli/tx_test.go b/x/feegrant/client/cli/tx_test.go index 109199c96d..327a7e2a16 100644 --- a/x/feegrant/client/cli/tx_test.go +++ b/x/feegrant/client/cli/tx_test.go @@ -529,7 +529,7 @@ func (s *CLITestSuite) msgSubmitLegacyProposal(clientCtx client.Context, from, t args = append(args, extraArgs...) - cmd := govcli.NewCmdSubmitLegacyProposal() + cmd := govcli.NewCmdSubmitLegacyProposal() //nolint:staticcheck // needed for legacy testing out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) s.Require().NoError(err) diff --git a/x/feegrant/msgs_test.go b/x/feegrant/msgs_test.go index a415fb797f..cb7a0aaf7e 100644 --- a/x/feegrant/msgs_test.go +++ b/x/feegrant/msgs_test.go @@ -34,13 +34,13 @@ func TestAminoJSON(t *testing.T) { tx.Msgs = []sdk.Msg{msg} require.Equal(t, `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgGrantAllowance","value":{"allowance":{"type":"cosmos-sdk/BasicAllowance","value":{"spend_limit":[{"amount":"100","denom":"foo"}]}},"grantee":"cosmos1def","granter":"cosmos1abc"}}],"sequence":"1","timeout_height":"1"}`, - string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo")), + string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo")), //nolint:staticcheck // needed for legacy testing ) msg = &feegrant.MsgRevokeAllowance{Granter: "cosmos1abc", Grantee: "cosmos1def"} tx.Msgs = []sdk.Msg{msg} require.Equal(t, `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgRevokeAllowance","value":{"grantee":"cosmos1def","granter":"cosmos1abc"}}],"sequence":"1","timeout_height":"1"}`, - string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo")), + string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo")), //nolint:staticcheck // needed for legacy testing ) } diff --git a/x/genutil/client/cli/commands.go b/x/genutil/client/cli/commands.go index bd2a5f0503..690afd8ec2 100644 --- a/x/genutil/client/cli/commands.go +++ b/x/genutil/client/cli/commands.go @@ -11,6 +11,7 @@ import ( ) // GenesisCoreCommand adds core sdk's sub-commands into genesis command. +// // Deprecated: use Commands instead. func GenesisCoreCommand(txConfig client.TxConfig, moduleBasics module.BasicManager, defaultNodeHome string) *cobra.Command { return Commands(txConfig, moduleBasics, defaultNodeHome) diff --git a/x/gov/client/cli/prompt_test.go b/x/gov/client/cli/prompt_test.go index fd1dd3f62f..e30a2ccd18 100644 --- a/x/gov/client/cli/prompt_test.go +++ b/x/gov/client/cli/prompt_test.go @@ -1,5 +1,4 @@ //go:build !race -// +build !race // Disabled -race because the package github.com/manifoldco/promptui@v0.9.0 // has a data race and this code exposes it, but fixing it would require diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index d6c4a79d67..42a07e2d82 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -185,6 +185,7 @@ func NewCmdCancelProposal() *cobra.Command { } // NewCmdSubmitLegacyProposal implements submitting a proposal transaction command. +// // Deprecated: please use NewCmdSubmitProposal instead. func NewCmdSubmitLegacyProposal() *cobra.Command { cmd := &cobra.Command{ diff --git a/x/gov/client/cli/util.go b/x/gov/client/cli/util.go index 5153dafd97..8cd125bdac 100644 --- a/x/gov/client/cli/util.go +++ b/x/gov/client/cli/util.go @@ -181,6 +181,7 @@ func ReadGovPropCmdFlags(proposer string, flagSet *pflag.FlagSet) (*govv1.MsgSub // Setting the messages is up to the caller. // // See also AddGovPropFlagsToCmd. +// // Deprecated: use ReadPropCmdFlags instead, as this depends on global bech32 prefixes. func ReadGovPropFlags(clientCtx client.Context, flagSet *pflag.FlagSet) (*govv1.MsgSubmitProposal, error) { return ReadGovPropCmdFlags(clientCtx.GetFromAddress().String(), flagSet) diff --git a/x/gov/client/utils/query.go b/x/gov/client/utils/query.go index 6493a74233..bc376f2f5d 100644 --- a/x/gov/client/utils/query.go +++ b/x/gov/client/utils/query.go @@ -161,6 +161,7 @@ func QueryVoteByTxQuery(clientCtx client.Context, params v1.QueryVoteParams) ([] } // QueryProposerByTxQuery will query for a proposer of a governance proposal by ID. +// // Deprecated: Should not be used, as not always accurate. It will be removed in v0.51. func QueryProposerByTxQuery(clientCtx client.Context, proposalID uint64) (Proposer, error) { q := fmt.Sprintf("%s.%s='%d'", types.EventTypeSubmitProposal, types.AttributeKeyProposalID, proposalID) diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index ffb25d98e7..bca4f74cde 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -120,12 +120,12 @@ func NewKeeper( authority: authority, Constitution: collections.NewItem(sb, types.ConstitutionKey, "constitution", collections.StringValue), Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[v1.Params](cdc)), - Deposits: collections.NewMap(sb, types.DepositsKeyPrefix, "deposits", collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), codec.CollValue[v1.Deposit](cdc)), // nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility - Votes: collections.NewMap(sb, types.VotesKeyPrefix, "votes", collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), codec.CollValue[v1.Vote](cdc)), // nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + Deposits: collections.NewMap(sb, types.DepositsKeyPrefix, "deposits", collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), codec.CollValue[v1.Deposit](cdc)), // nolint:staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + Votes: collections.NewMap(sb, types.VotesKeyPrefix, "votes", collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), codec.CollValue[v1.Vote](cdc)), // nolint:staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility ProposalID: collections.NewSequence(sb, types.ProposalIDKey, "proposal_id"), Proposals: collections.NewMap(sb, types.ProposalsKeyPrefix, "proposals", collections.Uint64Key, codec.CollValue[v1.Proposal](cdc)), - ActiveProposalsQueue: collections.NewMap(sb, types.ActiveProposalQueuePrefix, "active_proposals_queue", collections.PairKeyCodec(sdk.TimeKey, collections.Uint64Key), collections.Uint64Value), // sdk.TimeKey is needed to retain state compatibility - InactiveProposalsQueue: collections.NewMap(sb, types.InactiveProposalQueuePrefix, "inactive_proposals_queue", collections.PairKeyCodec(sdk.TimeKey, collections.Uint64Key), collections.Uint64Value), // sdk.TimeKey is needed to retain state compatibility + ActiveProposalsQueue: collections.NewMap(sb, types.ActiveProposalQueuePrefix, "active_proposals_queue", collections.PairKeyCodec(sdk.TimeKey, collections.Uint64Key), collections.Uint64Value), // nolint:staticcheck // sdk.TimeKey is needed to retain state compatibility + InactiveProposalsQueue: collections.NewMap(sb, types.InactiveProposalQueuePrefix, "inactive_proposals_queue", collections.PairKeyCodec(sdk.TimeKey, collections.Uint64Key), collections.Uint64Value), // nolint:staticcheck // sdk.TimeKey is needed to retain state compatibility VotingPeriodProposals: collections.NewMap(sb, types.VotingPeriodProposalKeyPrefix, "voting_period_proposals", collections.Uint64Key, collections.BytesValue), } diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index c1d3f749c6..eb6ee0b328 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -378,6 +378,7 @@ func simulateMsgDeposit( } // SimulateMsgVote generates a MsgVote with random values. +// // Deprecated: this is an internal method and will be removed func SimulateMsgVote( txGen client.TxConfig, diff --git a/x/mint/types/minter_test.go b/x/mint/types/minter_test.go index 01b81f8117..665262225c 100644 --- a/x/mint/types/minter_test.go +++ b/x/mint/types/minter_test.go @@ -82,7 +82,7 @@ func TestBlockProvision(t *testing.T) { expProvisions := sdk.NewCoin(params.MintDenom, math.NewInt(tc.expProvisions)) - require.True(t, expProvisions.IsEqual(provisions), + require.True(t, expProvisions.Equal(provisions), "test: %v\n\tExp: %v\n\tGot: %v\n", i, tc.expProvisions, provisions) } diff --git a/x/protocolpool/module.go b/x/protocolpool/module.go index ae08368f67..f18117ed40 100644 --- a/x/protocolpool/module.go +++ b/x/protocolpool/module.go @@ -28,7 +28,7 @@ var ( _ module.AppModuleSimulation = AppModule{} _ module.HasGenesis = AppModule{} _ module.HasServices = AppModule{} - _ module.AppModule = AppModule{} + _ module.AppModule = AppModule{} //nolint:staticcheck // maintain for legacy _ appmodule.AppModule = AppModule{} _ appmodule.HasBeginBlocker = AppModule{} @@ -56,6 +56,7 @@ func NewAppModule(keeper keeper.Keeper, func (AppModule) IsAppModule() {} // Name returns the protocolpool module's name. +// // Deprecated: kept for legacy reasons. func (AppModule) Name() string { return types.ModuleName } diff --git a/x/staking/types/msg_test.go b/x/staking/types/msg_test.go index 23f5047de1..683ba009f7 100644 --- a/x/staking/types/msg_test.go +++ b/x/staking/types/msg_test.go @@ -46,6 +46,6 @@ func TestMsgDecode(t *testing.T) { require.NoError(t, err) msg2, ok := msgUnmarshaled.(*types.MsgCreateValidator) require.True(t, ok) - require.True(t, msg.Value.IsEqual(msg2.Value)) + require.True(t, msg.Value.Equal(msg2.Value)) require.True(t, msg.Pubkey.Equal(msg2.Pubkey)) } diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 697c6d21a4..71cdda5bd9 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -58,7 +58,7 @@ func NewCmdSubmitUpgradeProposal(ac addresscodec.Codec) *cobra.Command { return err } - proposal, err := cli.ReadGovPropFlags(clientCtx, cmd.Flags()) + proposal, err := cli.ReadGovPropCmdFlags(clientCtx.GetFromAddress().String(), cmd.Flags()) if err != nil { return err } @@ -145,7 +145,7 @@ func NewCmdSubmitCancelUpgradeProposal(ac addresscodec.Codec) *cobra.Command { return err } - proposal, err := cli.ReadGovPropFlags(clientCtx, cmd.Flags()) + proposal, err := cli.ReadGovPropCmdFlags(clientCtx.GetFromAddress().String(), cmd.Flags()) if err != nil { return err } diff --git a/x/upgrade/types/proposal.go b/x/upgrade/types/proposal.go index ebac9a18eb..90fa6065fe 100644 --- a/x/upgrade/types/proposal.go +++ b/x/upgrade/types/proposal.go @@ -10,6 +10,7 @@ const ( ) // NewSoftwareUpgradeProposal creates a new SoftwareUpgradeProposal instance. +// // Deprecated: this proposal is considered legacy and is deprecated in favor of // Msg-based gov proposals. See MsgSoftwareUpgrade. func NewSoftwareUpgradeProposal(title, description string, plan Plan) gov.Content {