Documentation
¶
Index ¶
- Constants
- Variables
- func AddTestAddrs(app *TestApp, ctx sdk.Context, accNum int, accAmt sdkmath.Int) []sdk.AccAddress
- func AddTestAddrsFromPubKeys(app *TestApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, ...)
- func AddTestAddrsIncremental(app *TestApp, ctx sdk.Context, accNum int, accAmt sdkmath.Int) []sdk.AccAddress
- func BlockedAddresses() map[string]bool
- func CheckBalance(app *TestApp, addr sdk.AccAddress, balances sdk.Coins)
- func ConfigureFeeMarketModule(ctx sdk.Context, keeper *feemarketkeeper.Keeper) error
- 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 GetMaccPerms() map[string][]string
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
- func RegisterSwaggerAPI(rtr *mux.Router)
- func ReplaceHostZoneConfig(ctx sdk.Context, feeAbsKeeper *feeabskeeper.Keeper) error
- func SetConfig()
- func SetExplicitModuleAccountPermissions(ctx sdk.Context, accountKeeper authkeeper.AccountKeeper)
- func TestAddr(addr string, bech string) (sdk.AccAddress, error)
- type App
- func (app *App) AppCodec() codec.Codec
- func (app *App) AutoCliOpts() autocli.AppOptions
- func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
- func (app *App) Configurator() module.Configurator
- func (app *App) DefaultGenesis() map[string]json.RawMessage
- func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error)
- func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error)
- func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey
- func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
- func (app *App) GetStoreKeys() []storetypes.StoreKey
- func (app *App) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *App) GetTKey(storeKey string) *storetypes.TransientStoreKey
- func (app *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
- func (app *App) InterfaceRegistry() types.InterfaceRegistry
- func (app *App) LegacyAmino() *codec.LegacyAmino
- func (app *App) LoadHeight(height int64) error
- func (app *App) ModuleAccountAddrs() map[string]bool
- func (app *App) Name() string
- func (app *App) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error)
- func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *App) RegisterNodeService(clientCtx client.Context, cfg config.Config)
- func (app *App) RegisterTendermintService(clientCtx client.Context)
- func (app *App) RegisterTxService(clientCtx client.Context)
- func (app *App) RegisterUpgradeHandlers()
- func (app *App) SimulationManager() *module.SimulationManager
- func (app *App) TxConfig() client.TxConfig
- type CosmosApp
- type EmptyAppOptions
- type GenerateAccountStrategy
- type GenesisState
- type HandlerOptions
- type SetupOptions
- type TestApp
- func NewAppWithCustomOptions(isCheckTx bool, options SetupOptions) (*TestApp, error)
- func Setup(isCheckTx bool) (*TestApp, error)
- func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) (*TestApp, error)
- func SetupWithGenesisValSet(valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, ...) (*TestApp, error)
Constants ¶
const ( Name = "cheqd-node" Home = ".cheqdnode" // Set ProtocolVersion to app's major version number ProtocolVersion = 2 )
const (
AccountAddressPrefix = "cheqd"
)
Variables ¶
var ( AccountPubKeyPrefix = AccountAddressPrefix + "pub" ValidatorAddressPrefix = AccountAddressPrefix + "valoper" ValidatorPubKeyPrefix = AccountAddressPrefix + "valoperpub" ConsNodeAddressPrefix = AccountAddressPrefix + "valcons" ConsNodePubKeyPrefix = AccountAddressPrefix + "valconspub" )
var DefaultConsensusParams = &tmproto.ConsensusParams{ Block: &tmproto.BlockParams{ MaxBytes: 200000, MaxGas: 2000000, }, Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, MaxBytes: 10000, }, Validator: &tmproto.ValidatorParams{ PubKeyTypes: []string{ cmttypes.ABCIPubKeyTypeEd25519, }, }, }
DefaultConsensusParams defines the default Tendermint consensus params used in SimApp testing.
var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string )
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 *TestApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdkmath.Int)
AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys.
func AddTestAddrsIncremental ¶
func AddTestAddrsIncremental(app *TestApp, ctx sdk.Context, accNum int, accAmt sdkmath.Int) []sdk.AccAddress
AddTestAddrsIncremental constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func BlockedAddresses ¶
BlockedAddresses returns all the app's blocked account addresses.
func CheckBalance ¶
func CheckBalance(app *TestApp, addr sdk.AccAddress, balances sdk.Coins)
CheckBalance checks the balance of an account.
func ConfigureFeeMarketModule ¶
func ConfigureFeeMarketModule(ctx sdk.Context, keeper *feemarketkeeper.Keeper) error
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 GetMaccPerms ¶
GetMaccPerms returns a copy of the module account permissions
NOTE: This is solely to be used for testing purposes.
func NewAnteHandler ¶ added in v0.8.0
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, and deducts fees from the first signer.
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 ReplaceHostZoneConfig ¶
func ReplaceHostZoneConfig(ctx sdk.Context, feeAbsKeeper *feeabskeeper.Keeper) error
func SetExplicitModuleAccountPermissions ¶
func SetExplicitModuleAccountPermissions(ctx sdk.Context, accountKeeper authkeeper.AccountKeeper)
Types ¶
type App ¶
type App 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
IBCFeeKeeper ibcfeekeeper.Keeper
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
ICQKeeper icqkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
FeeMarketKeeper *feemarketkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
GroupKeeper groupkeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper
CircuitKeeper circuitkeeper.Keeper
// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
// ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedResourceKeeper capabilitykeeper.ScopedKeeper
ScopedICQKeeper capabilitykeeper.ScopedKeeper
ScopedFeeAbsKeeper capabilitykeeper.ScopedKeeper
FeeabsKeeper feeabskeeper.Keeper
DidKeeper didkeeper.Keeper
ResourceKeeper resourcekeeper.Keeper
// the module manager
ModuleManager *module.Manager
BasicModuleManager module.BasicManager
// contains filtered or unexported fields
}
App 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 New ¶
func New( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *App
New returns a reference to an initialized cheqd node.
func (*App) AppCodec ¶
AppCodec returns Gaia'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 (*App) AutoCliOpts ¶
func (app *App) AutoCliOpts() autocli.AppOptions
AutoCliOpts returns the autocli options for the app.
func (*App) BeginBlocker ¶
BeginBlocker application updates every begin block
func (*App) Configurator ¶
func (app *App) Configurator() module.Configurator
func (*App) DefaultGenesis ¶
func (app *App) DefaultGenesis() map[string]json.RawMessage
DefaultGenesis returns a default genesis from the registered AppModuleBasic's.
func (*App) EndBlocker ¶
EndBlocker application updates every end block
func (*App) ExportAppStateAndValidators ¶
func (app *App) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs, modulesToExport []string, ) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*App) GetKey ¶
func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey
GetKey returns the KVStoreKey for the provided store key.
NOTE: This is solely to be used for testing purposes.
func (*App) GetMemKey ¶
func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
GetMemKey returns the MemStoreKey for the provided mem key.
NOTE: This is solely used for testing purposes.
func (*App) GetStoreKeys ¶
func (app *App) GetStoreKeys() []storetypes.StoreKey
GetStoreKeys returns all the stored store keys.
func (*App) GetSubspace ¶
func (app *App) 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 (*App) GetTKey ¶
func (app *App) GetTKey(storeKey string) *storetypes.TransientStoreKey
GetTKey returns the TransientStoreKey for the provided store key.
NOTE: This is solely to be used for testing purposes.
func (*App) InitChainer ¶
func (app *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
InitChainer application update at chain initialization
func (*App) InterfaceRegistry ¶
func (app *App) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns Gaia's InterfaceRegistry
func (*App) LegacyAmino ¶
func (app *App) LegacyAmino() *codec.LegacyAmino
LegacyAmino returns SimApp'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 (*App) LoadHeight ¶
LoadHeight loads a particular height
func (*App) ModuleAccountAddrs ¶
ModuleAccountAddrs returns all the app's module account addresses.
func (*App) PreBlocker ¶
func (app *App) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error)
PreBlocker application updates every pre block
func (*App) RegisterAPIRoutes ¶
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*App) RegisterNodeService ¶
RegisterNodeService registers the node gRPC service on the app gRPC router.
func (*App) RegisterTendermintService ¶
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*App) RegisterTxService ¶
RegisterTxService implements the Application.RegisterTxService method.
func (*App) RegisterUpgradeHandlers ¶
func (app *App) RegisterUpgradeHandlers()
func (*App) SimulationManager ¶
func (app *App) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface.
type CosmosApp ¶
type CosmosApp interface {
// The assigned name of the app.
Name() string
// The application types codec.
// NOTE: This shoult be sealed before being returned.
LegacyAmino() *codec.LegacyAmino
// Application updates every begin block.
BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
// Application updates every end block.
EndBlocker(ctx sdk.Context) (sdk.EndBlock, error)
// Application update at chain (i.e app) initialization.
InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
// Loads the app at a given height.
LoadHeight(height int64) error
// Exports the state of the application for a genesis file.
ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string,
) (types.ExportedApp, error)
// All the registered module account addreses.
ModuleAccountAddrs() map[string]bool
}
App implements the common methods for a Cosmos SDK-based application specific blockchain.
type EmptyAppOptions ¶
type EmptyAppOptions struct{}
EmptyAppOptions is a stub implementing AppOptions
func (EmptyAppOptions) Get ¶
func (ao EmptyAppOptions) 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 GenesisStateWithSingleValidator ¶
func GenesisStateWithSingleValidator(app *TestApp) (GenesisState, error)
GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts that also act as delegators.
type HandlerOptions ¶ added in v0.8.0
type HandlerOptions struct {
AccountKeeper cheqdante.AccountKeeper
BankKeeper bankkeeper.Keeper
ExtensionOptionChecker ante.ExtensionOptionChecker
FeegrantKeeper ante.FeegrantKeeper
SignModeHandler *txsigning.HandlerMap
SigGasConsumer func(meter storetypes.GasMeter, sig signing.SignatureV2, params types.Params) error
TxFeeChecker ante.TxFeeChecker
IBCKeeper *ibckeeper.Keeper
DidKeeper cheqdante.DidKeeper
ResourceKeeper cheqdante.ResourceKeeper
FeeAbskeeper feeabskeeper.Keeper
FeeMarketKeeper *feemarketkeeper.Keeper
CircuitKeeper circuitante.CircuitBreaker
}
HandlerOptions are the options required for constructing a default SDK AnteHandler. Here we add the cheqd ante decorators, which extend default SDK AnteHandler.
type SetupOptions ¶
type SetupOptions struct {
Logger log.Logger
DB *dbm.MemDB
InvCheckPeriod uint
HomePath string
SkipUpgradeHeights map[int64]bool
EncConfig moduletestutil.TestEncodingConfig
AppOpts types.AppOptions
}
SetupOptions defines arguments that are passed into `Simapp` constructor.
type TestApp ¶
type TestApp struct {
App
}
func NewAppWithCustomOptions ¶
func NewAppWithCustomOptions(isCheckTx bool, options SetupOptions) (*TestApp, error)
NewAppWithCustomOptions initializes a new App with custom options.
func SetupWithGenesisAccounts ¶
func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) (*TestApp, error)
SetupWithGenesisAccounts initializes a new SimApp with the provided genesis accounts and possible balances.
func SetupWithGenesisValSet ¶
func SetupWithGenesisValSet(valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) (*TestApp, error)
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 in the default token of the simapp from first genesis account. A Nop logger is set in SimApp.