simulation

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Calculate the average block time
	AverageBlockTime time.Duration = (maxTimePerBlock - minTimePerBlock) / 2

	FallbackCommitteeID uint64 = 0
)
View Source
const OpWeightSubmitCommitteeChangeProposal = "op_weight_submit_committee_change_proposal"

Variables

This section is empty.

Functions

func DecodeStore

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

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

func ProposalContents

func ProposalContents(k keeper.Keeper, paramChanges []simulation.ParamChange) []simulation.WeightedProposalContent

ProposalContents defines the module weighted proposals' contents

func RandInt

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

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

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

func RandomAddresses

func RandomAddresses(r *rand.Rand, accs []simulation.Account) []sdk.AccAddress

func RandomCommittee

func RandomCommittee(r *rand.Rand, availableAccs []simulation.Account, allowedParams []types.AllowedParam) (types.Committee, error)

func RandomPermissions

func RandomPermissions(r *rand.Rand, allowedParams []types.AllowedParam) []types.Permission

func RandomPositiveDuration

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

func RandomTime

func RandomTime(r *rand.Rand, inclusiveMin, exclusiveMax time.Time) (time.Time, error)

func RandomizedGenState

func RandomizedGenState(simState *module.SimulationState)

RandomizedGenState generates a random GenesisState for the module

func SimulateCommitteeChangeProposalContent

func SimulateCommitteeChangeProposalContent(k keeper.Keeper, paramChanges []simulation.ParamChange) simulation.ContentSimulatorFn

SimulateCommitteeChangeProposalContent generates gov proposal contents that either: - create new committees - change existing committees - delete committees It does not alter the fallback committee.

func SimulateMsgSubmitProposal

func SimulateMsgSubmitProposal(cdc *codec.Codec, ak AccountKeeper, k keeper.Keeper, contentSim simulation.ContentSimulatorFn) simulation.Operation

SimulateMsgSubmitProposal creates a proposal using the passed contentSimulatorFn and tries to find a committee that has permissions for it. If it can't then it uses the fallback committee. If the fallback committee isn't there (eg when using an non-generated genesis) and no committee can be found this emits a no-op msg and doesn't do anything. For each submit proposal msg, future ops for the vote messages are generated. Sometimes it doesn't run enough votes to allow the proposal to timeout - the likelihood of this happening is controlled by a parameter.

func SimulateMsgVote

func SimulateMsgVote(k keeper.Keeper, ak AccountKeeper, voter sdk.AccAddress, proposalID uint64, voteType types.VoteType) simulation.Operation

func WeightedOperations

WeightedOperations creates an operation (with weight) for each type of proposal generator. Custom proposal generators can be added for more control over types of proposal submitted, eg to increase likelyhood of particular cdp param changes.

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(sdk.Context, sdk.AccAddress) authexported.Account
}

Jump to

Keyboard shortcuts

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