simulation

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpWeightMsgCreatePost           = "op_weight_msg_create_post"
	OpWeightMsgEditPost             = "op_weight_msg_edit_post"
	OpWeightMsgDeletePost           = "op_weight_msg_delete_post"
	OpWeightMsgAddPostAttachment    = "op_weight_msg_add_post_attachment"
	OpWeightMsgRemovePostAttachment = "op_weight_msg_remove_post_attachment"
	OpWeightMsgAnswerPoll           = "op_weight_msg_answer_poll"

	DefaultGasValue = 200000
)

Simulation operation weights constants

View Source
const (
	DefaultWeightMsgUpdateParams int = 100

	OpWeightMsgUpdateParams = "op_weight_msg_update_params" //nolint:gosec
)

Simulation operation weights constants

Variables

This section is empty.

Functions

func GenerateRandomAttachment

func GenerateRandomAttachment(r *rand.Rand, post types.Post, id uint32) types.Attachment

GenerateRandomAttachment generates a random attachment

func GenerateRandomAttachmentContent

func GenerateRandomAttachmentContent(r *rand.Rand, currentTime time.Time) types.AttachmentContent

GenerateRandomAttachmentContent returns a randomly generated attachment content

func GenerateRandomMedia

func GenerateRandomMedia(r *rand.Rand) *types.Media

GenerateRandomMedia returns a randomly generated media content

func GenerateRandomPoll

func GenerateRandomPoll(r *rand.Rand, currentTime time.Time) *types.Poll

GenerateRandomPoll returns a randomly generated poll content

func GenerateRandomPost

func GenerateRandomPost(r *rand.Rand, accounts []simtypes.Account, subspaceID uint64, sectionID uint32, postID uint64, params types.Params) types.Post

GenerateRandomPost generates a random post

func GenerateRandomTags

func GenerateRandomTags(r *rand.Rand, tagsNumber int) []string

GenerateRandomTags returns a slice containing tagsNumber randomly generated tags

func GenerateRandomText

func GenerateRandomText(r *rand.Rand, maxLength uint32) string

GenerateRandomText returns a random text that does not exceed the given max length

func NewDecodeStore

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

NewDecodeStore returns a new decoder that unmarshals the KVPair's Value to the corresponding subspaces type

func ProposalMsgs

func ProposalMsgs() []simtypes.WeightedProposalMsg

ProposalMsgs defines the module weighted proposals' contents

func RandomAnswersIndexes

func RandomAnswersIndexes(r *rand.Rand, poll *types.Poll) (answersIndexes []uint32)

RandomAnswersIndexes returns a random answers indexes slice based on the given poll

func RandomAttachment

func RandomAttachment(r *rand.Rand, attachments []types.Attachment) types.Attachment

RandomAttachment returns a random attachment from the ones given

func RandomMaxTextLength

func RandomMaxTextLength(r *rand.Rand) uint32

RandomMaxTextLength returns a random max text length in the [30, 999] range

func RandomPost

func RandomPost(r *rand.Rand, posts []types.Post) types.Post

RandomPost returns a random post from the slice given

func RandomReplySettings

func RandomReplySettings(r *rand.Rand) types.ReplySetting

RandomReplySettings returns a random valid ReplySetting for the post

func RandomizeGenState

func RandomizeGenState(simState *module.SimulationState)

RandomizeGenState generates a random GenesisState for posts

func SimulateMsgAddPostAttachment

func SimulateMsgAddPostAttachment(
	k keeper.Keeper, ak authkeeper.AccountKeeper, bk bankkeeper.Keeper,
) simtypes.Operation

SimulateMsgAddPostAttachment tests and runs a single msg add post attachment

func SimulateMsgAnswerPoll

SimulateMsgAnswerPoll tests and runs a single msg answer poll post

func SimulateMsgCreatePost

SimulateMsgCreatePost tests and runs a single msg create post

func SimulateMsgDeletePost

SimulateMsgDeletePost tests and runs a single msg delete post

func SimulateMsgEditPost

SimulateMsgEditPost tests and runs a single msg edit post

func SimulateMsgRemovePostAttachment

func SimulateMsgRemovePostAttachment(
	k keeper.Keeper, sk subspaceskeeper.Keeper, ak authkeeper.AccountKeeper, bk bankkeeper.Keeper,
) simtypes.Operation

SimulateMsgRemovePostAttachment tests and runs a single msg remove post attachment

func SimulateMsgUpdateParams

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

SimulateMsgUpdateParams returns a random MsgUpdateParams

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