diff --git a/x/bank/keeper/genesis_test.go b/x/bank/keeper/genesis_test.go index 0432d1b0fd94..d22c1a018ce1 100644 --- a/x/bank/keeper/genesis_test.go +++ b/x/bank/keeper/genesis_test.go @@ -3,6 +3,7 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" "cosmossdk.io/x/bank/types" + banktypes "cosmossdk.io/x/bank/types" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" sdk "github.com/cosmos/cosmos-sdk/types" @@ -20,6 +21,10 @@ func (suite *KeeperTestSuite) TestExportGenesis() { suite.Require().NoError(err) expTotalSupply = expTotalSupply.Add(genesisSupply...) + suite.Require().NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ + DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, + })) + for i := range []int{1, 2} { suite.bankKeeper.SetDenomMetaData(ctx, expectedMetadata[i]) accAddr, err1 := suite.authKeeper.AddressCodec().StringToBytes(expectedBalances[i].Address) diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index a5b4e352c88c..c2bc94f1efe1 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -10,6 +10,7 @@ import ( vestingtypes "cosmossdk.io/x/auth/vesting/types" "cosmossdk.io/x/bank/testutil" "cosmossdk.io/x/bank/types" + banktypes "cosmossdk.io/x/bank/types" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -606,6 +607,10 @@ func (suite *KeeperTestSuite) TestGRPCDenomOwners() { suite.mockMintCoins(mintAcc) suite.Require().NoError(keeper.MintCoins(ctx, types.MintModuleName, initCoins)) + suite.Require().NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ + DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, + })) + for i := 0; i < 10; i++ { addr := sdk.AccAddress(fmt.Sprintf("account-%d", i)) @@ -831,6 +836,10 @@ func (suite *KeeperTestSuite) TestGRPCDenomOwnersByQuery() { suite.mockMintCoins(mintAcc) suite.Require().NoError(keeper.MintCoins(ctx, types.MintModuleName, newCoins)) + suite.Require().NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ + DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, + })) + for i := 0; i < 10; i++ { addr := sdk.AccAddress(fmt.Sprintf("account-%d", i)) diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 3def2b33ba6a..c9d07ccd431e 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -175,7 +175,7 @@ func (suite *KeeperTestSuite) mockMintCoins(moduleAcc *authtypes.ModuleAccount) suite.authKeeper.EXPECT().GetModuleAccount(suite.ctx, moduleAcc.Name).Return(moduleAcc) } -func (suite *KeeperTestSuite) mockSendCoinsFromModuleToAccount(moduleAcc *authtypes.ModuleAccount, accAddr sdk.AccAddress) { +func (suite *KeeperTestSuite) mockSendCoinsFromModuleToAccount(moduleAcc *authtypes.ModuleAccount, _ sdk.AccAddress) { suite.authKeeper.EXPECT().GetModuleAddress(moduleAcc.Name).Return(moduleAcc.GetAddress()) suite.authKeeper.EXPECT().GetAccount(suite.ctx, moduleAcc.GetAddress()).Return(moduleAcc).AnyTimes() } @@ -195,7 +195,7 @@ func (suite *KeeperTestSuite) mockSendCoinsFromAccountToModule(acc *authtypes.Ba suite.authKeeper.EXPECT().GetAccount(suite.ctx, acc.GetAddress()).Return(acc) } -func (suite *KeeperTestSuite) mockSendCoins(ctx context.Context, sender sdk.AccountI, receiver sdk.AccAddress) { +func (suite *KeeperTestSuite) mockSendCoins(ctx context.Context, sender sdk.AccountI, _ sdk.AccAddress) { suite.authKeeper.EXPECT().GetAccount(ctx, sender.GetAddress()).Return(sender) } @@ -204,7 +204,7 @@ func (suite *KeeperTestSuite) mockFundAccount(receiver sdk.AccAddress) { suite.mockSendCoinsFromModuleToAccount(mintAcc, receiver) } -func (suite *KeeperTestSuite) mockInputOutputCoins(inputs []sdk.AccountI, outputs []sdk.AccAddress) { +func (suite *KeeperTestSuite) mockInputOutputCoins(inputs []sdk.AccountI, _ []sdk.AccAddress) { for _, input := range inputs { suite.authKeeper.EXPECT().GetAccount(suite.ctx, input.GetAddress()).Return(input) } @@ -412,6 +412,9 @@ func (suite *KeeperTestSuite) TestSupply_DelegateUndelegateCoins() { DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, })) + res := keeper.GetParams(ctx) + fmt.Println(res) + // set initial balances suite.mockMintCoins(mintAcc) require.NoError(keeper.MintCoins(ctx, banktypes.MintModuleName, initCoins)) @@ -1699,6 +1702,10 @@ func (suite *KeeperTestSuite) TestDelegateCoins() { vacc, err := vesting.NewContinuousVestingAccount(acc0, origCoins, ctx.HeaderInfo().Time.Unix(), endTime.Unix()) suite.Require().NoError(err) + suite.Require().NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ + DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, + })) + suite.mockFundAccount(accAddrs[0]) require.NoError(banktestutil.FundAccount(ctx, suite.bankKeeper, accAddrs[0], origCoins)) @@ -1877,6 +1884,10 @@ func (suite *KeeperTestSuite) TestIterateAllDenomMetaData() { func (suite *KeeperTestSuite) TestBalanceTrackingEvents() { require := suite.Require() + require.NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ + DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, + })) + // mint coins suite.mockMintCoins(multiPermAcc) require.NoError( @@ -1885,6 +1896,7 @@ func (suite *KeeperTestSuite) TestBalanceTrackingEvents() { multiPermAcc.Name, sdk.NewCoins(sdk.NewCoin("utxo", math.NewInt(100000)))), ) + // send coins to address suite.mockSendCoinsFromModuleToAccount(multiPermAcc, accAddrs[0]) require.NoError(