simulation

package
v0.54.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: Apache-2.0 Imports: 18 Imported by: 71

Documentation

Index

Constants

View Source
const (
	MinDeposit            = "min_deposit"
	ExpeditedMinDeposit   = "expedited_min_deposit"
	DepositPeriod         = "deposit_period"
	MinInitialRatio       = "min_initial_ratio"
	VotingPeriod          = "voting_period"
	ExpeditedVotingPeriod = "expedited_voting_period"
	Quorum                = "quorum"
	Threshold             = "threshold"
	ExpeditedThreshold    = "expedited_threshold"
	Veto                  = "veto"
	ProposalCancelRate    = "proposal_cancel_rate"
	MinDepositRatio       = "min_deposit_ratio"
)

Simulation parameter constants

View Source
const (
	OpWeightMsgDeposit        = "op_weight_msg_deposit"
	OpWeightMsgVote           = "op_weight_msg_vote"
	OpWeightMsgVoteWeighted   = "op_weight_msg_weighted_vote"
	OpWeightMsgCancelProposal = "op_weight_msg_cancel_proposal"

	DefaultWeightMsgDeposit        = 100
	DefaultWeightMsgVote           = 67
	DefaultWeightMsgVoteWeighted   = 33
	DefaultWeightTextProposal      = 5
	DefaultWeightMsgCancelProposal = 5
)

Simulation operation weights constants will be removed in the future

View Source
const OpWeightSubmitTextProposal = "op_weight_submit_text_proposal"

OpWeightSubmitTextProposal app params key for text proposal will be removed in the future

Variables

View Source
var (
	TypeMsgDeposit        = sdk.MsgTypeURL(&v1.MsgDeposit{})
	TypeMsgVote           = sdk.MsgTypeURL(&v1.MsgVote{})
	TypeMsgVoteWeighted   = sdk.MsgTypeURL(&v1.MsgVoteWeighted{})
	TypeMsgSubmitProposal = sdk.MsgTypeURL(&v1.MsgSubmitProposal{})
	TypeMsgCancelProposal = sdk.MsgTypeURL(&v1.MsgCancelProposal{})
)

Governance message types and routes will be removed in the future

Functions

func GenDepositMinInitialDepositRatio added in v0.47.0

func GenDepositMinInitialDepositRatio(r *rand.Rand) sdkmath.LegacyDec

GenDepositMinInitialDepositRatio returns randomized DepositMinInitialRatio

func GenDepositPeriod added in v0.50.1

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

GenDepositPeriod returns randomized DepositPeriod

func GenExpeditedMinDeposit added in v0.50.1

func GenExpeditedMinDeposit(r *rand.Rand, bondDenom string) sdk.Coins

GenExpeditedMinDeposit returns randomized ExpeditedMinDeposit It is always greater than GenMinDeposit

func GenExpeditedThreshold added in v0.50.1

func GenExpeditedThreshold(r *rand.Rand) sdkmath.LegacyDec

GenExpeditedThreshold randomized ExpeditedThreshold

func GenExpeditedVotingPeriod added in v0.50.1

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

GenExpeditedVotingPeriod randomized ExpeditedVotingPeriod

func GenMinDeposit added in v0.50.1

func GenMinDeposit(r *rand.Rand, bondDenom string) sdk.Coins

GenMinDeposit returns randomized MinDeposit

func GenMinDepositRatio added in v0.50.1

func GenMinDepositRatio(r *rand.Rand) sdkmath.LegacyDec

GenMinDepositRatio returns randomized DepositMinRatio

func GenProposalCancelRate added in v0.50.1

func GenProposalCancelRate(r *rand.Rand) sdkmath.LegacyDec

GenProposalCancelRate returns randomized ProposalCancelRate

func GenQuorum added in v0.50.1

func GenQuorum(r *rand.Rand) sdkmath.LegacyDec

GenQuorum returns randomized Quorum

func GenThreshold added in v0.50.1

func GenThreshold(r *rand.Rand) sdkmath.LegacyDec

GenThreshold returns randomized Threshold

func GenVeto added in v0.50.1

func GenVeto(r *rand.Rand) sdkmath.LegacyDec

GenVeto returns randomized Veto

func GenVotingPeriod added in v0.50.1

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

GenVotingPeriod returns randomized VotingPeriod

func MsgCancelProposalFactory added in v0.53.0

func MsgCancelProposalFactory(k *keeper.Keeper, sharedState *SharedState) simsx.SimMsgFactoryFn[*v1.MsgCancelProposal]

func MsgDepositFactory added in v0.53.0

func MsgDepositFactory(k *keeper.Keeper, sharedState *SharedState) simsx.SimMsgFactoryFn[*v1.MsgDeposit]

func MsgSubmitLegacyProposalFactory added in v0.53.0

func MsgSubmitLegacyProposalFactory(k *keeper.Keeper, contentSimFn simtypes.ContentSimulatorFn) simsx.SimMsgFactoryX

func MsgSubmitProposalFactory added in v0.53.0

func MsgSubmitProposalFactory(k *keeper.Keeper, payloadFactory simsx.FactoryMethod) simsx.SimMsgFactoryX

func MsgVoteFactory added in v0.53.0

func MsgVoteFactory(k *keeper.Keeper, sharedState *SharedState) simsx.SimMsgFactoryFn[*v1.MsgVote]

func MsgWeightedVoteFactory added in v0.53.0

func MsgWeightedVoteFactory(k *keeper.Keeper, sharedState *SharedState) simsx.SimMsgFactoryFn[*v1.MsgVoteWeighted]

func ProposalContents

func ProposalContents() []simtypes.WeightedProposalContent

ProposalContents defines the module weighted proposals' contents

func ProposalMsgs added in v0.47.0

func ProposalMsgs() []simtypes.WeightedProposalMsg

ProposalMsgs defines the module weighted proposals' contents will be removed in the future

func RandomizedGenState

func RandomizedGenState(simState *module.SimulationState)

RandomizedGenState generates a random GenesisState for gov

func SimulateLegacyTextProposalContent added in v0.47.0

func SimulateLegacyTextProposalContent(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) simtypes.Content

SimulateLegacyTextProposalContent returns a random text proposal content.

func SimulateMsgCancelProposal added in v0.50.1

func SimulateMsgCancelProposal(
	txGen client.TxConfig,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	k *keeper.Keeper,
) simtypes.Operation

SimulateMsgCancelProposal generates a MsgCancelProposal. will be removed in the future in favor of msg factory

func SimulateMsgDeposit

func SimulateMsgDeposit(
	txGen client.TxConfig,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	k *keeper.Keeper,
) simtypes.Operation

SimulateMsgDeposit generates a MsgDeposit with random values. migrate to the msg factories instead, this method will be removed in the future

func SimulateMsgSubmitLegacyProposal added in v0.47.0

func SimulateMsgSubmitLegacyProposal(
	txGen client.TxConfig,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	k *keeper.Keeper,
	contentSim simtypes.ContentSimulatorFn,
) simtypes.Operation

SimulateMsgSubmitLegacyProposal simulates creating a msg Submit Proposal voting on the proposal, and subsequently slashing the proposal. It is implemented using future operations. will be removed in the future in favor of msg factory

func SimulateMsgSubmitProposal added in v0.24.0

func SimulateMsgSubmitProposal(
	txGen client.TxConfig,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	k *keeper.Keeper,
	msgSim simtypes.MsgSimulatorFn,
) simtypes.Operation

SimulateMsgSubmitProposal simulates creating a msg Submit Proposal voting on the proposal, and subsequently slashing the proposal. It is implemented using future operations. will be removed in the future in favor of msg factory

func SimulateMsgVote

func SimulateMsgVote(
	txGen client.TxConfig,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	k *keeper.Keeper,
) simtypes.Operation

SimulateMsgVote generates a MsgVote with random values. Deprecated: this is an internal method and will be removed

func SimulateMsgVoteWeighted added in v0.43.0

func SimulateMsgVoteWeighted(
	txGen client.TxConfig,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	k *keeper.Keeper,
) simtypes.Operation

SimulateMsgVoteWeighted generates a MsgVoteWeighted with random values. will be removed in the future in favor of msg factory

func SimulateTextProposal added in v0.47.0

func SimulateTextProposal(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg

SimulateTextProposal returns a random text proposal content. A text proposal is a proposal that contains no msgs. will be removed in the future

func TextProposalFactory added in v0.53.0

func TextProposalFactory() simsx.SimMsgFactoryFn[sdk.Msg]

TextProposalFactory returns a random text proposal content. A text proposal is a proposal that contains no msgs.

func WeightedOperations

WeightedOperations returns all the operations from the module with their respective weights will be removed in the future in favor of msg factory

Types

type SharedState added in v0.53.0

type SharedState struct {
	// contains filtered or unexported fields
}

SharedState shared state between message invocations

func NewSharedState added in v0.53.0

func NewSharedState() *SharedState

NewSharedState constructor

Jump to

Keyboard shortcuts

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