From 600c2468b8ccac4d071829550b8a0d99f1e0e46a Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 22 Apr 2024 08:36:15 +0200 Subject: [PATCH] chore: fix codeql issue (#20113) --- crypto/keys/bcrypt/bcrypt.go | 2 +- simapp/app_config.go | 1 - .../auth/keeper/msg_server_test.go | 20 +++++++++---------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/crypto/keys/bcrypt/bcrypt.go b/crypto/keys/bcrypt/bcrypt.go index 511d6ff7a16c..56ae47669e1b 100644 --- a/crypto/keys/bcrypt/bcrypt.go +++ b/crypto/keys/bcrypt/bcrypt.go @@ -47,7 +47,7 @@ func (ih InvalidHashPrefixError) Error() string { return fmt.Sprintf("crypto/bcrypt: bcrypt hashes must start with '$', but hashedSecret started with '%c'", byte(ih)) } -type InvalidCostError int +type InvalidCostError uint32 func (ic InvalidCostError) Error() string { return fmt.Sprintf("crypto/bcrypt: cost %d is outside allowed range (%d,%d)", int(ic), MinCost, MaxCost) diff --git a/simapp/app_config.go b/simapp/app_config.go index 1ac042beaa76..95d978c7a6cc 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -31,7 +31,6 @@ import ( vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/accounts" - _ "cosmossdk.io/x/accounts" // import for side-effects _ "cosmossdk.io/x/auth/tx/config" // import for side-effects authtypes "cosmossdk.io/x/auth/types" _ "cosmossdk.io/x/auth/vesting" // import for side-effects diff --git a/tests/integration/auth/keeper/msg_server_test.go b/tests/integration/auth/keeper/msg_server_test.go index f2c629becf01..ff2f4c89cbec 100644 --- a/tests/integration/auth/keeper/msg_server_test.go +++ b/tests/integration/auth/keeper/msg_server_test.go @@ -18,10 +18,8 @@ import ( "cosmossdk.io/x/auth" authkeeper "cosmossdk.io/x/auth/keeper" authsims "cosmossdk.io/x/auth/simulation" - "cosmossdk.io/x/auth/types" authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" - "cosmossdk.io/x/bank/keeper" bankkeeper "cosmossdk.io/x/bank/keeper" "cosmossdk.io/x/bank/testutil" banktypes "cosmossdk.io/x/bank/types" @@ -108,7 +106,7 @@ func initFixture(t *testing.T) *fixture { blockedAddresses := map[string]bool{ authKeeper.GetAuthority(): false, } - bankKeeper := keeper.NewBaseKeeper( + bankKeeper := bankkeeper.NewBaseKeeper( runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), cdc, authKeeper, @@ -186,13 +184,13 @@ func TestAsyncExec(t *testing.T) { testCases := []struct { name string - req *types.MsgNonAtomicExec + req *authtypes.MsgNonAtomicExec expectErr bool expErrMsg string }{ { name: "empty signer address", - req: &types.MsgNonAtomicExec{ + req: &authtypes.MsgNonAtomicExec{ Signer: "", Msgs: []*codectypes.Any{}, }, @@ -201,7 +199,7 @@ func TestAsyncExec(t *testing.T) { }, { name: "invalid signer address", - req: &types.MsgNonAtomicExec{ + req: &authtypes.MsgNonAtomicExec{ Signer: "invalid", Msgs: []*codectypes.Any{}, }, @@ -210,7 +208,7 @@ func TestAsyncExec(t *testing.T) { }, { name: "empty msgs", - req: &types.MsgNonAtomicExec{ + req: &authtypes.MsgNonAtomicExec{ Signer: addrs[0].String(), Msgs: []*codectypes.Any{}, }, @@ -219,7 +217,7 @@ func TestAsyncExec(t *testing.T) { }, { name: "valid msg", - req: &types.MsgNonAtomicExec{ + req: &authtypes.MsgNonAtomicExec{ Signer: addrs[0].String(), Msgs: []*codectypes.Any{msgAny}, }, @@ -227,7 +225,7 @@ func TestAsyncExec(t *testing.T) { }, { name: "multiple messages being executed", - req: &types.MsgNonAtomicExec{ + req: &authtypes.MsgNonAtomicExec{ Signer: addrs[0].String(), Msgs: []*codectypes.Any{msgAny, msgAny}, }, @@ -235,7 +233,7 @@ func TestAsyncExec(t *testing.T) { }, { name: "multiple messages with different signers", - req: &types.MsgNonAtomicExec{ + req: &authtypes.MsgNonAtomicExec{ Signer: addrs[0].String(), Msgs: []*codectypes.Any{msgAny, msgAny2}, }, @@ -244,7 +242,7 @@ func TestAsyncExec(t *testing.T) { }, { name: "multi msg with one failing being executed", - req: &types.MsgNonAtomicExec{ + req: &authtypes.MsgNonAtomicExec{ Signer: addrs[0].String(), Msgs: []*codectypes.Any{msgAny, failingMsgAny}, },