Documentation
¶
Index ¶
- type AppModuleSimulation
- type IrisModuleBasic
- type ModuleGenesisData
- type SideModule
- type SimulationManager
- func (sm *SimulationManager) GenerateGenesisStates(simState *SimulationState)
- func (sm *SimulationManager) GenerateParamChanges(seed int64) (paramChanges []simulation.ParamChange)
- func (sm *SimulationManager) GetProposalContents(simState SimulationState) []simulation.WeightedProposalContent
- func (sm *SimulationManager) RegisterStoreDecoders()
- func (sm *SimulationManager) WeightedOperations(simState SimulationState) []simulation.WeightedOperation
- type SimulationState
- type StoreDecoderRegistry
- type StreamedGenesisExporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppModuleSimulation ¶
type AppModuleSimulation interface {
// randomized genesis states
GenerateGenesisState(input *SimulationState)
// content functions used to simulate governance proposals
ProposalContents(simState SimulationState) []simulation.WeightedProposalContent
// randomized module parameters for param change proposals
RandomizedParams(r *rand.Rand) []simulation.ParamChange
// register a func to decode the each module's defined types from their corresponding store key
RegisterStoreDecoder(StoreDecoderRegistry)
// simulation operations (i.e msgs) with their respective weight
WeightedOperations(simState SimulationState) []simulation.WeightedOperation
}
AppModuleSimulation defines the standard functions that every module should expose for the SDK blockchain simulator
type IrisModuleBasic ¶
type IrisModuleBasic interface {
module.AppModuleBasic
// verify genesis
VerifyGenesis(map[string]json.RawMessage) error
}
IrisModuleBasic is the standard form for basic non-dependant elements of an application module.
type ModuleGenesisData ¶
type ModuleGenesisData struct {
// Path specifies the JSON path where the data should be appended.
// For example, "moduleA.data" refers to the "data" array within "moduleA".
Path string
// Data is the JSON data chunk to be appended.
Data json.RawMessage
// NextKey is the last key used to append data.
NextKey []byte
}
type SideModule ¶
type SideModule interface {
NewSideTxHandler() types.SideTxHandler
NewPostTxHandler() types.PostTxHandler
}
SideModule is the standard form for side tx elements of an application module
type SimulationManager ¶
type SimulationManager struct {
Modules []AppModuleSimulation // array of app modules; we use an array for deterministic simulation tests
StoreDecoders StoreDecoderRegistry // functions to decode the key-value pairs from each module's store
}
SimulationManager defines a simulation manager that provides the high level utility for managing and executing simulation functionalities for a group of modules
func NewSimulationManager ¶
func NewSimulationManager(modules ...AppModuleSimulation) *SimulationManager
NewSimulationManager creates a new SimulationManager object
CONTRACT: All the modules provided must be also registered on the module Manager
func (*SimulationManager) GenerateGenesisStates ¶
func (sm *SimulationManager) GenerateGenesisStates(simState *SimulationState)
GenerateGenesisStates generates a randomized GenesisState for each of the registered modules
func (*SimulationManager) GenerateParamChanges ¶
func (sm *SimulationManager) GenerateParamChanges(seed int64) (paramChanges []simulation.ParamChange)
GenerateParamChanges generates randomized contents for creating params change proposal transactions
func (*SimulationManager) GetProposalContents ¶
func (sm *SimulationManager) GetProposalContents(simState SimulationState) []simulation.WeightedProposalContent
GetProposalContents returns each module's proposal content generator function with their default operation weight and key.
func (*SimulationManager) RegisterStoreDecoders ¶
func (sm *SimulationManager) RegisterStoreDecoders()
RegisterStoreDecoders registers each of the modules' store decoders into a map
func (*SimulationManager) WeightedOperations ¶
func (sm *SimulationManager) WeightedOperations(simState SimulationState) []simulation.WeightedOperation
WeightedOperations returns all the modules' weighted operations of an application
type SimulationState ¶
type SimulationState struct {
AppParams simulation.AppParams
Cdc *codec.Codec // application codec
Rand *rand.Rand // random number
GenState map[string]json.RawMessage // genesis state
Accounts []simulation.Account // simulation accounts
GenTimestamp time.Time // genesis timestamp
ParamChanges []simulation.ParamChange // simulated parameter changes from modules
Contents []simulation.WeightedProposalContent // proposal content generator functions with their default weight and app sim key
}
SimulationState is the input parameters used on each of the module's randomized GenesisState generator function
type StoreDecoderRegistry ¶
StoreDecoderRegistry defines each of the modules store decoders. Used for ImportExport simulation.
type StreamedGenesisExporter ¶
type StreamedGenesisExporter interface {
// ExportPartialGenesis returns the partial genesis state of the module,
// the rest of the genesis data will be exported in subsequent calls to NextGenesisData.
ExportPartialGenesis(ctx sdk.Context) (json.RawMessage, error)
// NextGenesisData returns the next chunk of genesis data.
// Returns nil NextKey when no more data is available.
NextGenesisData(ctx sdk.Context, nextKey []byte, maxV int) (*ModuleGenesisData, error)
}
StreamedGenesisExporter defines an interface for modules to export their genesis data incrementally.