github.com/cosmos/cosmos-sdk@v0.50.10/x/auth/simulation/proposals.go (about) 1 package simulation 2 3 import ( 4 "math/rand" 5 6 sdk "github.com/cosmos/cosmos-sdk/types" 7 "github.com/cosmos/cosmos-sdk/types/address" 8 simtypes "github.com/cosmos/cosmos-sdk/types/simulation" 9 "github.com/cosmos/cosmos-sdk/x/auth/types" 10 "github.com/cosmos/cosmos-sdk/x/simulation" 11 ) 12 13 // Simulation operation weights constants 14 const ( 15 DefaultWeightMsgUpdateParams int = 100 16 17 OpWeightMsgUpdateParams = "op_weight_msg_update_params" 18 ) 19 20 // ProposalMsgs defines the module weighted proposals' contents 21 func ProposalMsgs() []simtypes.WeightedProposalMsg { 22 return []simtypes.WeightedProposalMsg{ 23 simulation.NewWeightedProposalMsg( 24 OpWeightMsgUpdateParams, 25 DefaultWeightMsgUpdateParams, 26 SimulateMsgUpdateParams, 27 ), 28 } 29 } 30 31 // SimulateMsgUpdateParams returns a random MsgUpdateParams 32 func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { 33 // use the default gov module account address as authority 34 var authority sdk.AccAddress = address.Module("gov") 35 36 params := types.DefaultParams() 37 params.MaxMemoCharacters = uint64(simtypes.RandIntBetween(r, 1, 1000)) 38 params.TxSigLimit = uint64(simtypes.RandIntBetween(r, 1, 1000)) 39 params.TxSizeCostPerByte = uint64(simtypes.RandIntBetween(r, 1, 1000)) 40 params.SigVerifyCostED25519 = uint64(simtypes.RandIntBetween(r, 1, 1000)) 41 params.SigVerifyCostSecp256k1 = uint64(simtypes.RandIntBetween(r, 1, 1000)) 42 43 return &types.MsgUpdateParams{ 44 Authority: authority.String(), 45 Params: params, 46 } 47 }