simulation

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpWeightMsgCreatePost       = "op_weight_msg_create_post"
	OpWeightMsgEditPost         = "op_weight_msg_edit_post"
	OpWeightMsgAddReaction      = "op_weight_msg_add_reaction"
	OpWeightMsgRemoveReaction   = "op_weight_msg_remove_reaction"
	OpWeightMsgAnswerPoll       = "op_weight_msg_answer_poll"
	OpWeightMsgRegisterReaction = "op_weight_msg_register_reaction"
	OpWeightMsgReportPost       = "op_weight_msg_report_post"

	DefaultGasValue = 5_000_000
)

Simulation operation weights constants

Variables

View Source
var (
	RandomMimeTypes = []string{"audio/aac", "application/x-bzip2", "audio/ogg", "image/webp", "image/png"}
	RandomHosts     = []string{"https://example.com/", "https://ipfs.ink/"}
)

Functions

func GetAccount

func GetAccount(address sdk.Address, accs []simtypes.Account) *simtypes.Account

GetAccount gets the account having the given address from the accs list

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 posts type

func ParamChanges

func ParamChanges(r *rand.Rand) []simtypes.ParamChange

func RandomAttachments

func RandomAttachments(r *rand.Rand, accs []simtypes.Account) types.Attachments

RandomAttachments returns a randomly generated list of post attachments

func RandomCommentsState

func RandomCommentsState(r *rand.Rand) types.CommentsState

RandomCommentsState returns a random comments state

func RandomDate

func RandomDate(r *rand.Rand) time.Time

RandomDate returns a random post creation date

func RandomEmojiPostReaction

func RandomEmojiPostReaction(r *rand.Rand) types.PostReaction

RandomEmojiPostReaction returns a random post reaction representing an emoji reaction

func RandomMessage

func RandomMessage(r *rand.Rand) string

RandomMessage returns a random post message from the above random lorem phrases

func RandomParams

func RandomParams(r *rand.Rand) types.Params

func RandomPoll

func RandomPoll(r *rand.Rand) *types.Poll

RandomPoll returns a randomly generated poll

func RandomPost

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

RandomPost picks and returns a random post from an array and returns its position in the array.

func RandomPostID

func RandomPostID(r *rand.Rand) string

RandomPostID returns a randomly generated postID

func RandomPostIDFromPosts

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

RandomPostIDFromPosts returns a randomly extracted post id from the list of posts given

func RandomReportMessage

func RandomReportMessage(r *rand.Rand) string

func RandomReportTypes

func RandomReportTypes(r *rand.Rand) string

func RandomSubspace

func RandomSubspace(r *rand.Rand) string

RandomSubspace returns a random post subspace from the above random subspaces

func RandomizedGenState

func RandomizedGenState(simState *module.SimulationState)

RandomizedGenState generates a random GenesisState for auth

func SimulateMsgAddPostReaction

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

SimulateMsgAddPostReaction tests and runs a single msg add reaction where the reacting user account already exists nolint: funlen

func SimulateMsgAnswerToPoll

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

SimulateMsgAnswerToPoll tests and runs a single msg poll answer where the answering user account already exists nolint: funlen

func SimulateMsgCreatePost

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

SimulateMsgCreatePost tests and runs a single msg create post where the post creator account already exists nolint: funlen

func SimulateMsgEditPost

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

SimulateMsgEditPost tests and runs a single msg edit post where the post creator account already exists nolint: funlen

func SimulateMsgRegisterReaction

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

SimulateMsgRegisterReaction tests and runs a single msg register reaction where the registering user account already exist nolint: funlen

func SimulateMsgRemovePostReaction

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

SimulateMsgRemovePostReaction tests and runs a single msg remove reaction where the reacting user account already exists nolint: funlen

func SimulateMsgReportPost

func SimulateMsgReportPost(
	pk postskeeper.Keeper, ak authkeeper.AccountKeeper, bk bankkeeper.Keeper,
) simtypes.Operation

SimulateMsgReportPost tests and runs a single MsgReportPost created by a random account. nolint: funlen

func WeightedOperations

WeightedOperations returns all the operations from the module with their respective weights

Types

type PostData

type PostData struct {
	types.Post
	CreatorAccount simtypes.Account
}

PostData contains the randomly generated data of a post

func RandomPostData

func RandomPostData(r *rand.Rand, accs []simtypes.Account) PostData

RandomPostData returns a randomly generated PostData based on the given random and accounts list

type PostReactionData

type PostReactionData struct {
	Shortcode string
	Value     string
	User      simtypes.Account
	PostID    string
}

PostReactionData contains all the data needed for a post reaction to be properly added or removed from a post

func RandomPostReactionData

func RandomPostReactionData(
	r *rand.Rand, accs []simtypes.Account, postID string, shortCode, value string,
) PostReactionData

RandomPostReactionData returns a randomly generated post reaction data object

type ReactionData

type ReactionData struct {
	Creator   simtypes.Account
	ShortCode string
	Value     string
	Subspace  string
}

ReactionData contains all the data needed for a registered reaction to be properly registered

func RandomReactionData

func RandomReactionData(r *rand.Rand, accs []simtypes.Account) ReactionData

RandomReactionData returns a randomly generated reaction data object

func RandomReactionsData

func RandomReactionsData(r *rand.Rand, accs []simtypes.Account) []ReactionData

type ReportsData

type ReportsData struct {
	PostID  string
	Message string
	Type    string
	Creator simtypes.Account
}

func RandomReportsData

func RandomReportsData(r *rand.Rand, posts []types.Post, accs []simtypes.Account) ReportsData

RandomReportsData returns a randomly generated ReportsData based on the given random posts and accounts list

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL