simulation

package
v6.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWeightMsgCreatePost                     int = 80
	DefaultWeightMsgEditPost                       int = 40
	DefaultWeightMsgDeletePost                     int = 20
	DefaultWeightMsgAddPostAttachment              int = 50
	DefaultWeightMsgRemovePostAttachment           int = 50
	DefaultWeightMsgAnswerPoll                     int = 50
	DefaultWeightMsgMovePost                       int = 10
	DefaultWeightMsgRequestPostOwnerTransfer       int = 10
	DefaultWeightMsgCancelPostOwnerTransferRequest int = 10
	DefaultWeightMsgAcceptPostOwnerTransferRequest int = 10
	DefaultWeightMsgRefusePostOwnerTransferRequest int = 10

	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"
	OpWeightMsgMovePost                       = "op_weight_msg_move_post"
	OpWeightMsgRequestPostOwnerTransfer       = "op_weight_msg_request_post_owner_transfer"
	OpWeightMsgCancelPostOwnerTransferRequest = "op_weight_msg_cancel_post_owner_transfer_request"
	OpWeightMsgAcceptPostOwnerTransferRequest = "op_weight_msg_accept_post_owner_transfer_request"
	OpWeightMsgRefusePostOwnerTransferRequest = "op_weight_msg_refuse_post_owner_transfer_request"

	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 RandomPostOwnerTransferRequest

func RandomPostOwnerTransferRequest(r *rand.Rand, requests []types.PostOwnerTransferRequest) types.PostOwnerTransferRequest

RandomPostOwnerTransferRequest returns a random post owner transfer request from the ones 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 SimulateMsgAcceptPostOwnerTransferRequest

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

SimulateMsgAcceptPostOwnerTransferRequest tests and runs a single msg accept post owner transfer request

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 SimulateMsgCancelPostOwnerTransferRequest

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

SimulateMsgCancelPostOwnerTransferRequest tests and runs a single msg cancel post owner transfer request

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 SimulateMsgMovePost

SimulateMsgMovePost tests and runs a single msg move post

func SimulateMsgRefusePostOwnerTransferRequest

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

SimulateMsgRefusePostOwnerTransferRequest tests and runs a single msg refuse post owner transfer request

func SimulateMsgRemovePostAttachment

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

SimulateMsgRemovePostAttachment tests and runs a single msg remove post attachment

func SimulateMsgRequestPostOwnerTransfer

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

SimulateMsgRequestPostOwnerTransfer tests and runs a single msg request post owner transfer request

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