simulation

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Calculate the average block time
	AverageBlockTime time.Duration = (maxTimePerBlock - minTimePerBlock) / 2
	// MaxBidDuration is a crude way of ensuring that BidDuration ≤ MaxAuctionDuration for all generated params
	MaxBidDuration time.Duration = AverageBlockTime * 50
)
View Source
const (
	OpWeightMsgPlaceBid = "op_weight_msg_place_bid"
)

Simulation operation weights constants

Variables

View Source
var GenIncrementDebt = GenIncrementCollateral
View Source
var GenIncrementSurplus = GenIncrementCollateral

Functions

func DecodeStore

func DecodeStore(cdc *codec.Codec, kvA, kvB kv.Pair) string

DecodeStore unmarshals the KVPair's Value to the corresponding auction type

func GenBidDuration added in v0.8.0

func GenBidDuration(r *rand.Rand) time.Duration

func GenIncrementCollateral added in v0.8.0

func GenIncrementCollateral(r *rand.Rand) sdk.Dec

func GenMaxAuctionDuration added in v0.8.0

func GenMaxAuctionDuration(r *rand.Rand) time.Duration

func ParamChanges

func ParamChanges(r *rand.Rand) []simulation.ParamChange

ParamChanges defines the parameters that can be modified by param change proposals on the simulation

func RandInt added in v0.8.0

func RandInt(r *rand.Rand, inclusiveMin, exclusiveMax sdk.Int) (sdk.Int, error)

RandInt randomly generates an sdk.Int in the range [inclusiveMin, exclusiveMax). It works for negative and positive integers.

func RandIntInclusive added in v0.8.0

func RandIntInclusive(r *rand.Rand, inclusiveMin, inclusiveMax sdk.Int) (sdk.Int, error)

RandIntInclusive randomly generates an sdk.Int in the range [inclusiveMin, inclusiveMax]. It works for negative and positive integers.

func RandomPositiveDuration added in v0.8.0

func RandomPositiveDuration(r *rand.Rand, inclusiveMin, exclusiveMax time.Duration) (time.Duration, error)

func RandomizedGenState

func RandomizedGenState(simState *module.SimulationState)

RandomizedGenState generates a random GenesisState for auction

func SimulateMsgPlaceBid added in v0.8.0

func SimulateMsgPlaceBid(ak auth.AccountKeeper, keeper keeper.Keeper) simulation.Operation

SimulateMsgPlaceBid returns a function that runs a random state change on the module keeper. There's two error paths - return a OpMessage, but nil error - this will log a message but keep running the simulation - return an error - this will stop the simulation

func WeightedOperations added in v0.8.0

func WeightedOperations(
	appParams simulation.AppParams, cdc *codec.Codec, ak auth.AccountKeeper, k keeper.Keeper,
) simulation.WeightedOperations

WeightedOperations returns all the operations from the module with their respective weights

Types

This section is empty.

Jump to

Keyboard shortcuts

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