github.com/cosmos/cosmos-sdk@v0.50.10/x/gov/simulation/proposals.go (about) 1 package simulation 2 3 import ( 4 "math/rand" 5 6 sdk "github.com/cosmos/cosmos-sdk/types" 7 simtypes "github.com/cosmos/cosmos-sdk/types/simulation" 8 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" 9 "github.com/cosmos/cosmos-sdk/x/simulation" 10 ) 11 12 // OpWeightSubmitTextProposal app params key for text proposal 13 const OpWeightSubmitTextProposal = "op_weight_submit_text_proposal" 14 15 // ProposalMsgs defines the module weighted proposals' contents 16 func ProposalMsgs() []simtypes.WeightedProposalMsg { 17 return []simtypes.WeightedProposalMsg{ 18 simulation.NewWeightedProposalMsg( 19 OpWeightSubmitTextProposal, 20 DefaultWeightTextProposal, 21 SimulateTextProposal, 22 ), 23 } 24 } 25 26 // SimulateTextProposal returns a random text proposal content. 27 // A text proposal is a proposal that contains no msgs. 28 func SimulateTextProposal(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { 29 return nil 30 } 31 32 // ProposalContents defines the module weighted proposals' contents 33 // 34 //nolint:staticcheck // used for legacy testing 35 func ProposalContents() []simtypes.WeightedProposalContent { 36 return []simtypes.WeightedProposalContent{ 37 simulation.NewWeightedProposalContent( 38 OpWeightMsgDeposit, 39 DefaultWeightTextProposal, 40 SimulateLegacyTextProposalContent, 41 ), 42 } 43 } 44 45 // SimulateTextProposalContent returns a random text proposal content. 46 // 47 //nolint:staticcheck // used for legacy testing 48 func SimulateLegacyTextProposalContent(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) simtypes.Content { 49 return v1beta1.NewTextProposal( 50 simtypes.RandStringOfLength(r, 140), 51 simtypes.RandStringOfLength(r, 5000), 52 ) 53 }