Documentation ¶
Index ¶
- Constants
- Variables
- func AppStateFn(cdc codec.JSONCodec, simManager *module.SimulationManager) simtypes.AppStateFn
- func AppStateRandomizedFn(simManager *module.SimulationManager, r *rand.Rand, cdc codec.JSONCodec, ...) (json.RawMessage, []simtypes.Account)
- func CheckExportSimulation(app Gravity, config simtypes.Config, params simtypes.Params) error
- func GetMaccPerms() map[string][]string
- func GetSimulationLog(storeName string, sdr sdk.StoreDecoderRegistry, kvAs, kvBs []kv.Pair) (log string)
- func GetSimulatorFlags()
- func MakeCodec() *codec.LegacyAmino
- func MakeCodecs() (codec.Codec, *codec.LegacyAmino)
- func MakeEncodingConfig() gravityparams.EncodingConfig
- func NewConfigFromFlags() simulation.Config
- func PrintStats(db dbm.DB)
- func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router)
- func SetAddressConfig()
- func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, log.Logger, bool, error)
- func SimulationOperations(app Gravity, cdc codec.JSONCodec, config simtypes.Config) []simtypes.WeightedOperation
- func StateFromGenesisFileFn(r io.Reader, cdc codec.JSONCodec, genesisFile string) (tmtypes.GenesisDoc, []simtypes.Account)
- func VerifyAddressFormat(bz []byte) error
- type GenesisState
- type Gravity
- func (app *Gravity) AppCodec() codec.Codec
- func (app *Gravity) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *Gravity) BlockedAddrs() map[string]bool
- func (app *Gravity) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *Gravity) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string) (servertypes.ExportedApp, error)
- func (app *Gravity) GetKey(storeKey string) *sdk.KVStoreKey
- func (app *Gravity) GetMemKey(storeKey string) *sdk.MemoryStoreKey
- func (app *Gravity) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *Gravity) GetTKey(storeKey string) *sdk.TransientStoreKey
- func (app *Gravity) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
- func (app *Gravity) InterfaceRegistry() types.InterfaceRegistry
- func (app *Gravity) LegacyAmino() *codec.LegacyAmino
- func (app *Gravity) LoadHeight(height int64) error
- func (app *Gravity) ModuleAccountAddrs() map[string]bool
- func (app *Gravity) Name() string
- func (app *Gravity) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *Gravity) RegisterTendermintService(clientCtx client.Context)
- func (app *Gravity) RegisterTxService(clientCtx client.Context)
- func (app *Gravity) SimulationManager() *module.SimulationManager
Constants ¶
const ( // MaxAddrLen is the maximum allowed length (in bytes) for an address. // // NOTE: In the SDK, the default value is 255. MaxAddrLen = 20 )
Variables ¶
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{}, ibctransfer.AppModuleBasic{}, vesting.AppModuleBasic{}, gravity.AppModuleBasic{}, ) )
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.JSONCodec, 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.JSONCodec, 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 ¶
CheckExportSimulation exports the app state and simulation parameters to JSON if the export paths are defined.
func GetMaccPerms ¶
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.Codec, *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() gravityparams.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 ¶
PrintStats prints the corresponding statistics from the app DB.
func RegisterSwaggerAPI ¶
RegisterSwaggerAPI registers swagger route with API Server TODO: build the custom gravity swagger files and add here?
func SetAddressConfig ¶
func SetAddressConfig()
SetAddressConfig sets the gravity app's address configuration.
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 Gravity, cdc codec.JSONCodec, 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.JSONCodec, genesisFile string) (tmtypes.GenesisDoc, []simtypes.Account)
StateFromGenesisFileFn util function to generate the genesis AppState from a genesis.json file.
func VerifyAddressFormat ¶
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 Gravity ¶
type Gravity struct { *baseapp.BaseApp // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper // contains filtered or unexported fields }
Gravity extended ABCI application
func NewGravityApp ¶
func NewGravityApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, encodingConfig gravityparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *Gravity
func (*Gravity) AppCodec ¶
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 (*Gravity) BeginBlocker ¶
func (app *Gravity) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlocker application updates every begin block
func (*Gravity) BlockedAddrs ¶
BlockedAddrs returns all the app's module account addresses that are not allowed to receive external tokens.
func (*Gravity) EndBlocker ¶
func (app *Gravity) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlocker application updates every end block
func (*Gravity) ExportAppStateAndValidators ¶
func (app *Gravity) ExportAppStateAndValidators( forZeroHeight bool, jailWhiteList []string, ) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*Gravity) GetKey ¶
func (app *Gravity) 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 (*Gravity) GetMemKey ¶
func (app *Gravity) GetMemKey(storeKey string) *sdk.MemoryStoreKey
GetMemKey returns the MemStoreKey for the provided mem key.
NOTE: This is solely used for testing purposes.
func (*Gravity) GetSubspace ¶
func (app *Gravity) GetSubspace(moduleName string) paramstypes.Subspace
GetSubspace returns a param subspace for a given module name.
func (*Gravity) GetTKey ¶
func (app *Gravity) 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 (*Gravity) InitChainer ¶
func (app *Gravity) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
InitChainer application update at chain initialization
func (*Gravity) InterfaceRegistry ¶
func (app *Gravity) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns SimApp's InterfaceRegistry
func (*Gravity) LegacyAmino ¶
func (app *Gravity) 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 (*Gravity) LoadHeight ¶
LoadHeight loads a particular height
func (*Gravity) ModuleAccountAddrs ¶
ModuleAccountAddrs returns all the app's module account addresses.
func (*Gravity) RegisterAPIRoutes ¶
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*Gravity) RegisterTendermintService ¶
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*Gravity) RegisterTxService ¶
RegisterTxService implements the Application.RegisterTxService method.
func (*Gravity) SimulationManager ¶
func (app *Gravity) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface