Documentation ¶
Index ¶
- Constants
- Variables
- func AddTestAddrs(app *LinkApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
- func AddTestAddrsFromPubKeys(app *LinkApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int)
- func AddTestAddrsIncremental(app *LinkApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
- func CheckBalance(t *testing.T, app *LinkApp, addr sdk.AccAddress, balances sdk.Coins)
- func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
- func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
- func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, ...) ([]sdk.Tx, error)
- func GetEnabledProposals() []wasm.ProposalType
- func GetMaccPerms() map[string][]string
- func MakeCodecs() (codec.Marshaler, *codec.LegacyAmino)
- func MakeEncodingConfig() params.EncodingConfig
- func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
- func RegisterSwaggerAPI(rtr *mux.Router)
- func SignCheckDeliver(t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, ...) (sdk.GasInfo, *sdk.Result, error)
- func TestAddr(addr string, bech string) (sdk.AccAddress, error)
- type EmptyBaseAppOptions
- type GenerateAccountStrategy
- type GenesisState
- type LinkApp
- func NewLinkApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, ...) *LinkApp
- func Setup(isCheckTx bool) *LinkApp
- func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *LinkApp
- func SetupWithGenesisValSet(t *testing.T, valSet *octypes.ValidatorSet, genAccs []authtypes.GenesisAccount, ...) *LinkApp
- func (app *LinkApp) AppCodec() codec.Marshaler
- func (app *LinkApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *LinkApp) BlockedAddrs() map[string]bool
- func (app *LinkApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *LinkApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string) (servertypes.ExportedApp, error)
- func (app *LinkApp) GetKey(storeKey string) *sdk.KVStoreKey
- func (app *LinkApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey
- func (app *LinkApp) GetSubspace(moduleName string) *paramstypes.Subspace
- func (app *LinkApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
- func (app *LinkApp) InterfaceRegistry() types.InterfaceRegistry
- func (app *LinkApp) LegacyAmino() *codec.LegacyAmino
- func (app *LinkApp) LoadHeight(height int64) error
- func (app *LinkApp) ModuleAccountAddrs() map[string]bool
- func (app *LinkApp) Name() string
- func (app *LinkApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *LinkApp) RegisterTendermintService(clientCtx client.Context)
- func (app *LinkApp) RegisterTxService(clientCtx client.Context)
- func (app *LinkApp) SimulationManager() *module.SimulationManager
- type TestSupport
- func (s TestSupport) AppCodec() codec.Marshaler
- func (s TestSupport) BankKeeper() bankkeeper.Keeper
- func (s TestSupport) IBCKeeper() ibckeeper.Keeper
- func (s TestSupport) ScopeIBCKeeper() capabilitykeeper.ScopedKeeper
- func (s TestSupport) ScopedTransferKeeper() capabilitykeeper.ScopedKeeper
- func (s TestSupport) ScopedWasmIBCKeeper() capabilitykeeper.ScopedKeeper
- func (s TestSupport) StakingKeeper() stakingkeeper.Keeper
- func (s TestSupport) TransferKeeper() ibctransferkeeper.Keeper
- func (s TestSupport) WasmKeeper() wasm.Keeper
Constants ¶
const DefaultGas = 1200000
Variables ¶
var ( NodeDir = ".wasmd" // If EnabledSpecificProposals is "", and this is "true", then enable all x/wasm proposals. // If EnabledSpecificProposals is "", and this is not "true", then disable all x/wasm proposals. ProposalsEnabled = "false" // If set to non-empty string it must be comma-separated list of values that are all a subset // of "EnableAllProposals" (takes precedence over ProposalsEnabled) // "EnableAllProposals" is defined in internal/types/proposal.go EnableSpecificProposals = "" )
We pull these out so we can set them with LDFLAGS in the Makefile
var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string // ModuleBasics defines the module BasicManager is in charge of setting up basic, // non-dependant module elements, such as codec registration // and genesis verification. ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, genutil.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( append(wasmclient.ProposalHandlers, paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler)..., ), params.AppModuleBasic{}, wasm.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, ibc.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, ) )
var DefaultConsensusParams = &abci.ConsensusParams{ Block: &abci.BlockParams{ MaxBytes: 200000, MaxGas: 2000000, }, Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, MaxBytes: 10000, }, Validator: &tmproto.ValidatorParams{ PubKeyTypes: []string{ octypes.ABCIPubKeyTypeEd25519, }, }, }
DefaultConsensusParams defines the default Tendermint consensus params used in LinkApp testing.
Functions ¶
func AddTestAddrs ¶
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func AddTestAddrsFromPubKeys ¶
func AddTestAddrsFromPubKeys(app *LinkApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int)
AddTestAddrsFromPubKeys adds the addresses into the LinkApp providing only the public keys.
func AddTestAddrsIncremental ¶
func AddTestAddrsIncremental(app *LinkApp, 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 ¶
CheckBalance checks the balance of an account.
func ConvertAddrsToValAddrs ¶
func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
ConvertAddrsToValAddrs converts the provided addresses to ValAddress.
func CreateTestPubKeys ¶
func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.
func GenSequenceOfTxs ¶
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 GetEnabledProposals ¶
func GetEnabledProposals() []wasm.ProposalType
GetEnabledProposals parses the ProposalsEnabled / EnableSpecificProposals values to produce a list of enabled proposals to pass into wasmd app.
func GetMaccPerms ¶
GetMaccPerms returns a copy of the module account permissions
func MakeCodecs ¶
func MakeCodecs() (codec.Marshaler, *codec.LegacyAmino)
MakeCodecs constructs the *std.Codec and *codec.LegacyAmino instances used by Link. It is useful for tests and clients who do not want to construct the full link application
func MakeEncodingConfig ¶
func MakeEncodingConfig() params.EncodingConfig
MakeEncodingConfig creates an EncodingConfig for testing
func NewPubKeyFromHex ¶
func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
NewPubKeyFromHex returns a PubKey from a hex string.
func RegisterSwaggerAPI ¶
RegisterSwaggerAPI registers swagger route with API Server
func SignCheckDeliver ¶
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.
Types ¶
type EmptyBaseAppOptions ¶
type EmptyBaseAppOptions struct{}
EmptyBaseAppOptions is a stub implementing AppOptions
func (EmptyBaseAppOptions) Get ¶
func (ao EmptyBaseAppOptions) Get(o string) interface{}
Get implements AppOptions
type GenerateAccountStrategy ¶
type GenerateAccountStrategy func(int) []sdk.AccAddress
type GenesisState ¶
type GenesisState map[string]json.RawMessage
The genesis state of the blockchain is represented here as a map of raw json messages key'd by a identifier string. The identifier is used to determine which module genesis information belongs to so it may be appropriately routed during init chain. Within this application default genesis information is retrieved from the ModuleBasicManager which populates json from each BasicModule object provided to it during init.
func NewDefaultGenesisState ¶
func NewDefaultGenesisState() GenesisState
NewDefaultGenesisState generates the default state for the application.
type LinkApp ¶
type LinkApp struct { *baseapp.BaseApp // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper GovKeeper govkeeper.Keeper CrisisKeeper crisiskeeper.Keeper UpgradeKeeper upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly EvidenceKeeper evidencekeeper.Keeper TransferKeeper ibctransferkeeper.Keeper // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper ScopedWasmKeeper capabilitykeeper.ScopedKeeper // contains filtered or unexported fields }
LinkApp extends an ABCI application, but with most of its parameters exported. They are exported for convenience in creating helper functions, as object capabilities aren't needed for testing.
func NewLinkApp ¶
func NewLinkApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, encodingConfig appparams.EncodingConfig, enabledProposals []wasm.ProposalType, appOpts servertypes.AppOptions, wasmOpts []wasm.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *LinkApp
NewLinkApp returns a reference to an initialized Link.
func SetupWithGenesisAccounts ¶
func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *LinkApp
SetupWithGenesisAccounts initializes a new LinkApp with the provided genesis accounts and possible balances.
func SetupWithGenesisValSet ¶
func SetupWithGenesisValSet(t *testing.T, valSet *octypes.ValidatorSet, genAccs []authtypes.GenesisAccount, opts []wasm.Option, balances ...banktypes.Balance) *LinkApp
SetupWithGenesisValSet initializes a new LinkApp 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 LinkApp from first genesis account. A Nop logger is set in LinkApp.
func (*LinkApp) AppCodec ¶
AppCodec returns Link's app codec.
NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.
func (*LinkApp) BeginBlocker ¶
func (app *LinkApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlocker application updates every begin block
func (*LinkApp) BlockedAddrs ¶
BlockedAddrs returns all the app's module account addresses that are not allowed to receive external tokens.
func (*LinkApp) EndBlocker ¶
func (app *LinkApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlocker application updates every end block
func (*LinkApp) ExportAppStateAndValidators ¶
func (app *LinkApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, ) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*LinkApp) GetKey ¶
func (app *LinkApp) GetKey(storeKey string) *sdk.KVStoreKey
GetKey returns the KVStoreKey for the provided store key.
NOTE: This is solely to be used for testing purposes.
func (*LinkApp) GetMemKey ¶
func (app *LinkApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey
GetMemKey returns the MemStoreKey for the provided mem key.
NOTE: This is solely used for testing purposes.
func (*LinkApp) GetSubspace ¶
func (app *LinkApp) 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 (*LinkApp) InitChainer ¶
func (app *LinkApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
InitChainer application update at chain initialization
func (*LinkApp) InterfaceRegistry ¶
func (app *LinkApp) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns Link's InterfaceRegistry
func (*LinkApp) LegacyAmino ¶
func (app *LinkApp) LegacyAmino() *codec.LegacyAmino
LegacyAmino returns LinkApp's amino codec.
NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.
func (*LinkApp) LoadHeight ¶
LoadHeight loads a particular height
func (*LinkApp) ModuleAccountAddrs ¶
ModuleAccountAddrs returns all the app's module account addresses.
func (*LinkApp) RegisterAPIRoutes ¶
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*LinkApp) RegisterTendermintService ¶
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*LinkApp) RegisterTxService ¶
RegisterTxService implements the Application.RegisterTxService method.
func (*LinkApp) SimulationManager ¶
func (app *LinkApp) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface
type TestSupport ¶
type TestSupport struct {
// contains filtered or unexported fields
}
func NewTestSupport ¶
func NewTestSupport(t *testing.T, app *LinkApp) *TestSupport
func (TestSupport) AppCodec ¶
func (s TestSupport) AppCodec() codec.Marshaler
func (TestSupport) BankKeeper ¶
func (s TestSupport) BankKeeper() bankkeeper.Keeper
func (TestSupport) IBCKeeper ¶
func (s TestSupport) IBCKeeper() ibckeeper.Keeper
func (TestSupport) ScopeIBCKeeper ¶
func (s TestSupport) ScopeIBCKeeper() capabilitykeeper.ScopedKeeper
func (TestSupport) ScopedTransferKeeper ¶
func (s TestSupport) ScopedTransferKeeper() capabilitykeeper.ScopedKeeper
func (TestSupport) ScopedWasmIBCKeeper ¶
func (s TestSupport) ScopedWasmIBCKeeper() capabilitykeeper.ScopedKeeper
func (TestSupport) StakingKeeper ¶
func (s TestSupport) StakingKeeper() stakingkeeper.Keeper
func (TestSupport) TransferKeeper ¶
func (s TestSupport) TransferKeeper() ibctransferkeeper.Keeper
func (TestSupport) WasmKeeper ¶
func (s TestSupport) WasmKeeper() wasm.Keeper