SDK Core Audit - simapp updates (#9315)
* Make package imports consistent * Update comment * Update FundAccount/FundModuleAccount * Fix bench test Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
This commit is contained in:
parent
321aed823c
commit
9d0504808a
|
@ -47,7 +47,7 @@ import (
|
|||
|
||||
"github.com/cosmos/cosmos-sdk/x/authz"
|
||||
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
|
||||
authz_m "github.com/cosmos/cosmos-sdk/x/authz/module"
|
||||
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
|
||||
"github.com/cosmos/cosmos-sdk/x/crisis"
|
||||
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
|
||||
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
|
||||
|
@ -115,7 +115,7 @@ var (
|
|||
feegrantmodule.AppModuleBasic{},
|
||||
upgrade.AppModuleBasic{},
|
||||
evidence.AppModuleBasic{},
|
||||
authz_m.AppModuleBasic{},
|
||||
authzmodule.AppModuleBasic{},
|
||||
vesting.AppModuleBasic{},
|
||||
)
|
||||
|
||||
|
@ -173,7 +173,7 @@ type SimApp struct {
|
|||
// simulation manager
|
||||
sm *module.SimulationManager
|
||||
|
||||
// the configurator
|
||||
// module configurator
|
||||
configurator module.Configurator
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ func NewSimApp(
|
|||
upgrade.NewAppModule(app.UpgradeKeeper),
|
||||
evidence.NewAppModule(app.EvidenceKeeper),
|
||||
params.NewAppModule(app.ParamsKeeper),
|
||||
authz_m.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
||||
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
||||
)
|
||||
|
||||
// During begin block slashing happens after distr.BeginBlocker so that
|
||||
|
@ -366,7 +366,7 @@ func NewSimApp(
|
|||
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
|
||||
params.NewAppModule(app.ParamsKeeper),
|
||||
evidence.NewAppModule(app.EvidenceKeeper),
|
||||
authz_m.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
||||
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
||||
)
|
||||
|
||||
app.sm.RegisterStoreDecoders()
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
||||
authz_m "github.com/cosmos/cosmos-sdk/x/authz/module"
|
||||
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
|
@ -168,7 +168,7 @@ func TestRunMigrations(t *testing.T) {
|
|||
module.VersionMap{
|
||||
"bank": 1,
|
||||
"auth": auth.AppModule{}.ConsensusVersion(),
|
||||
"authz": authz_m.AppModule{}.ConsensusVersion(),
|
||||
"authz": authzmodule.AppModule{}.ConsensusVersion(),
|
||||
"staking": staking.AppModule{}.ConsensusVersion(),
|
||||
"mint": mint.AppModule{}.ConsensusVersion(),
|
||||
"distribution": distribution.AppModule{}.ConsensusVersion(),
|
||||
|
@ -219,7 +219,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
|
|||
module.VersionMap{
|
||||
"bank": bank.AppModule{}.ConsensusVersion(),
|
||||
"auth": auth.AppModule{}.ConsensusVersion(),
|
||||
"authz": authz_m.AppModule{}.ConsensusVersion(),
|
||||
"authz": authzmodule.AppModule{}.ConsensusVersion(),
|
||||
"staking": staking.AppModule{}.ConsensusVersion(),
|
||||
"mint": mint.AppModule{}.ConsensusVersion(),
|
||||
"distribution": distribution.AppModule{}.ConsensusVersion(),
|
||||
|
|
|
@ -108,10 +108,20 @@ func AppStateFn(cdc codec.JSONCodec, simManager *module.SimulationManager) simty
|
|||
panic(err)
|
||||
}
|
||||
|
||||
bankState.Balances = append(bankState.Balances, banktypes.Balance{
|
||||
Address: authtypes.NewModuleAddress(stakingtypes.NotBondedPoolName).String(),
|
||||
Coins: sdk.NewCoins(notBondedCoins),
|
||||
})
|
||||
stakingAddr := authtypes.NewModuleAddress(stakingtypes.NotBondedPoolName).String()
|
||||
var found bool
|
||||
for _, balance := range bankState.Balances {
|
||||
if balance.Address == stakingAddr {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
bankState.Balances = append(bankState.Balances, banktypes.Balance{
|
||||
Address: stakingAddr,
|
||||
Coins: sdk.NewCoins(notBondedCoins),
|
||||
})
|
||||
}
|
||||
|
||||
// change appState back
|
||||
rawState[stakingtypes.ModuleName] = cdc.MustMarshalJSON(stakingState)
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/errors"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
|
@ -443,12 +444,12 @@ func (ao EmptyAppOptions) Get(o string) interface{} {
|
|||
//
|
||||
// TODO: Instead of using the mint module account, which has the
|
||||
// permission of minting, create a "faucet" account. (@fdymylja)
|
||||
func FundAccount(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error {
|
||||
if err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil {
|
||||
func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error {
|
||||
if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts)
|
||||
return bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts)
|
||||
}
|
||||
|
||||
// FundModuleAccount is a utility function that funds a module account by
|
||||
|
@ -457,10 +458,10 @@ func FundAccount(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.
|
|||
//
|
||||
// TODO: Instead of using the mint module account, which has the
|
||||
// permission of minting, create a "faucet" account. (@fdymylja)
|
||||
func FundModuleAccount(app *SimApp, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error {
|
||||
if err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil {
|
||||
func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error {
|
||||
if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, recipientMod, amounts)
|
||||
return bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, recipientMod, amounts)
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ func (s *paginationTestSuite) TestFilteredPaginations() {
|
|||
addr1 := sdk.AccAddress([]byte("addr1"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
store := ctx.KVStore(app.GetKey(types.StoreKey))
|
||||
|
||||
// verify pagination with limit > total values
|
||||
|
@ -107,7 +107,7 @@ func (s *paginationTestSuite) TestReverseFilteredPaginations() {
|
|||
addr1 := sdk.AccAddress([]byte("addr1"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
store := ctx.KVStore(app.GetKey(types.StoreKey))
|
||||
|
||||
// verify pagination with limit > total values
|
||||
|
@ -188,7 +188,7 @@ func ExampleFilteredPaginate() {
|
|||
addr1 := sdk.AccAddress([]byte("addr1"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
err := simapp.FundAccount(app, ctx, addr1, balances)
|
||||
err := simapp.FundAccount(app.BankKeeper, ctx, addr1, balances)
|
||||
if err != nil { // should return no error
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ func (s *paginationTestSuite) TestPagination() {
|
|||
addr1 := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
|
||||
s.T().Log("verify empty page request results a max of defaultLimit records and counts total records")
|
||||
pageReq := &query.PageRequest{}
|
||||
|
@ -185,7 +185,7 @@ func (s *paginationTestSuite) TestReversePagination() {
|
|||
addr1 := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
|
||||
s.T().Log("verify paginate with custom limit and countTotal, Reverse false")
|
||||
pageReq := &query.PageRequest{Limit: 2, CountTotal: true, Reverse: true, Key: nil}
|
||||
|
@ -306,7 +306,7 @@ func ExamplePaginate() {
|
|||
addr1 := sdk.AccAddress([]byte("addr1"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
err := simapp.FundAccount(app, ctx, addr1, balances)
|
||||
err := simapp.FundAccount(app.BankKeeper, ctx, addr1, balances)
|
||||
if err != nil { // should return no error
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@ func (suite *AnteTestSuite) TestAnteHandlerFees() {
|
|||
{
|
||||
"signer does not have enough funds to pay the fee",
|
||||
func() {
|
||||
err := simapp.FundAccount(suite.app, suite.ctx, addr0, sdk.NewCoins(sdk.NewInt64Coin("atom", 149)))
|
||||
err := simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr0, sdk.NewCoins(sdk.NewInt64Coin("atom", 149)))
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
false,
|
||||
|
@ -489,7 +489,7 @@ func (suite *AnteTestSuite) TestAnteHandlerFees() {
|
|||
suite.Require().True(suite.app.BankKeeper.GetAllBalances(suite.ctx, modAcc.GetAddress()).Empty())
|
||||
require.True(sdk.IntEq(suite.T(), suite.app.BankKeeper.GetAllBalances(suite.ctx, addr0).AmountOf("atom"), sdk.NewInt(149)))
|
||||
|
||||
err := simapp.FundAccount(suite.app, suite.ctx, addr0, sdk.NewCoins(sdk.NewInt64Coin("atom", 1)))
|
||||
err := simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr0, sdk.NewCoins(sdk.NewInt64Coin("atom", 1)))
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
false,
|
||||
|
|
|
@ -83,7 +83,7 @@ func (suite *AnteTestSuite) TestDeductFees() {
|
|||
acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr1)
|
||||
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
|
||||
coins := sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(10)))
|
||||
err = simapp.FundAccount(suite.app, suite.ctx, addr1, coins)
|
||||
err = simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr1, coins)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
dfd := ante.NewDeductFeeDecorator(suite.app.AccountKeeper, suite.app.BankKeeper, nil)
|
||||
|
@ -95,7 +95,7 @@ func (suite *AnteTestSuite) TestDeductFees() {
|
|||
|
||||
// Set account with sufficient funds
|
||||
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
|
||||
err = simapp.FundAccount(suite.app, suite.ctx, addr1, sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(200))))
|
||||
err = simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr1, sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(200))))
|
||||
suite.Require().NoError(err)
|
||||
|
||||
_, err = antehandler(suite.ctx, tx, false)
|
||||
|
|
|
@ -46,11 +46,11 @@ func (suite *AnteTestSuite) TestDeductFeesNoDelegation() {
|
|||
priv5, _, addr5 := testdata.KeyTestPubAddr()
|
||||
|
||||
// Set addr1 with insufficient funds
|
||||
err := simapp.FundAccount(suite.app, suite.ctx, addr1, []sdk.Coin{sdk.NewCoin("atom", sdk.NewInt(10))})
|
||||
err := simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr1, []sdk.Coin{sdk.NewCoin("atom", sdk.NewInt(10))})
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// Set addr2 with more funds
|
||||
err = simapp.FundAccount(suite.app, suite.ctx, addr2, []sdk.Coin{sdk.NewCoin("atom", sdk.NewInt(99999))})
|
||||
err = simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr2, []sdk.Coin{sdk.NewCoin("atom", sdk.NewInt(99999))})
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// grant fee allowance from `addr2` to `addr3` (plenty to pay)
|
||||
|
|
|
@ -40,9 +40,9 @@ func TestVerifySignature(t *testing.T) {
|
|||
_ = app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
balances := sdk.NewCoins(sdk.NewInt64Coin("atom", 200))
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr, balances))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr, balances))
|
||||
acc, err := ante.GetSignerAcc(ctx, app.AccountKeeper, addr)
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr, balances))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr, balances))
|
||||
|
||||
msgs := []sdk.Msg{testdata.NewTestMsg(addr)}
|
||||
fee := legacytx.NewStdFee(50000, sdk.Coins{sdk.NewInt64Coin("atom", 150)})
|
||||
|
|
|
@ -37,7 +37,7 @@ func (suite *HandlerTestSuite) TestMsgCreateVestingAccount() {
|
|||
|
||||
acc1 := suite.app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
suite.app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
suite.Require().NoError(simapp.FundAccount(suite.app, ctx, addr1, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(suite.app.BankKeeper, ctx, addr1, balances))
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
|
|
@ -129,7 +129,7 @@ func (s *TestSuite) TestKeeperFees() {
|
|||
granterAddr := addrs[0]
|
||||
granteeAddr := addrs[1]
|
||||
recipientAddr := addrs[2]
|
||||
s.Require().NoError(simapp.FundAccount(app, s.ctx, granterAddr, sdk.NewCoins(sdk.NewInt64Coin("steak", 10000))))
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, s.ctx, granterAddr, sdk.NewCoins(sdk.NewInt64Coin("steak", 10000))))
|
||||
now := s.ctx.BlockHeader().Time
|
||||
s.Require().NotNil(now)
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ func (suite *SimTestSuite) getTestingAccounts(r *rand.Rand, n int) []simtypes.Ac
|
|||
for _, account := range accounts {
|
||||
acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, account.Address)
|
||||
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(suite.app, suite.ctx, account.Address, initCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(suite.app.BankKeeper, suite.ctx, account.Address, initCoins))
|
||||
}
|
||||
|
||||
return accounts
|
||||
|
|
|
@ -94,7 +94,7 @@ func TestSendNotEnoughBalance(t *testing.T) {
|
|||
app := simapp.SetupWithGenesisAccounts(genAccs)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 67))))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 67))))
|
||||
|
||||
app.Commit()
|
||||
|
||||
|
@ -129,7 +129,7 @@ func TestMsgMultiSendWithAccounts(t *testing.T) {
|
|||
app := simapp.SetupWithGenesisAccounts(genAccs)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 67))))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 67))))
|
||||
|
||||
app.Commit()
|
||||
|
||||
|
@ -199,9 +199,9 @@ func TestMsgMultiSendMultipleOut(t *testing.T) {
|
|||
app := simapp.SetupWithGenesisAccounts(genAccs)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr2, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr2, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
|
||||
app.Commit()
|
||||
|
||||
|
@ -248,11 +248,11 @@ func TestMsgMultiSendMultipleInOut(t *testing.T) {
|
|||
app := simapp.SetupWithGenesisAccounts(genAccs)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr2, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr2, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr4, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr4, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
|
||||
app.Commit()
|
||||
|
||||
|
@ -295,7 +295,7 @@ func TestMsgMultiSendDependent(t *testing.T) {
|
|||
app := simapp.SetupWithGenesisAccounts(genAccs)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))))
|
||||
|
||||
app.Commit()
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ func BenchmarkOneBankSendTxPerBlock(b *testing.B) {
|
|||
ctx := benchmarkApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
// some value conceivably higher than the benchmarks would ever go
|
||||
require.NoError(b, simapp.FundAccount(benchmarkApp, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 100000000000))))
|
||||
require.NoError(b, simapp.FundAccount(benchmarkApp.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 100000000000))))
|
||||
|
||||
benchmarkApp.Commit()
|
||||
txGen := simappparams.MakeTestEncodingConfig().TxConfig
|
||||
|
@ -72,7 +72,7 @@ func BenchmarkOneBankMultiSendTxPerBlock(b *testing.B) {
|
|||
ctx := benchmarkApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
// some value conceivably higher than the benchmarks would ever go
|
||||
require.NoError(b, simapp.FundAccount(benchmarkApp, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 100000000000))))
|
||||
require.NoError(b, simapp.FundAccount(benchmarkApp.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 100000000000))))
|
||||
|
||||
benchmarkApp.Commit()
|
||||
txGen := simappparams.MakeTestEncodingConfig().TxConfig
|
||||
|
|
|
@ -34,7 +34,7 @@ func (suite *IntegrationTestSuite) TestQueryBalance() {
|
|||
acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr)
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, acc.GetAddress(), origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, acc.GetAddress(), origCoins))
|
||||
|
||||
res, err = queryClient.Balance(gocontext.Background(), req)
|
||||
suite.Require().NoError(err)
|
||||
|
@ -66,7 +66,7 @@ func (suite *IntegrationTestSuite) TestQueryAllBalances() {
|
|||
acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr)
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, acc.GetAddress(), origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, acc.GetAddress(), origCoins))
|
||||
|
||||
res, err = queryClient.AllBalances(gocontext.Background(), req)
|
||||
suite.Require().NoError(err)
|
||||
|
|
|
@ -310,7 +310,7 @@ func (suite *IntegrationTestSuite) TestSendCoinsNewAccount() {
|
|||
addr1 := sdk.AccAddress([]byte("addr1_______________"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
|
||||
acc1Balances := app.BankKeeper.GetAllBalances(ctx, addr1)
|
||||
suite.Require().Equal(balances, acc1Balances)
|
||||
|
@ -340,7 +340,7 @@ func (suite *IntegrationTestSuite) TestInputOutputNewAccount() {
|
|||
addr1 := sdk.AccAddress([]byte("addr1_______________"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
|
||||
acc1Balances := app.BankKeeper.GetAllBalances(ctx, addr1)
|
||||
suite.Require().Equal(balances, acc1Balances)
|
||||
|
@ -393,7 +393,7 @@ func (suite *IntegrationTestSuite) TestInputOutputCoins() {
|
|||
suite.Require().Error(app.BankKeeper.InputOutputCoins(ctx, inputs, []types.Output{}))
|
||||
suite.Require().Error(app.BankKeeper.InputOutputCoins(ctx, inputs, outputs))
|
||||
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
|
||||
insufficientInputs := []types.Input{
|
||||
{Address: addr1.String(), Coins: sdk.NewCoins(newFooCoin(300), newBarCoin(100))},
|
||||
|
@ -428,12 +428,12 @@ func (suite *IntegrationTestSuite) TestSendCoins() {
|
|||
addr2 := sdk.AccAddress("addr2_______________")
|
||||
acc2 := app.AccountKeeper.NewAccountWithAddress(ctx, addr2)
|
||||
app.AccountKeeper.SetAccount(ctx, acc2)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr2, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr2, balances))
|
||||
|
||||
sendAmt := sdk.NewCoins(newFooCoin(50), newBarCoin(25))
|
||||
suite.Require().Error(app.BankKeeper.SendCoins(ctx, addr1, addr2, sendAmt))
|
||||
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
suite.Require().NoError(app.BankKeeper.SendCoins(ctx, addr1, addr2, sendAmt))
|
||||
|
||||
acc1Balances := app.BankKeeper.GetAllBalances(ctx, addr1)
|
||||
|
@ -460,14 +460,14 @@ func (suite *IntegrationTestSuite) TestValidateBalance() {
|
|||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
|
||||
balances := sdk.NewCoins(newFooCoin(100))
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
suite.Require().NoError(app.BankKeeper.ValidateBalance(ctx, addr1))
|
||||
|
||||
bacc := authtypes.NewBaseAccountWithAddress(addr2)
|
||||
vacc := vesting.NewContinuousVestingAccount(bacc, balances.Add(balances...), now.Unix(), endTime.Unix())
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr2, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr2, balances))
|
||||
suite.Require().Error(app.BankKeeper.ValidateBalance(ctx, addr2))
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ func (suite *IntegrationTestSuite) TestHasBalance() {
|
|||
balances := sdk.NewCoins(newFooCoin(100))
|
||||
suite.Require().False(app.BankKeeper.HasBalance(ctx, addr, newFooCoin(99)))
|
||||
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr, balances))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr, balances))
|
||||
suite.Require().False(app.BankKeeper.HasBalance(ctx, addr, newFooCoin(101)))
|
||||
suite.Require().True(app.BankKeeper.HasBalance(ctx, addr, newFooCoin(100)))
|
||||
suite.Require().True(app.BankKeeper.HasBalance(ctx, addr, newFooCoin(1)))
|
||||
|
@ -538,7 +538,7 @@ func (suite *IntegrationTestSuite) TestMsgSendEvents() {
|
|||
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
newCoins := sdk.NewCoins(sdk.NewInt64Coin(fooDenom, 50))
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr, newCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr, newCoins))
|
||||
|
||||
suite.Require().NoError(app.BankKeeper.SendCoins(ctx, addr, addr2, newCoins))
|
||||
event1 := sdk.Event{
|
||||
|
@ -606,7 +606,7 @@ func (suite *IntegrationTestSuite) TestMsgMultiSendEvents() {
|
|||
suite.Require().Equal(0, len(events))
|
||||
|
||||
// Set addr's coins but not addr2's coins
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr, sdk.NewCoins(sdk.NewInt64Coin(fooDenom, 50))))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr, sdk.NewCoins(sdk.NewInt64Coin(fooDenom, 50))))
|
||||
suite.Require().Error(app.BankKeeper.InputOutputCoins(ctx, inputs, outputs))
|
||||
|
||||
events = ctx.EventManager().ABCIEvents()
|
||||
|
@ -623,10 +623,10 @@ func (suite *IntegrationTestSuite) TestMsgMultiSendEvents() {
|
|||
suite.Require().Equal(abci.Event(event1), events[7])
|
||||
|
||||
// Set addr's coins and addr2's coins
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr, sdk.NewCoins(sdk.NewInt64Coin(fooDenom, 50))))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr, sdk.NewCoins(sdk.NewInt64Coin(fooDenom, 50))))
|
||||
newCoins = sdk.NewCoins(sdk.NewInt64Coin(fooDenom, 50))
|
||||
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr2, sdk.NewCoins(sdk.NewInt64Coin(barDenom, 100))))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr2, sdk.NewCoins(sdk.NewInt64Coin(barDenom, 100))))
|
||||
newCoins2 = sdk.NewCoins(sdk.NewInt64Coin(barDenom, 100))
|
||||
|
||||
suite.Require().NoError(app.BankKeeper.InputOutputCoins(ctx, inputs, outputs))
|
||||
|
@ -693,8 +693,8 @@ func (suite *IntegrationTestSuite) TestSpendableCoins() {
|
|||
app.AccountKeeper.SetAccount(ctx, macc)
|
||||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr2, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr2, origCoins))
|
||||
|
||||
suite.Require().Equal(origCoins, app.BankKeeper.SpendableCoins(ctx, addr2))
|
||||
|
||||
|
@ -719,13 +719,13 @@ func (suite *IntegrationTestSuite) TestVestingAccountSend() {
|
|||
vacc := vesting.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix())
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, origCoins))
|
||||
|
||||
// require that no coins be sendable at the beginning of the vesting schedule
|
||||
suite.Require().Error(app.BankKeeper.SendCoins(ctx, addr1, addr2, sendCoins))
|
||||
|
||||
// receive some coins
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, sendCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, sendCoins))
|
||||
// require that all vested coins are spendable plus any received
|
||||
ctx = ctx.WithBlockTime(now.Add(12 * time.Hour))
|
||||
suite.Require().NoError(app.BankKeeper.SendCoins(ctx, addr1, addr2, sendCoins))
|
||||
|
@ -751,13 +751,13 @@ func (suite *IntegrationTestSuite) TestPeriodicVestingAccountSend() {
|
|||
vacc := vesting.NewPeriodicVestingAccount(bacc, origCoins, ctx.BlockHeader().Time.Unix(), periods)
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, origCoins))
|
||||
|
||||
// require that no coins be sendable at the beginning of the vesting schedule
|
||||
suite.Require().Error(app.BankKeeper.SendCoins(ctx, addr1, addr2, sendCoins))
|
||||
|
||||
// receive some coins
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, sendCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, sendCoins))
|
||||
|
||||
// require that all vested coins are spendable plus any received
|
||||
ctx = ctx.WithBlockTime(now.Add(12 * time.Hour))
|
||||
|
@ -783,8 +783,8 @@ func (suite *IntegrationTestSuite) TestVestingAccountReceive() {
|
|||
|
||||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr2, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr2, origCoins))
|
||||
|
||||
// send some coins to the vesting account
|
||||
suite.Require().NoError(app.BankKeeper.SendCoins(ctx, addr2, addr1, sendCoins))
|
||||
|
@ -822,8 +822,8 @@ func (suite *IntegrationTestSuite) TestPeriodicVestingAccountReceive() {
|
|||
|
||||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr2, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr2, origCoins))
|
||||
|
||||
// send some coins to the vesting account
|
||||
suite.Require().NoError(app.BankKeeper.SendCoins(ctx, addr2, addr1, sendCoins))
|
||||
|
@ -859,8 +859,8 @@ func (suite *IntegrationTestSuite) TestDelegateCoins() {
|
|||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
app.AccountKeeper.SetAccount(ctx, macc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr2, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr2, origCoins))
|
||||
|
||||
ctx = ctx.WithBlockTime(now.Add(12 * time.Hour))
|
||||
|
||||
|
@ -923,8 +923,8 @@ func (suite *IntegrationTestSuite) TestUndelegateCoins() {
|
|||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
app.AccountKeeper.SetAccount(ctx, macc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr2, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr2, origCoins))
|
||||
|
||||
ctx = ctx.WithBlockTime(now.Add(12 * time.Hour))
|
||||
|
||||
|
@ -974,7 +974,7 @@ func (suite *IntegrationTestSuite) TestUndelegateCoins_Invalid() {
|
|||
suite.Require().Error(app.BankKeeper.UndelegateCoins(ctx, addrModule, addr1, delCoins))
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, macc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addr1, origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, origCoins))
|
||||
|
||||
suite.Require().Error(app.BankKeeper.UndelegateCoins(ctx, addrModule, addr1, delCoins))
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
|
|
|
@ -42,7 +42,7 @@ func (suite *IntegrationTestSuite) TestQuerier_QueryBalance() {
|
|||
acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr)
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, acc.GetAddress(), origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, acc.GetAddress(), origCoins))
|
||||
|
||||
res, err = querier(ctx, []string{types.QueryBalance}, req)
|
||||
suite.Require().NoError(err)
|
||||
|
@ -79,7 +79,7 @@ func (suite *IntegrationTestSuite) TestQuerier_QueryAllBalances() {
|
|||
acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr)
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, acc.GetAddress(), origCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, acc.GetAddress(), origCoins))
|
||||
res, err = querier(ctx, []string{types.QueryAllBalances}, req)
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().NotNil(res)
|
||||
|
|
|
@ -193,7 +193,7 @@ func (suite *SimTestSuite) getTestingAccounts(r *rand.Rand, n int) []simtypes.Ac
|
|||
for _, account := range accounts {
|
||||
acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, account.Address)
|
||||
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(suite.app, suite.ctx, account.Address, initCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(suite.app.BankKeeper, suite.ctx, account.Address, initCoins))
|
||||
}
|
||||
|
||||
return accounts
|
||||
|
|
|
@ -83,7 +83,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) {
|
|||
require.NotNil(t, feeCollector)
|
||||
|
||||
// fund fee collector
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, feeCollector.GetName(), fees))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, feeCollector.GetName(), fees))
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, feeCollector)
|
||||
|
||||
|
@ -163,7 +163,7 @@ func TestAllocateTokensTruncation(t *testing.T) {
|
|||
feeCollector := app.AccountKeeper.GetModuleAccount(ctx, types.FeeCollectorName)
|
||||
require.NotNil(t, feeCollector)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, feeCollector.GetName(), fees))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, feeCollector.GetName(), fees))
|
||||
|
||||
app.AccountKeeper.SetAccount(ctx, feeCollector)
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ func TestWithdrawDelegationRewardsBasic(t *testing.T) {
|
|||
|
||||
// set module account coins
|
||||
distrAcc := app.DistrKeeper.GetDistributionAccount(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, balanceTokens))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, balanceTokens))))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, distrAcc)
|
||||
|
||||
// create validator with 50% commission
|
||||
|
@ -492,7 +492,7 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) {
|
|||
|
||||
// set module account coins
|
||||
distrAcc := app.DistrKeeper.GetDistributionAccount(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000)))))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, distrAcc)
|
||||
|
||||
tokens := sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, sdk.NewDec(initial))}
|
||||
|
|
|
@ -623,7 +623,7 @@ func (suite *KeeperTestSuite) TestGRPCCommunityPool() {
|
|||
"valid request",
|
||||
func() {
|
||||
amount := sdk.NewCoins(sdk.NewInt64Coin("stake", 100))
|
||||
suite.Require().NoError(simapp.FundAccount(app, ctx, addrs[0], amount))
|
||||
suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addrs[0], amount))
|
||||
|
||||
err := app.DistrKeeper.FundCommunityPool(ctx, amount, addrs[0])
|
||||
suite.Require().Nil(err)
|
||||
|
|
|
@ -49,7 +49,7 @@ func TestWithdrawValidatorCommission(t *testing.T) {
|
|||
// set module account coins
|
||||
distrAcc := app.DistrKeeper.GetDistributionAccount(ctx)
|
||||
coins := sdk.NewCoins(sdk.NewCoin("mytoken", sdk.NewInt(2)), sdk.NewCoin("stake", sdk.NewInt(2)))
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, distrAcc.GetName(), coins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), coins))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, distrAcc)
|
||||
|
||||
|
@ -114,7 +114,7 @@ func TestFundCommunityPool(t *testing.T) {
|
|||
addr := simapp.AddTestAddrs(app, ctx, 2, sdk.ZeroInt())
|
||||
|
||||
amount := sdk.NewCoins(sdk.NewInt64Coin("stake", 100))
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, addr[0], amount))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr[0], amount))
|
||||
|
||||
initPool := app.DistrKeeper.GetFeePool(ctx)
|
||||
assert.Empty(t, initPool.CommunityPool)
|
||||
|
|
|
@ -33,7 +33,7 @@ func TestProposalHandlerPassed(t *testing.T) {
|
|||
// add coins to the module account
|
||||
macc := app.DistrKeeper.GetDistributionAccount(ctx)
|
||||
balances := app.BankKeeper.GetAllBalances(ctx, macc.GetAddress())
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, macc.GetName(), amount))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, macc.GetName(), amount))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, macc)
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ func (suite *SimTestSuite) testSimulateMsgWithdrawValidatorCommission(tokenName
|
|||
|
||||
// set module account coins
|
||||
distrAcc := suite.app.DistrKeeper.GetDistributionAccount(suite.ctx)
|
||||
suite.Require().NoError(simapp.FundModuleAccount(suite.app, suite.ctx, distrAcc.GetName(), sdk.NewCoins(
|
||||
suite.Require().NoError(simapp.FundModuleAccount(suite.app.BankKeeper, suite.ctx, distrAcc.GetName(), sdk.NewCoins(
|
||||
sdk.NewCoin(tokenName, sdk.NewInt(10)),
|
||||
sdk.NewCoin("stake", sdk.NewInt(5)),
|
||||
)))
|
||||
|
@ -229,7 +229,7 @@ func (suite *SimTestSuite) getTestingAccounts(r *rand.Rand, n int) []simtypes.Ac
|
|||
for _, account := range accounts {
|
||||
acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, account.Address)
|
||||
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
|
||||
suite.Require().NoError(simapp.FundAccount(suite.app, suite.ctx, account.Address, initCoins))
|
||||
suite.Require().NoError(simapp.FundAccount(suite.app.BankKeeper, suite.ctx, account.Address, initCoins))
|
||||
}
|
||||
|
||||
return accounts
|
||||
|
|
|
@ -46,7 +46,7 @@ func (suite *SimTestSuite) getTestingAccounts(r *rand.Rand, n int) []simtypes.Ac
|
|||
|
||||
// add coins to the accounts
|
||||
for _, account := range accounts {
|
||||
err := simapp.FundAccount(suite.app, suite.ctx, account.Address, initCoins)
|
||||
err := simapp.FundAccount(suite.app.BankKeeper, suite.ctx, account.Address, initCoins)
|
||||
suite.Require().NoError(err)
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ func (suite *GenTxTestSuite) setAccountBalance(addr sdk.AccAddress, amount int64
|
|||
acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr)
|
||||
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)
|
||||
|
||||
err := simapp.FundAccount(suite.app, suite.ctx, addr, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 25)})
|
||||
err := simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 25)})
|
||||
suite.Require().NoError(err)
|
||||
|
||||
bankGenesisState := suite.app.BankKeeper.ExportGenesis(suite.ctx)
|
||||
|
|
|
@ -271,7 +271,7 @@ func getTestingAccounts(t *testing.T, r *rand.Rand, app *simapp.SimApp, ctx sdk.
|
|||
for _, account := range accounts {
|
||||
acc := app.AccountKeeper.NewAccountWithAddress(ctx, account.Address)
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, account.Address, initCoins))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, account.Address, initCoins))
|
||||
}
|
||||
|
||||
return accounts
|
||||
|
|
|
@ -123,7 +123,7 @@ func getTestingAccounts(t *testing.T, r *rand.Rand, app *simapp.SimApp, ctx sdk.
|
|||
for _, account := range accounts {
|
||||
acc := app.AccountKeeper.NewAccountWithAddress(ctx, account.Address)
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, account.Address, initCoins))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, account.Address, initCoins))
|
||||
}
|
||||
|
||||
return accounts
|
||||
|
|
|
@ -65,7 +65,7 @@ func TestInitGenesis(t *testing.T) {
|
|||
// mint coins in the bonded pool representing the validators coins
|
||||
require.NoError(t,
|
||||
simapp.FundModuleAccount(
|
||||
app,
|
||||
app.BankKeeper,
|
||||
ctx,
|
||||
types.BondedPoolName,
|
||||
sdk.NewCoins(
|
||||
|
@ -183,7 +183,7 @@ func TestInitGenesisLargeValidatorSet(t *testing.T) {
|
|||
// mint coins in the bonded pool representing the validators coins
|
||||
require.NoError(t,
|
||||
simapp.FundModuleAccount(
|
||||
app,
|
||||
app.BankKeeper,
|
||||
ctx,
|
||||
types.BondedPoolName,
|
||||
sdk.NewCoins(sdk.NewCoin(params.BondDenom, bondedPoolAmt)),
|
||||
|
|
|
@ -38,7 +38,7 @@ func bootstrapHandlerGenesisTest(t *testing.T, power int64, numAddrs int, accAmo
|
|||
|
||||
// set non bonded pool balance
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), totalSupply))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), totalSupply))
|
||||
return app, ctx, addrDels, addrVals
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ func TestUnbondDelegation(t *testing.T) {
|
|||
startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10)
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), startTokens))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), startTokens))))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
// create a validator and a delegator to that validator
|
||||
|
@ -227,7 +227,7 @@ func TestUnbondingDelegationsMaxEntries(t *testing.T) {
|
|||
bondDenom := app.StakingKeeper.BondDenom(ctx)
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(bondDenom, startTokens))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(bondDenom, startTokens))))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
// create a validator and a delegator to that validator
|
||||
|
@ -315,7 +315,7 @@ func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true)
|
||||
|
@ -327,7 +327,7 @@ func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
// create a second delegation to this validator
|
||||
|
@ -337,7 +337,7 @@ func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) {
|
|||
require.Equal(t, delTokens, issuedShares.RoundInt())
|
||||
|
||||
// add bonded tokens to pool for delegations
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true)
|
||||
|
@ -375,7 +375,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true)
|
||||
|
@ -386,7 +386,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
// create a second delegation to this validator
|
||||
|
@ -395,14 +395,14 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
validator, issuedShares = validator.AddTokensFromDel(delTokens)
|
||||
require.Equal(t, delTokens, issuedShares.RoundInt())
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true)
|
||||
delegation := types.NewDelegation(addrDels[1], addrVals[0], issuedShares)
|
||||
app.StakingKeeper.SetDelegation(ctx, delegation)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
header := ctx.BlockHeader()
|
||||
|
@ -454,7 +454,7 @@ func TestUndelegateFromUnbondedValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
// create a validator with a self-delegation
|
||||
|
@ -473,7 +473,7 @@ func TestUndelegateFromUnbondedValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
// create a second delegation to this validator
|
||||
|
@ -535,7 +535,7 @@ func TestUnbondingAllDelegationFromValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
//create a validator with a self-delegation
|
||||
|
@ -560,7 +560,7 @@ func TestUnbondingAllDelegationFromValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true)
|
||||
|
@ -699,7 +699,7 @@ func TestRedelegateToSameValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), startCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
// create a validator with a self-delegation
|
||||
|
@ -728,7 +728,7 @@ func TestRedelegationMaxEntries(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), startCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
// create a validator with a self-delegation
|
||||
|
@ -784,7 +784,7 @@ func TestRedelegateSelfDelegation(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), startCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
//create a validator with a self-delegation
|
||||
|
@ -840,7 +840,7 @@ func TestRedelegateFromUnbondingValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), startCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
//create a validator with a self-delegation
|
||||
|
@ -922,7 +922,7 @@ func TestRedelegateFromUnbondedValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), startCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
//create a validator with a self-delegation
|
||||
|
|
|
@ -25,7 +25,7 @@ func bootstrapSlashTest(t *testing.T, power int64) (*simapp.SimApp, sdk.Context,
|
|||
totalSupply := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), amt.MulRaw(int64(len(addrDels)))))
|
||||
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), totalSupply))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), totalSupply))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -35,7 +35,7 @@ func bootstrapSlashTest(t *testing.T, power int64) (*simapp.SimApp, sdk.Context,
|
|||
|
||||
// set bonded pool balance
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), bondedCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), bondedCoins))
|
||||
|
||||
for i := int64(0); i < numVals; i++ {
|
||||
validator := teststaking.NewValidator(t, addrVals[i], PKs[i])
|
||||
|
@ -125,7 +125,7 @@ func TestSlashRedelegation(t *testing.T) {
|
|||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
balances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress())
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), startCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), startCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
// set a redelegation with an expiration timestamp beyond which the
|
||||
|
@ -402,7 +402,7 @@ func TestSlashWithRedelegation(t *testing.T) {
|
|||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
rdCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, rdTokens.MulRaw(2)))
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), rdCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), rdCoins))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -565,8 +565,8 @@ func TestSlashBoth(t *testing.T) {
|
|||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), bondedCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), notBondedCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), bondedCoins))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), notBondedCoins))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
|
|
@ -36,7 +36,7 @@ func bootstrapValidatorTest(t testing.TB, power int64, numAddrs int) (*simapp.Si
|
|||
// set bonded pool supply
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), totalSupply))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), totalSupply))
|
||||
|
||||
return app, ctx, addrDels, addrVals
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ func TestUpdateValidatorByPowerIndex(t *testing.T) {
|
|||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 1234)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 10000)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 1234)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 10000)))))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
@ -162,8 +162,8 @@ func TestUpdateBondedValidatorsDecreaseCliff(t *testing.T) {
|
|||
app.StakingKeeper.SetParams(ctx, params)
|
||||
|
||||
// create a random pool
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 1234)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 10000)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 1234)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 10000)))))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
@ -217,7 +217,7 @@ func TestSlashToZeroPowerRemoved(t *testing.T) {
|
|||
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), valTokens))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), valTokens))))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -422,8 +422,8 @@ func TestGetValidatorSortingMixed(t *testing.T) {
|
|||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 501)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 0)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 501)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 0)))))
|
||||
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
@ -497,7 +497,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
validators[i], _ = validators[i].AddTokensFromDel(tokens)
|
||||
|
||||
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, tokens))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, tokens))))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
validators[i] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[i], true)
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
|
||||
newTokens := sdk.NewCoins()
|
||||
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), newTokens))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), newTokens))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
// test that the two largest validators are
|
||||
|
@ -548,7 +548,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
|
||||
notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
newTokens = sdk.NewCoins(sdk.NewCoin(params.BondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 1)))
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), newTokens))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), newTokens))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
validators[3] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true)
|
||||
|
@ -563,7 +563,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
validators[3], _ = validators[3].RemoveDelShares(sdk.NewDec(201))
|
||||
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, rmTokens))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, rmTokens))))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
validators[3] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true)
|
||||
|
@ -577,7 +577,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
validators[3], _ = validators[3].AddTokensFromDel(sdk.NewInt(200))
|
||||
|
||||
notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, sdk.NewInt(200)))))
|
||||
require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, sdk.NewInt(200)))))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
validators[3] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true)
|
||||
|
|
|
@ -283,7 +283,7 @@ func getTestingAccounts(t *testing.T, r *rand.Rand, app *simapp.SimApp, ctx sdk.
|
|||
for _, account := range accounts {
|
||||
acc := app.AccountKeeper.NewAccountWithAddress(ctx, account.Address)
|
||||
app.AccountKeeper.SetAccount(ctx, acc)
|
||||
require.NoError(t, simapp.FundAccount(app, ctx, account.Address, initCoins))
|
||||
require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, account.Address, initCoins))
|
||||
}
|
||||
|
||||
return accounts
|
||||
|
|
Loading…
Reference in New Issue