From e7f4969308408960886a320668a6ed118a741d84 Mon Sep 17 00:00:00 2001 From: "Masih H. Derkani" Date: Wed, 1 Oct 2025 11:02:53 +0100 Subject: [PATCH] Upgrade to go 1.24.5 UUpgrade to go 1.24.5, consistent with sei-chain. While at it, resolve false negative test failures: * use testing temp directory * use constant pattern for formatting printers * follow required go naming convention in examples --- sei-cosmos/crypto/hd/hdpath_test.go | 4 ++-- sei-cosmos/go.mod | 4 ++-- sei-cosmos/server/start.go | 7 +++---- sei-cosmos/x/auth/ante/fee.go | 2 +- sei-cosmos/x/auth/keeper/grpc_query.go | 2 +- sei-cosmos/x/authz/keeper/grpc_query.go | 8 ++++---- sei-cosmos/x/capability/keeper/keeper.go | 2 +- sei-cosmos/x/capability/types/types.go | 2 +- sei-cosmos/x/evidence/keeper/grpc_query.go | 2 +- sei-cosmos/x/feegrant/keeper/grpc_query.go | 4 ++-- sei-cosmos/x/genutil/collect_test.go | 8 +------- 11 files changed, 19 insertions(+), 26 deletions(-) diff --git a/sei-cosmos/crypto/hd/hdpath_test.go b/sei-cosmos/crypto/hd/hdpath_test.go index 8b1c40692c..ef63439dc2 100644 --- a/sei-cosmos/crypto/hd/hdpath_test.go +++ b/sei-cosmos/crypto/hd/hdpath_test.go @@ -186,7 +186,7 @@ func TestDeriveHDPathRange(t *testing.T) { } } -func ExampleStringifyPathParams() { +func ExampleNewParams() { path := hd.NewParams(44, 0, 0, false, 0) fmt.Println(path.String()) path = hd.NewParams(44, 33, 7, true, 9) @@ -196,7 +196,7 @@ func ExampleStringifyPathParams() { // m/44'/33'/7'/1/9 } -func ExampleSomeBIP32TestVecs() { +func ExampleComputeMastersFromSeed() { seed := mnemonicToSeed("barrel original fuel morning among eternal " + "filter ball stove pluck matrix mechanic") master, ch := hd.ComputeMastersFromSeed(seed) diff --git a/sei-cosmos/go.mod b/sei-cosmos/go.mod index 6a50c090ad..dd43018e2f 100644 --- a/sei-cosmos/go.mod +++ b/sei-cosmos/go.mod @@ -1,7 +1,7 @@ -go 1.21 - module github.com/cosmos/cosmos-sdk +go 1.24.5 + require ( cosmossdk.io/errors v1.0.0 github.com/99designs/keyring v1.2.1 diff --git a/sei-cosmos/server/start.go b/sei-cosmos/server/start.go index 6599a2214c..ae702e1870 100644 --- a/sei-cosmos/server/start.go +++ b/sei-cosmos/server/start.go @@ -6,6 +6,8 @@ import ( "context" "fmt" "net/http" + //nolint:gosec,G108 + _ "net/http/pprof" "os" "path" "runtime/pprof" @@ -25,9 +27,6 @@ import ( "go.opentelemetry.io/otel/sdk/trace" "google.golang.org/grpc" - //nolint:gosec,G108 - _ "net/http/pprof" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -310,7 +309,7 @@ func startStandAlone(ctx *Context, appCreator types.AppCreator) error { goCtx, cancel := context.WithCancel(context.Background()) err = svr.Start(goCtx) if err != nil { - fmt.Printf(err.Error() + "\n") + fmt.Println(err.Error()) os.Exit(1) } diff --git a/sei-cosmos/x/auth/ante/fee.go b/sei-cosmos/x/auth/ante/fee.go index 83b56a580b..17c40a6fbd 100644 --- a/sei-cosmos/x/auth/ante/fee.go +++ b/sei-cosmos/x/auth/ante/fee.go @@ -207,7 +207,7 @@ func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI err := bankKeeper.DeferredSendCoinsFromAccountToModule(ctx, acc.GetAddress(), types.FeeCollectorName, fees) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error()) + return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "%s", err.Error()) } return nil diff --git a/sei-cosmos/x/auth/keeper/grpc_query.go b/sei-cosmos/x/auth/keeper/grpc_query.go index 8f803ccdbf..1e89a3cebe 100644 --- a/sei-cosmos/x/auth/keeper/grpc_query.go +++ b/sei-cosmos/x/auth/keeper/grpc_query.go @@ -67,7 +67,7 @@ func (ak AccountKeeper) Account(c context.Context, req *types.QueryAccountReques any, err := codectypes.NewAnyWithValue(account) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, "%s", err.Error()) } return &types.QueryAccountResponse{Account: any}, nil diff --git a/sei-cosmos/x/authz/keeper/grpc_query.go b/sei-cosmos/x/authz/keeper/grpc_query.go index 1751cab970..b012a8db28 100644 --- a/sei-cosmos/x/authz/keeper/grpc_query.go +++ b/sei-cosmos/x/authz/keeper/grpc_query.go @@ -39,7 +39,7 @@ func (k Keeper) Grants(c context.Context, req *authz.QueryGrantsRequest) (*authz } authorizationAny, err := codectypes.NewAnyWithValue(authorization) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, "%s", err.Error()) } return &authz.QueryGrantsResponse{ Grants: []*authz.Grant{{ @@ -61,7 +61,7 @@ func (k Keeper) Grants(c context.Context, req *authz.QueryGrantsRequest) (*authz authorizationAny, err := codectypes.NewAnyWithValue(auth1) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, "%s", err.Error()) } return &authz.Grant{ Authorization: authorizationAny, @@ -103,7 +103,7 @@ func (k Keeper) GranterGrants(c context.Context, req *authz.QueryGranterGrantsRe any, err := codectypes.NewAnyWithValue(auth1) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, "%s", err.Error()) } grantee := firstAddressFromGrantStoreKey(key) @@ -155,7 +155,7 @@ func (k Keeper) GranteeGrants(c context.Context, req *authz.QueryGranteeGrantsRe authorizationAny, err := codectypes.NewAnyWithValue(auth1) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, "%s", err.Error()) } return &authz.GrantAuthorization{ diff --git a/sei-cosmos/x/capability/keeper/keeper.go b/sei-cosmos/x/capability/keeper/keeper.go index 4ba2579cf4..3919f744aa 100644 --- a/sei-cosmos/x/capability/keeper/keeper.go +++ b/sei-cosmos/x/capability/keeper/keeper.go @@ -229,7 +229,7 @@ func (sk ScopedKeeper) NewCapability(ctx sdk.Context, name string) (*types.Capab store := ctx.KVStore(sk.storeKey) if _, ok := sk.GetCapability(ctx, name); ok { - return nil, sdkerrors.Wrapf(types.ErrCapabilityTaken, fmt.Sprintf("module: %s, name: %s", sk.module, name)) + return nil, sdkerrors.Wrapf(types.ErrCapabilityTaken, "module: %s, name: %s", sk.module, name) } // create new capability with the current global index diff --git a/sei-cosmos/x/capability/types/types.go b/sei-cosmos/x/capability/types/types.go index 2dcceb8c88..053f178074 100644 --- a/sei-cosmos/x/capability/types/types.go +++ b/sei-cosmos/x/capability/types/types.go @@ -47,7 +47,7 @@ func (co *CapabilityOwners) Set(owner Owner) error { i, ok := co.Get(owner) if ok { // owner already exists at co.Owners[i] - return sdkerrors.Wrapf(ErrOwnerClaimed, owner.String()) + return sdkerrors.Wrapf(ErrOwnerClaimed, "%s", owner.String()) } // owner does not exist in the set of owners, so we insert at position i diff --git a/sei-cosmos/x/evidence/keeper/grpc_query.go b/sei-cosmos/x/evidence/keeper/grpc_query.go index f084c16717..d30d6ed6bd 100644 --- a/sei-cosmos/x/evidence/keeper/grpc_query.go +++ b/sei-cosmos/x/evidence/keeper/grpc_query.go @@ -42,7 +42,7 @@ func (k Keeper) Evidence(c context.Context, req *types.QueryEvidenceRequest) (*t evidenceAny, err := codectypes.NewAnyWithValue(msg) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, "%s", err.Error()) } return &types.QueryEvidenceResponse{Evidence: evidenceAny}, nil diff --git a/sei-cosmos/x/feegrant/keeper/grpc_query.go b/sei-cosmos/x/feegrant/keeper/grpc_query.go index 87278c4c59..34ab74415e 100644 --- a/sei-cosmos/x/feegrant/keeper/grpc_query.go +++ b/sei-cosmos/x/feegrant/keeper/grpc_query.go @@ -36,7 +36,7 @@ func (q Keeper) Allowance(c context.Context, req *feegrant.QueryAllowanceRequest feeAllowance, err := q.GetAllowance(ctx, granterAddr, granteeAddr) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, "%s", err.Error()) } msg, ok := feeAllowance.(proto.Message) @@ -46,7 +46,7 @@ func (q Keeper) Allowance(c context.Context, req *feegrant.QueryAllowanceRequest feeAllowanceAny, err := codectypes.NewAnyWithValue(msg) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Errorf(codes.Internal, "%s", err.Error()) } return &feegrant.QueryAllowanceResponse{ diff --git a/sei-cosmos/x/genutil/collect_test.go b/sei-cosmos/x/genutil/collect_test.go index 46e20f88f1..91d4908e8a 100644 --- a/sei-cosmos/x/genutil/collect_test.go +++ b/sei-cosmos/x/genutil/collect_test.go @@ -2,7 +2,6 @@ package genutil_test import ( "encoding/json" - "io/ioutil" "os" "path/filepath" "testing" @@ -38,12 +37,7 @@ func (dni *doNothingIterator) IterateGenesisBalances(_ codec.JSONCodec, _ map[st // Ensures that CollectTx correctly traverses directories and won't error out on encountering // a directory during traversal of the first level. See issue https://github.com/cosmos/cosmos-sdk/issues/6788. func TestCollectTxsHandlesDirectories(t *testing.T) { - testDir, err := ioutil.TempDir(os.TempDir(), "testCollectTxs") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(testDir) - + testDir := t.TempDir() // 1. We'll insert a directory as the first element before JSON file. subDirPath := filepath.Join(testDir, "_adir") if err := os.MkdirAll(subDirPath, 0755); err != nil {