Skip to content

Commit

Permalink
update to 0.45.16
Browse files Browse the repository at this point in the history
  • Loading branch information
skyargos committed May 8, 2024
1 parent 0bbdc32 commit ee00bbe
Show file tree
Hide file tree
Showing 102 changed files with 2,670 additions and 2,918 deletions.
42 changes: 22 additions & 20 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"

Check failure on line 18 in app/app.go

View workflow job for this annotation

GitHub Actions / test-coverage-upload

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/baseapp (imported by github.com/shentufoundation/shentu/v2/app); to add:

Check failure on line 18 in app/app.go

View workflow job for this annotation

GitHub Actions / liveness-test

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/baseapp (imported by github.com/shentufoundation/shentu/v2/app); to add:

Check failure on line 18 in app/app.go

View workflow job for this annotation

GitHub Actions / test-sim-nondeterminism

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/baseapp (imported by github.com/shentufoundation/shentu/v2/app); to add:
"github.com/cosmos/cosmos-sdk/client"

Check failure on line 19 in app/app.go

View workflow job for this annotation

GitHub Actions / test-coverage-upload

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/client (imported by github.com/shentufoundation/shentu/v2/app); to add:

Check failure on line 19 in app/app.go

View workflow job for this annotation

GitHub Actions / liveness-test

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/client (imported by github.com/shentufoundation/shentu/v2/app); to add:

Check failure on line 19 in app/app.go

View workflow job for this annotation

GitHub Actions / test-sim-nondeterminism

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/client (imported by github.com/shentufoundation/shentu/v2/app); to add:
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"

Check failure on line 20 in app/app.go

View workflow job for this annotation

GitHub Actions / test-coverage-upload

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/client/grpc/tmservice (imported by github.com/shentufoundation/shentu/v2/app); to add:

Check failure on line 20 in app/app.go

View workflow job for this annotation

GitHub Actions / liveness-test

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/client/grpc/tmservice (imported by github.com/shentufoundation/shentu/v2/app); to add:

Check failure on line 20 in app/app.go

View workflow job for this annotation

GitHub Actions / test-sim-nondeterminism

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/client/grpc/tmservice (imported by github.com/shentufoundation/shentu/v2/app); to add:
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/codec"

Check failure on line 21 in app/app.go

View workflow job for this annotation

GitHub Actions / test-coverage-upload

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/codec (imported by github.com/shentufoundation/shentu/v2/app); to add:

Check failure on line 21 in app/app.go

View workflow job for this annotation

GitHub Actions / liveness-test

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/codec (imported by github.com/shentufoundation/shentu/v2/app); to add:

Check failure on line 21 in app/app.go

View workflow job for this annotation

GitHub Actions / test-sim-nondeterminism

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/codec (imported by github.com/shentufoundation/shentu/v2/app); to add:
"github.com/cosmos/cosmos-sdk/codec/types"

Check failure on line 22 in app/app.go

View workflow job for this annotation

GitHub Actions / test-sim-nondeterminism

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/codec/types (imported by github.com/shentufoundation/shentu/v2/app); to add:
"github.com/cosmos/cosmos-sdk/server/api"
Expand All @@ -28,7 +27,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
sdkauthkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
Expand Down Expand Up @@ -70,6 +68,7 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
Expand All @@ -87,6 +86,7 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"

appparams "github.com/shentufoundation/shentu/v2/app/params"
"github.com/shentufoundation/shentu/v2/common"
"github.com/shentufoundation/shentu/v2/x/auth"
authkeeper "github.com/shentufoundation/shentu/v2/x/auth/keeper"
"github.com/shentufoundation/shentu/v2/x/bank"
Expand Down Expand Up @@ -117,7 +117,6 @@ import (
"github.com/shentufoundation/shentu/v2/x/slashing"
"github.com/shentufoundation/shentu/v2/x/staking"
stakingkeeper "github.com/shentufoundation/shentu/v2/x/staking/keeper"

// unnamed import of statik for swagger UI support
_ "github.com/shentufoundation/shentu/v2/docs/statik"
)
Expand Down Expand Up @@ -198,9 +197,9 @@ type ShentuApp struct {
invCheckPeriod uint

// keys to access the substores
keys map[string]*sdk.KVStoreKey
tkeys map[string]*sdk.TransientStoreKey
memKeys map[string]*sdk.MemoryStoreKey
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey
memKeys map[string]*storetypes.MemoryStoreKey

AccountKeeper sdkauthkeeper.AccountKeeper
AuthzKeeper authzkeeper.Keeper
Expand Down Expand Up @@ -243,7 +242,7 @@ type ShentuApp struct {
func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, homePath string,
invCheckPeriod uint, encodingConfig appparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp)) *ShentuApp {
// define top-level codec that will be shared between modules
appCodec := encodingConfig.Marshaler
appCodec := encodingConfig.Codec
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

Expand Down Expand Up @@ -300,7 +299,7 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest
app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])

// set the BaseApp's parameter store
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()))
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()))

// add capability keeper and ScopeToModule for ibc module
app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])
Expand All @@ -316,6 +315,7 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest
app.GetSubspace(authtypes.ModuleName),
authtypes.ProtoBaseAccount,
maccPerms,
common.Bech32MainPrefix,
)
app.BankKeeper = bankkeeper.NewKeeper(
appCodec,
Expand All @@ -334,7 +334,7 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest
)
app.DistrKeeper = distrkeeper.NewKeeper(
appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
&stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(),
&stakingKeeper, authtypes.FeeCollectorName,
)
app.FeegrantKeeper = feegrantkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -381,6 +381,7 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest
keys[authzkeeper.StoreKey],
appCodec,
app.MsgServiceRouter(),
app.AccountKeeper,
)
app.CrisisKeeper = crisiskeeper.NewKeeper(
app.GetSubspace(crisistypes.ModuleName),
Expand Down Expand Up @@ -689,7 +690,7 @@ func (app *ShentuApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) ab
// full app
func MakeCodecs() (codec.Codec, *codec.LegacyAmino) {
config := MakeEncodingConfig()
return config.Marshaler, config.Amino
return config.Codec, config.Amino
}

// LoadHeight loads a particular height
Expand Down Expand Up @@ -746,21 +747,21 @@ func (app *ShentuApp) ModuleManager() *module.Manager {
// GetKey returns the KVStoreKey for the provided store key.
//
// NOTE: This is solely to be used for testing purposes.
func (app *ShentuApp) GetKey(storeKey string) *sdk.KVStoreKey {
func (app *ShentuApp) GetKey(storeKey string) *storetypes.KVStoreKey {
return app.keys[storeKey]
}

// GetTKey returns the TransientStoreKey for the provided store key.
//
// NOTE: This is solely to be used for testing purposes.
func (app *ShentuApp) GetTKey(storeKey string) *sdk.TransientStoreKey {
func (app *ShentuApp) GetTKey(storeKey string) *storetypes.TransientStoreKey {
return app.tkeys[storeKey]
}

// GetMemKey returns the MemStoreKey for the provided mem key.
//
// NOTE: This is solely used for testing purposes.
func (app *ShentuApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey {
func (app *ShentuApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
return app.memKeys[storeKey]
}

Expand All @@ -773,16 +774,12 @@ func (app *ShentuApp) GetTxConfig() client.TxConfig {
// API server.
func (app *ShentuApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
clientCtx := apiSvr.ClientCtx
rpc.RegisterRoutes(clientCtx, apiSvr.Router)
// Register legacy tx routes.
authrest.RegisterTxRoutes(clientCtx, apiSvr.Router)

// Register new tx routes from grpc-gateway.
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
// Register new tendermint queries routes from grpc-gateway.
tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// Register legacy and grpc-gateway routes for all modules.
ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router)
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// register swagger API from root so that other applications can override easily
Expand All @@ -798,7 +795,12 @@ func (app *ShentuApp) RegisterTxService(clientCtx client.Context) {

// RegisterTendermintService implements the Application.RegisterTendermintService method.
func (app *ShentuApp) RegisterTendermintService(clientCtx client.Context) {
tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry)
tmservice.RegisterTendermintService(
clientCtx,
app.BaseApp.GRPCQueryRouter(),
app.interfaceRegistry,
app.Query,
)
}

// RegisterUpgradeHandlers registers necessary upgrade handlers
Expand All @@ -818,7 +820,7 @@ func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) {
}

// initParamsKeeper init params keeper and its subspaces
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper {
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)

paramsKeeper.Subspace(authtypes.ModuleName)
Expand Down
2 changes: 1 addition & 1 deletion app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestSimAppExport(t *testing.T) {
db := dbm.NewMemDB()
app := NewShentuApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 1, encodingConfig, EmptyAppOptions{})

genesisState := ModuleBasics.DefaultGenesis(encodingConfig.Marshaler)
genesisState := ModuleBasics.DefaultGenesis(encodingConfig.Codec)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
require.NoError(t, err)

Expand Down
8 changes: 4 additions & 4 deletions app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/hd"

Check failure on line 10 in app/config.go

View workflow job for this annotation

GitHub Actions / test-sim-nondeterminism

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/crypto/hd (imported by github.com/shentufoundation/shentu/v2/app); to add:
"github.com/cosmos/cosmos-sdk/crypto/keyring"

Check failure on line 11 in app/config.go

View workflow job for this annotation

GitHub Actions / test-sim-nondeterminism

missing go.sum entry for module providing package github.com/cosmos/cosmos-sdk/crypto/keyring (imported by github.com/shentufoundation/shentu/v2/app); to add:
pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/simapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand All @@ -26,13 +26,13 @@ func DefaultConfig() network.Config {
encCfg := MakeEncodingConfig()

return network.Config{
Codec: encCfg.Marshaler,
Codec: encCfg.Codec,
TxConfig: encCfg.TxConfig,
LegacyAmino: encCfg.Amino,
InterfaceRegistry: encCfg.InterfaceRegistry,
AccountRetriever: authtypes.AccountRetriever{},
AppConstructor: NewAppConstructor(encCfg),
GenesisState: ModuleBasics.DefaultGenesis(encCfg.Marshaler),
GenesisState: ModuleBasics.DefaultGenesis(encCfg.Codec),
TimeoutCommit: 1 * time.Second / 2,
ChainID: "shentu-code-test",
NumValidators: 1,
Expand All @@ -41,7 +41,7 @@ func DefaultConfig() network.Config {
AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction),
StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction),
BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction),
PruningStrategy: storetypes.PruningOptionNothing,
PruningStrategy: pruningtypes.PruningOptionNothing,
CleanupDir: true,
SigningAlgo: string(hd.Secp256k1Type),
KeyringOptions: []keyring.Option{},
Expand Down
4 changes: 3 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ func (app *ShentuApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs
feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
app.DistrKeeper.SetFeePool(ctx, feePool)

app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil {
panic(err)
}
return false
})

Expand Down
2 changes: 1 addition & 1 deletion app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ type GenesisState map[string]json.RawMessage
// NewDefaultGenesisState generates the default state for the application.
func NewDefaultGenesisState() GenesisState {
encCfg := MakeEncodingConfig()
return ModuleBasics.DefaultGenesis(encCfg.Marshaler)
return ModuleBasics.DefaultGenesis(encCfg.Codec)
}
4 changes: 2 additions & 2 deletions app/mva/fork_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mva_test

import (
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
"testing"
"time"

Expand All @@ -9,7 +10,6 @@ import (
"github.com/tendermint/tendermint/crypto/ed25519"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

sdksimapp "github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkauthkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -127,7 +127,7 @@ func (suite *ForkTestSuite) SetupTest() {

for _, pk := range pk {
acc := toAddr(pk)
err := sdksimapp.FundAccount(
err := testutil.FundAccount(
suite.app.BankKeeper,
suite.ctx,
acc,
Expand Down
2 changes: 1 addition & 1 deletion app/params/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// This is provided for compatibility between protobuf and amino implementations.
type EncodingConfig struct {
InterfaceRegistry types.InterfaceRegistry
Marshaler codec.Codec
Codec codec.Codec
TxConfig client.TxConfig
Amino *codec.LegacyAmino
}
2 changes: 1 addition & 1 deletion app/params/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func MakeEncodingConfig() EncodingConfig {

return EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: codec,
Codec: codec,
TxConfig: txCfg,
Amino: amino,
}
Expand Down
8 changes: 4 additions & 4 deletions app/shentud/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/spf13/cast"
"github.com/spf13/cobra"

tmcmds "github.com/tendermint/tendermint/cmd/tendermint/commands"
tmcmds "github.com/tendermint/tendermint/cmd/cometbft/commands"
tmcfg "github.com/tendermint/tendermint/config"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
Expand Down Expand Up @@ -52,7 +52,7 @@ import (
func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
encodingConfig := app.MakeEncodingConfig()
initClientCtx := client.Context{}.
WithCodec(encodingConfig.Marshaler).
WithCodec(encodingConfig.Codec).
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
Expand Down Expand Up @@ -177,7 +177,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
)

// add rosetta
rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler))
rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec))
}

func addModuleInitFlags(startCmd *cobra.Command) {
Expand Down Expand Up @@ -295,7 +295,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
func createSimappAndExport(logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string,
appOpts servertypes.AppOptions) (servertypes.ExportedApp, error) {
encCfg := app.MakeEncodingConfig() // Ideally, we would reuse the one created by NewRootCmd.
encCfg.Marshaler = codec.NewProtoCodec(encCfg.InterfaceRegistry)
encCfg.Codec = codec.NewProtoCodec(encCfg.InterfaceRegistry)
var gaiaApp *app.ShentuApp
if height != -1 {
gaiaApp = app.NewShentuApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), encCfg, appOpts)
Expand Down
5 changes: 3 additions & 2 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
auth "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand All @@ -43,8 +44,8 @@ import (
)

type StoreKeysPrefixes struct {
A sdk.StoreKey
B sdk.StoreKey
A storetypes.StoreKey
B storetypes.StoreKey
Prefixes [][]byte
}

Expand Down
29 changes: 13 additions & 16 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
)

Expand Down Expand Up @@ -63,9 +62,7 @@ func AddTestAddrs(app *ShentuApp, ctx sdk.Context, accNum int, accAmt sdk.Int) [

// fill all the addresses with some coins, set the loose pool tokens simultaneously
for _, addr := range testAddrs {
if err := FundAccount(app.BankKeeper, ctx, addr, initCoins); err != nil {
panic(err)
}
initAccountWithCoins(app, ctx, addr, initCoins)
}
return testAddrs
}
Expand All @@ -76,10 +73,18 @@ func AddTestAddrsFromPubKeys(app *ShentuApp, ctx sdk.Context, pubKeys []cryptoty

// fill all the addresses with some coins, set the loose pool tokens simultaneously
for _, pubKey := range pubKeys {
//app.BankKeeper.SendCoins(ctx, ctx.)
if err := simapp.FundAccount(app.BankKeeper, ctx, sdk.AccAddress(pubKey.Address()), initCoins); err != nil {
panic(err)
}
initAccountWithCoins(app, ctx, sdk.AccAddress(pubKey.Address()), initCoins)
}
}

func initAccountWithCoins(app *ShentuApp, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) {
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins)
if err != nil {
panic(err)
}
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins)
if err != nil {
panic(err)
}
}

Expand Down Expand Up @@ -111,11 +116,3 @@ func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) {
}
return &ed25519.PubKey{Key: pkBytes}
}

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 bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts)
}
Loading

0 comments on commit ee00bbe

Please sign in to comment.