simulation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DepositParamsMinDeposit                   = "deposit_params_min_deposit"
	DepositParamsDepositPeriod                = "deposit_params_deposit_period"
	DepositMinInitialRatio                    = "deposit_params_min_initial_ratio"
	VotingParamsVotingPeriod                  = "voting_params_voting_period"
	TallyParamsQuorum                         = "tally_params_quorum"
	TallyParamsThreshold                      = "tally_params_threshold"
	TallyParamsConstitutionAmendmentQuorum    = "tally_params_constitution_amendment_quorum"
	TallyParamsConstitutionAmendmentThreshold = "tally_params_constitution_amendment_threshold"
	TallyParamsLawQuorum                      = "tally_params_law_quorum"
	TallyParamsLawThreshold                   = "tally_params_law_threshold"

	// NOTE: backport from v50
	MinDepositRatio          = "min_deposit_ratio"
	QuorumTimeout            = "quorum_timeout"
	MaxVotingPeriodExtension = "max_voting_period_extension"
	QuorumCheckCount         = "quorum_check_count"
)

Simulation parameter constants

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

	DefaultWeightMsgDeposit            = 100
	DefaultWeightMsgVote               = 67
	DefaultWeightMsgVoteWeighted       = 33
	DefaultWeightTextProposal          = 5
	DefaultWeightConstitutionAmendment = 5
	DefaultWeightLawProposal           = 5
)

Simulation operation weights constants

View Source
const (
	// OpWeightSubmitTextProposal app params key for text proposal
	OpWeightSubmitTextProposal = "op_weight_submit_text_proposal"
	// OpWeightSubmitConstitutionAmendmentProposal app params key for constitution amendment proposal
	OpWeightSubmitConstitutionAmendmentProposal = "op_weight_submit_constitution_amendment_proposal"
	// OpWeightSubmitLawProposal app params key for law proposal
	OpWeightSubmitLawProposal = "op_weight_submit_law_proposal"
)

Variables

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

Governance message types and routes

Functions

func GenDepositMinInitialDepositRatio

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

GenDepositMinInitialRatio returns randomized DepositMinInitialRatio

func GenDepositParamsDepositPeriod

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

GenDepositParamsDepositPeriod returns randomized DepositParamsDepositPeriod

func GenDepositParamsMinDeposit

func GenDepositParamsMinDeposit(r *rand.Rand) sdk.Coins

GenDepositParamsMinDeposit returns randomized DepositParamsMinDeposit

func GenMaxVotingPeriodExtension

func GenMaxVotingPeriodExtension(r *rand.Rand, votingPeriod, quorumTimout time.Duration) time.Duration

GenMaxVotingPeriodExtension returns a randomized MaxVotingPeriodExtension greater than votingPeriod-quorumTimout.

func GenMinDepositRatio

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

GenMinDepositRatio returns randomized DepositMinRatio

func GenQuorumCheckCount

func GenQuorumCheckCount(r *rand.Rand) uint64

GenQuorumCheckCount returns a randomized QuorumCheckCount between 0 and 30

func GenQuorumTimeout

func GenQuorumTimeout(r *rand.Rand, votingPeriod time.Duration) time.Duration

GenQuorumTimeout returns a randomized QuorumTimeout between 0 and votingPeriod

func GenTallyParamsConstitutionalQuorum

func GenTallyParamsConstitutionalQuorum(r *rand.Rand, minDec sdk.Dec) math.LegacyDec

GenTallyParamsQuorum returns randomized TallyParamsQuorum

func GenTallyParamsConstitutionalThreshold

func GenTallyParamsConstitutionalThreshold(r *rand.Rand, minDec sdk.Dec) math.LegacyDec

GenTallyParamsThreshold returns randomized TallyParamsThreshold

func GenTallyParamsQuorum

func GenTallyParamsQuorum(r *rand.Rand) math.LegacyDec

GenTallyParamsQuorum returns randomized TallyParamsQuorum

func GenTallyParamsThreshold

func GenTallyParamsThreshold(r *rand.Rand) math.LegacyDec

GenTallyParamsThreshold returns randomized TallyParamsThreshold

func GenVotingParamsVotingPeriod

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

GenVotingParamsVotingPeriod returns randomized VotingParamsVotingPeriod

func NewDecodeStore

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

NewDecodeStore returns a decoder function closure that unmarshals the KVPair's Value to the corresponding gov type.

func ProposalContents

func ProposalContents() []simtypes.WeightedProposalContent

ProposalContents defines the module weighted proposals' contents

func ProposalMsgs

func ProposalMsgs() []simtypes.WeightedProposalMsg

ProposalMsgs defines the module weighted proposals' contents

func RandomizedGenState

func RandomizedGenState(simState *module.SimulationState)

RandomizedGenState generates a random GenesisState for gov

func SimulateConstitutionAmendmentProposal

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

SimulateConstitutionAmendmentProposal returns a random constitution amendment proposal.

func SimulateLawProposal

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

SimulateLawProposal returns a random law proposal.

func SimulateLegacyTextProposalContent

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

SimulateTextProposalContent returns a random text proposal content.

func SimulateMsgDeposit

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

SimulateMsgDeposit generates a MsgDeposit with random values.

func SimulateMsgSubmitLegacyProposal

func SimulateMsgSubmitLegacyProposal(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.

func SimulateMsgSubmitProposal

func SimulateMsgSubmitProposal(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.

func SimulateMsgVote

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

SimulateMsgVote generates a MsgVote with random values.

func SimulateMsgVoteWeighted

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

SimulateMsgVoteWeighted generates a MsgVoteWeighted with random values.

func SimulateTextProposal

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.

func 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