github.com/cosmos/cosmos-sdk@v0.50.10/x/auth/simulation/proposals_test.go (about) 1 package simulation_test 2 3 import ( 4 "math/rand" 5 "testing" 6 7 cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" 8 "gotest.tools/v3/assert" 9 10 sdk "github.com/cosmos/cosmos-sdk/types" 11 "github.com/cosmos/cosmos-sdk/types/address" 12 simtypes "github.com/cosmos/cosmos-sdk/types/simulation" 13 "github.com/cosmos/cosmos-sdk/x/auth/simulation" 14 "github.com/cosmos/cosmos-sdk/x/auth/types" 15 ) 16 17 func TestProposalMsgs(t *testing.T) { 18 // initialize parameters 19 s := rand.NewSource(1) 20 r := rand.New(s) 21 22 ctx := sdk.NewContext(nil, cmtproto.Header{}, true, nil) 23 accounts := simtypes.RandomAccounts(r, 3) 24 25 // execute ProposalMsgs function 26 weightedProposalMsgs := simulation.ProposalMsgs() 27 assert.Assert(t, len(weightedProposalMsgs) == 1) 28 29 w0 := weightedProposalMsgs[0] 30 31 // tests w0 interface: 32 assert.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) 33 assert.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) 34 35 msg := w0.MsgSimulatorFn()(r, ctx, accounts) 36 msgUpdateParams, ok := msg.(*types.MsgUpdateParams) 37 assert.Assert(t, ok) 38 39 assert.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) 40 assert.Equal(t, uint64(999), msgUpdateParams.Params.MaxMemoCharacters) 41 assert.Equal(t, uint64(905), msgUpdateParams.Params.TxSigLimit) 42 assert.Equal(t, uint64(151), msgUpdateParams.Params.TxSizeCostPerByte) 43 assert.Equal(t, uint64(213), msgUpdateParams.Params.SigVerifyCostED25519) 44 assert.Equal(t, uint64(539), msgUpdateParams.Params.SigVerifyCostSecp256k1) 45 }