app

package
v0.0.0-...-e02ddd6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 102 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultNodeHome sets the folder where the applcation data and configuration will be stored
	DefaultNodeHome string

	// ModuleBasics 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(
			paramsclient.ProposalHandler,
			distrclient.ProposalHandler,
			upgradeclient.ProposalHandler,
			upgradeclient.CancelProposalHandler,
		),
		params.AppModuleBasic{},
		crisis.AppModuleBasic{},
		slashing.AppModuleBasic{},
		ibc.AppModuleBasic{},
		upgrade.AppModuleBasic{},
		evidence.AppModuleBasic{},
		transfer.AppModuleBasic{},
		vesting.AppModuleBasic{},
		nab.AppModuleBasic{},
	)
)
View Source
var (
	FlagGenesisFileValue        string
	FlagParamsFileValue         string
	FlagExportParamsPathValue   string
	FlagExportParamsHeightValue int
	FlagExportStatePathValue    string
	FlagExportStatsPathValue    string
	FlagSeedValue               int64
	FlagInitialBlockHeightValue int
	FlagNumBlocksValue          int
	FlagBlockSizeValue          int
	FlagLeanValue               bool
	FlagCommitValue             bool
	FlagOnOperationValue        bool // TODO: Remove in favor of binary search for invariant violation
	FlagAllInvariantsValue      bool

	FlagEnabledValue     bool
	FlagVerboseValue     bool
	FlagPeriodValue      uint
	FlagGenesisTimeValue int64
)

List of available flags for the simulator

Functions

func AppStateFn

func AppStateFn(cdc codec.JSONMarshaler, simManager *module.SimulationManager) simtypes.AppStateFn

AppStateFn returns the initial application state using a genesis or the simulation parameters. It panics if the user provides files for both of them. If a file is not given for the genesis or the sim params, it creates a randomized one.

func AppStateRandomizedFn

func AppStateRandomizedFn(
	simManager *module.SimulationManager, r *rand.Rand, cdc codec.JSONMarshaler,
	accs []simtypes.Account, genesisTimestamp time.Time, appParams simtypes.AppParams,
) (json.RawMessage, []simtypes.Account)

AppStateRandomizedFn creates calls each module's GenesisState generator function and creates the simulation params

func CheckExportSimulation

func CheckExportSimulation(
	app Nab, config simtypes.Config, params simtypes.Params,
) error

CheckExportSimulation exports the app state and simulation parameters to JSON if the export paths are defined.

func GetMaccPerms

func GetMaccPerms() map[string][]string

GetMaccPerms returns a mapping of the application's module account permissions.

func GetSimulationLog

func GetSimulationLog(storeName string, sdr sdk.StoreDecoderRegistry, kvAs, kvBs []kv.Pair) (log string)

GetSimulationLog unmarshals the KVPair's Value to the corresponding type based on the each's module store key and the prefix bytes of the KVPair's key.

func GetSimulatorFlags

func GetSimulatorFlags()

GetSimulatorFlags gets the values of all the available simulation flags

func MakeCodec

func MakeCodec() *codec.LegacyAmino

MakeCodec creates the application codec. The codec is sealed before it is returned.

func MakeCodecs

func MakeCodecs() (codec.Marshaler, *codec.LegacyAmino)

MakeCodecs constructs the *std.Codec and *codec.LegacyAmino instances used by simapp. It is useful for tests and clients who do not want to construct the full simapp

func MakeEncodingConfig

func MakeEncodingConfig() nabparams.EncodingConfig

MakeEncodingConfig creates an EncodingConfig for gravity.

func NewConfigFromFlags

func NewConfigFromFlags() simulation.Config

NewConfigFromFlags creates a simulation from the retrieved values of the flags.

func PrintStats

func PrintStats(db dbm.DB)

PrintStats prints the corresponding statistics from the app DB.

func RegisterSwaggerAPI

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

RegisterSwaggerAPI registers swagger route with API Server TODO: build the custom gravity swagger files and add here?

func SetupSimulation

func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, log.Logger, bool, error)

SetupSimulation creates the config, db (levelDB), temporary directory and logger for the simulation tests. If `FlagEnabledValue` is false it skips the current test. Returns error on an invalid db intantiation or temp dir creation.

func SimulationOperations

func SimulationOperations(app Nab, cdc codec.JSONMarshaler, config simtypes.Config) []simtypes.WeightedOperation

SimulationOperations retrieves the simulation params from the provided file path and returns all the modules weighted operations

func StateFromGenesisFileFn

func StateFromGenesisFileFn(r io.Reader, cdc codec.JSONMarshaler, genesisFile string) (tmtypes.GenesisDoc, []simtypes.Account)

StateFromGenesisFileFn util function to generate the genesis AppState from a genesis.json file.

Types

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 Nab

type Nab struct {
	*baseapp.BaseApp

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

Nab extended ABCI application

func NewNabApp

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

func (*Nab) AppCodec

func (app *Nab) AppCodec() codec.Marshaler

AppCodec returns SimApp'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 (*Nab) BeginBlocker

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

BeginBlocker application updates every begin block

func (*Nab) BlockedAddrs

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

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

func (*Nab) EndBlocker

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

EndBlocker application updates every end block

func (*Nab) ExportAppStateAndValidators

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

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

func (*Nab) GetKey

func (app *Nab) 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 (*Nab) GetMemKey

func (app *Nab) GetMemKey(storeKey string) *sdk.MemoryStoreKey

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*Nab) GetSubspace

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

GetSubspace returns a param subspace for a given module name.

func (*Nab) GetTKey

func (app *Nab) GetTKey(storeKey string) *sdk.TransientStoreKey

GetTKey returns the TransientStoreKey for the provided store key.

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

func (*Nab) InitChainer

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

InitChainer application update at chain initialization

func (*Nab) InterfaceRegistry

func (app *Nab) InterfaceRegistry() types.InterfaceRegistry

InterfaceRegistry returns SimApp's InterfaceRegistry

func (*Nab) LegacyAmino

func (app *Nab) 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 (*Nab) LoadHeight

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

LoadHeight loads a particular height

func (*Nab) ModuleAccountAddrs

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

ModuleAccountAddrs returns all the app's module account addresses.

func (*Nab) Name

func (app *Nab) Name() string

Name returns the name of the App

func (*Nab) RegisterAPIRoutes

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

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

func (*Nab) RegisterTendermintService

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

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*Nab) RegisterTxService

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

RegisterTxService implements the Application.RegisterTxService method.

func (*Nab) SimulationManager

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

SimulationManager implements the SimulationApp interface

Directories

Path Synopsis
Package params defines the simulation parameters in the simapp.
Package params defines the simulation parameters in the simapp.

Jump to

Keyboard shortcuts

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