Skip to content

Commit

Permalink
set value to true
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed May 13, 2024
1 parent 4539db5 commit 55fcb7b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
5 changes: 5 additions & 0 deletions x/bank/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions x/bank/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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))

Expand Down
18 changes: 15 additions & 3 deletions x/bank/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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)
}

Expand All @@ -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)
}
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit 55fcb7b

Please sign in to comment.