app

package
v0.11.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 121 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGenTxGas = 50000000000
)

Variables

View Source
var DefaultConsensusParams = &abci.ConsensusParams{
	Block: &abci.BlockParams{
		MaxBytes: 200000,
		MaxGas:   -1,
	},
	Evidence: &tmproto.EvidenceParams{
		MaxAgeNumBlocks: 302400,
		MaxAgeDuration:  504 * time.Hour,
		MaxBytes:        10000,
	},
	Validator: &tmproto.ValidatorParams{
		PubKeyTypes: []string{
			tmtypes.ABCIPubKeyTypeEd25519,
		},
	},
}

DefaultConsensusParams defines the default Tendermint consensus params used in SimApp testing.

Functions

func AddTestAddrs added in v0.8.0

func AddTestAddrs(app *NewApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func AddTestAddrsFromPubKeys added in v0.8.0

func AddTestAddrsFromPubKeys(app *NewApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int)

AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys.

func AddTestAddrsIncremental added in v0.8.0

func AddTestAddrsIncremental(app *NewApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func CheckBalance added in v0.8.0

func CheckBalance(t *testing.T, app *NewApp, addr sdk.AccAddress, balances sdk.Coins)

CheckBalance checks the balance of an account.

func ConvertAddrsToValAddrs added in v0.8.0

func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress

ConvertAddrsToValAddrs converts the provided addresses to ValAddress.

func CreateTestPubKeys added in v0.8.0

func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey

CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.

func FundAccount added in v0.8.0

func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error

FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!

TODO: Instead of using the mint module account, which has the permission of minting, create a "faucet" account. (@fdymylja)

func FundModuleAccount added in v0.8.0

func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error

FundModuleAccount is a utility function that funds a module account by minting and sending the coins to the address. This should be used for testing purposes only!

TODO: Instead of using the mint module account, which has the permission of minting, create a "faucet" account. (@fdymylja)

func GenSequenceOfTxs added in v0.8.0

func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, numToGenerate int, priv ...cryptotypes.PrivKey) ([]sdk.Tx, error)

GenSequenceOfTxs generates a set of signed transactions of messages, such that they differ only by having the sequence numbers incremented between every transaction.

func GenTx added in v0.8.0

func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error)

GenTx generates a signed mock transaction.

func GetMaccPerms

func GetMaccPerms() map[string][]string

func MakeTestEncodingConfig added in v0.8.0

func MakeTestEncodingConfig() simappparams.EncodingConfig

MakeTestEncodingConfig creates an EncodingConfig for testing. This function should be used only in tests or when creating a new app instance (NewApp*()). App user shouldn't create new codecs - use the app.AppCodec instead. [DEPRECATED]

func NewPubKeyFromHex added in v0.8.0

func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)

NewPubKeyFromHex returns a PubKey from a hex string.

func RandomGenesisAccounts added in v0.8.0

func RandomGenesisAccounts(simState *module.SimulationState) authtypes.GenesisAccounts

RandomGenesisAccounts is used by the auth module to create random genesis accounts in simulation when a genesis.json is not specified. In contrast, the default auth module's RandomGenesisAccounts implementation creates only base accounts and vestings accounts.

func RegisterSwaggerAPI added in v0.8.0

func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router)

RegisterSwaggerAPI registers swagger route with API Server

func SignCheckDeliver added in v0.8.0

func SignCheckDeliver(
	t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
	chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error)

SignCheckDeliver checks a generated signed transaction and simulates a block commitment with the given transaction. A test assertion is made using the parameter 'expPass' against the result. A corresponding result is returned.

func SignCheckDeliverWithFee added in v0.10.0

func SignCheckDeliverWithFee(
	t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
	chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error)

func TestAddr added in v0.8.0

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

Types

type EVMKeeperApp added in v0.10.0

type EVMKeeperApp interface {
	GetEVMKeeper() *evmkeeper.Keeper
}

type EmptyAppOptions added in v0.8.0

type EmptyAppOptions struct{}

EmptyAppOptions is a stub implementing AppOptions

func (EmptyAppOptions) Get added in v0.8.0

func (ao EmptyAppOptions) Get(o string) interface{}

Get implements AppOptions

type GenerateAccountStrategy added in v0.8.0

type GenerateAccountStrategy func(int) []sdk.AccAddress

type NewApp

type NewApp struct {
	*baseapp.BaseApp

	// make scoped keepers public for test purposes
	ScopedIBCKeeper      capabilitykeeper.ScopedKeeper
	ScopedTransferKeeper capabilitykeeper.ScopedKeeper
	// contains filtered or unexported fields
}

func NewInitApp

func NewInitApp(
	logger log.Logger,
	db dbm.DB,
	traceStore io.Writer,
	loadLatest bool,
	skipUpgradeHeights map[int64]bool,
	homePath string,
	invCheckPeriod uint,
	encodingConfig sdkparams.EncodingConfig,
	appOpts servertypes.AppOptions,
	baseAppOptions ...func(*baseapp.BaseApp),
) *NewApp

func Setup added in v0.8.0

func Setup(isCheckTx bool, chainId string) *NewApp

Setup initializes a new SimApp. A Nop logger is set in SimApp.

func SetupWithGenesisAccounts added in v0.8.0

func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, chainId string, balances ...banktypes.Balance) *NewApp

SetupWithGenesisAccounts initializes a new SimApp with the provided genesis accounts and possible balances.

func SetupWithGenesisNodeSet added in v0.8.0

func SetupWithGenesisNodeSet(t *testing.T,
	freshStart bool,
	valSet *tmtypes.ValidatorSet,
	metaNodes []registertypes.MetaNode,
	resourceNodes []registertypes.ResourceNode,
	genAccs []authtypes.GenesisAccount,
	chainId string,
	balances ...banktypes.Balance) *NewApp

SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts that also act as delegators. For simplicity, each validator is bonded with a delegation of one consensus engine unit (10^6) in the default token of the simapp from first genesis account. A Nop logger is set in SimApp.

func (*NewApp) AppCodec added in v0.8.0

func (app *NewApp) AppCodec() codec.Codec

func (*NewApp) BeginBlocker

func (app *NewApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

func (*NewApp) BlockedAddrs added in v0.8.0

func (app *NewApp) BlockedAddrs() map[string]bool

BlockedAddrs returns all the app's module account addresses that are not allowed to receive external tokens.

func (*NewApp) EndBlocker

func (app *NewApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

func (*NewApp) ExportAppStateAndValidators

func (app *NewApp) ExportAppStateAndValidators(
	forZeroHeight bool, jailAllowedAddrs []string,
) (servertypes.ExportedApp, error)

ExportAppStateAndValidators exports the state of the application for a genesis file.

func (*NewApp) GetAccountKeeper added in v0.8.0

func (app *NewApp) GetAccountKeeper() authkeeper.AccountKeeper

func (*NewApp) GetBankKeeper added in v0.8.0

func (app *NewApp) GetBankKeeper() bankkeeper.Keeper

func (*NewApp) GetDistrKeeper added in v0.10.0

func (app *NewApp) GetDistrKeeper() distrkeeper.Keeper

func (*NewApp) GetEVMKeeper added in v0.10.0

func (app *NewApp) GetEVMKeeper() *evmkeeper.Keeper

func (*NewApp) GetPotKeeper added in v0.8.0

func (app *NewApp) GetPotKeeper() potkeeper.Keeper

func (*NewApp) GetRegisterKeeper added in v0.8.0

func (app *NewApp) GetRegisterKeeper() registerkeeper.Keeper

func (*NewApp) GetStakingKeeper added in v0.8.0

func (app *NewApp) GetStakingKeeper() stakingkeeper.Keeper

func (*NewApp) GetSubspace added in v0.8.0

func (app *NewApp) GetSubspace(moduleName string) paramstypes.Subspace

GetSubspace returns a param subspace for a given module name.

NOTE: This is solely to be used for testing purposes.

func (*NewApp) InitChainer

func (app *NewApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain

func (*NewApp) LegacyAmino added in v0.8.0

func (app *NewApp) LegacyAmino() *codec.LegacyAmino

func (*NewApp) LoadHeight

func (app *NewApp) LoadHeight(height int64) error

func (*NewApp) ModuleAccountAddrs

func (app *NewApp) ModuleAccountAddrs() map[string]bool

ModuleAccountAddrs returns all the app's module account addresses.

func (*NewApp) RegisterAPIRoutes added in v0.8.0

func (app *NewApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)

RegisterAPIRoutes registers all application module routes with the provided API server.

func (*NewApp) RegisterTendermintService added in v0.8.0

func (app *NewApp) RegisterTendermintService(clientCtx client.Context)

func (*NewApp) RegisterTxService added in v0.8.0

func (app *NewApp) RegisterTxService(clientCtx client.Context)

func (*NewApp) SimulationManager

func (app *NewApp) SimulationManager() *module.SimulationManager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL