app

package
v0.0.0-...-d29d301 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: Apache-2.0 Imports: 101 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{},
		peggy.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 AppStateFromGenesisFileFn

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

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

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 Peggy, 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() peggyparams.EncodingConfig

MakeEncodingConfig creates an EncodingConfig for peggy.

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 peggy 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 Peggy, 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

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 Peggy

type Peggy struct {
	*baseapp.BaseApp

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

Peggy extended ABCI application

func NewPeggyApp

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

func (*Peggy) AppCodec

func (app *Peggy) 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 (*Peggy) BeginBlocker

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

BeginBlocker application updates every begin block

func (*Peggy) BlockedAddrs

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

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

func (*Peggy) EndBlocker

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

EndBlocker application updates every end block

func (*Peggy) ExportAppStateAndValidators

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

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

func (*Peggy) GetKey

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

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

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*Peggy) GetSubspace

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

GetSubspace returns a param subspace for a given module name.

func (*Peggy) GetTKey

func (app *Peggy) 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 (*Peggy) InitChainer

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

InitChainer application update at chain initialization

func (*Peggy) InterfaceRegistry

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

InterfaceRegistry returns SimApp's InterfaceRegistry

func (*Peggy) LegacyAmino

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

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

LoadHeight loads a particular height

func (*Peggy) ModuleAccountAddrs

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

ModuleAccountAddrs returns all the app's module account addresses.

func (*Peggy) Name

func (app *Peggy) Name() string

Name returns the name of the App

func (*Peggy) RegisterAPIRoutes

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

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

func (*Peggy) RegisterTendermintService

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

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*Peggy) RegisterTxService

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

RegisterTxService implements the Application.RegisterTxService method.

func (*Peggy) SimulationManager

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