module

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

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 HeimdallModuleBasic

type HeimdallModuleBasic interface {
	module.AppModuleBasic

	// verify genesis
	VerifyGenesis(map[string]json.RawMessage) error
}

HeimdallModuleBasic is the standard form for basic non-dependant elements of an application module.

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

type StoreDecoderRegistry map[string]func(cdc *codec.Codec, kvA, kvB sdk.KVPair) string

StoreDecoderRegistry defines each of the modules store decoders. Used for ImportExport simulation.

Jump to

Keyboard shortcuts

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