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 Mhub2, 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() mhub2params.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 Mhub2, 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 Mhub2
- func (app *Mhub2) AppCodec() codec.Codec
- func (app *Mhub2) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *Mhub2) BlockedAddrs() map[string]bool
- func (app *Mhub2) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *Mhub2) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string) (servertypes.ExportedApp, error)
- func (app *Mhub2) GetKey(storeKey string) *sdk.KVStoreKey
- func (app *Mhub2) GetMemKey(storeKey string) *sdk.MemoryStoreKey
- func (app *Mhub2) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *Mhub2) GetTKey(storeKey string) *sdk.TransientStoreKey
- func (app *Mhub2) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
- func (app *Mhub2) InterfaceRegistry() types.InterfaceRegistry
- func (app *Mhub2) LegacyAmino() *codec.LegacyAmino
- func (app *Mhub2) LoadHeight(height int64) error
- func (app *Mhub2) ModuleAccountAddrs() map[string]bool
- func (app *Mhub2) Name() string
- func (app *Mhub2) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *Mhub2) RegisterTendermintService(clientCtx client.Context)
- func (app *Mhub2) RegisterTxService(clientCtx client.Context)
- func (app *Mhub2) 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, mhub2client.ProposalColdStorageHandler, mhub2client.ProposalTokensChangeHandler, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, ibc.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, ibctransfer.AppModuleBasic{}, vesting.AppModuleBasic{}, mhub2.AppModuleBasic{}, oracle.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() mhub2params.EncodingConfig
MakeEncodingConfig creates an EncodingConfig for mhub2.
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 mhub2 swagger files and add here?
func SetAddressConfig ¶
func SetAddressConfig()
SetAddressConfig sets the mhub2 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 Mhub2, 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 Mhub2 ¶
type Mhub2 struct { *baseapp.BaseApp // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper // contains filtered or unexported fields }
Mhub2 extended ABCI application
func NewMhub2App ¶
func NewMhub2App( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, encodingConfig mhub2params.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *Mhub2
func (*Mhub2) 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 (*Mhub2) BeginBlocker ¶
func (app *Mhub2) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlocker application updates every begin block
func (*Mhub2) BlockedAddrs ¶
BlockedAddrs returns all the app's module account addresses that are not allowed to receive external tokens.
func (*Mhub2) EndBlocker ¶
func (app *Mhub2) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlocker application updates every end block
func (*Mhub2) ExportAppStateAndValidators ¶
func (app *Mhub2) ExportAppStateAndValidators( forZeroHeight bool, jailWhiteList []string, ) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*Mhub2) GetKey ¶
func (app *Mhub2) 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 (*Mhub2) GetMemKey ¶
func (app *Mhub2) GetMemKey(storeKey string) *sdk.MemoryStoreKey
GetMemKey returns the MemStoreKey for the provided mem key.
NOTE: This is solely used for testing purposes.
func (*Mhub2) GetSubspace ¶
func (app *Mhub2) GetSubspace(moduleName string) paramstypes.Subspace
GetSubspace returns a param subspace for a given module name.
func (*Mhub2) GetTKey ¶
func (app *Mhub2) 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 (*Mhub2) InitChainer ¶
func (app *Mhub2) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
InitChainer application update at chain initialization
func (*Mhub2) InterfaceRegistry ¶
func (app *Mhub2) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns SimApp's InterfaceRegistry
func (*Mhub2) LegacyAmino ¶
func (app *Mhub2) 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 (*Mhub2) LoadHeight ¶
LoadHeight loads a particular height
func (*Mhub2) ModuleAccountAddrs ¶
ModuleAccountAddrs returns all the app's module account addresses.
func (*Mhub2) RegisterAPIRoutes ¶
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*Mhub2) RegisterTendermintService ¶
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*Mhub2) RegisterTxService ¶
RegisterTxService implements the Application.RegisterTxService method.
func (*Mhub2) SimulationManager ¶
func (app *Mhub2) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface