simulation

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 22 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"

	DefaultGasValue = 800000
)

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 DecodeStore

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

DecodeStore unmarshals the KVPair's Reaction to the corresponding posts type

func GetAccount

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

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

func ParamChanges

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

func RandomAttachments added in v0.10.0

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

RandomAttachments returns a randomly generated list of post attachments

func RandomDate added in v0.10.0

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 RandomHashtag

func RandomHashtag(r *rand.Rand) string

RandomHashtag returns a random hashtag from the above random hashtags

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 RandomPollData

func RandomPollData(r *rand.Rand) *types.PollData

RandomPollData returns a randomly generated poll data

func RandomPost

func RandomPost(r *rand.Rand, posts types.Posts) (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) types.PostID

RandomPostID returns a randomly generated postID

func RandomPostIDFromPosts added in v0.10.0

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

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

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 auth.AccountKeeper) sim.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 auth.AccountKeeper) sim.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 auth.AccountKeeper) sim.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 auth.AccountKeeper) sim.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 auth.AccountKeeper) sim.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 auth.AccountKeeper) sim.Operation

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

func WeightedOperations

func WeightedOperations(appParams sim.AppParams, cdc *codec.Codec, k keeper.Keeper, ak auth.AccountKeeper) sim.WeightedOperations

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

Types

type PostData

type PostData struct {
	Creator        sim.Account
	ParentID       types.PostID
	Message        string
	AllowsComments bool
	Subspace       string
	OptionalData   map[string]string
	Attachments    types.Attachments
	PollData       *types.PollData
}

PostData contains the randomly generated data of a post

func RandomPostData

func RandomPostData(r *rand.Rand, accs []sim.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      sim.Account
	PostID    types.PostID
}

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 []sim.Account, postID types.PostID, shortCode, value string) PostReactionData

RandomPostReactionData returns a randomly generated post reaction data object

type ReactionData

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

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

func RandomReactionData

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

RandomReactionData returns a randomly generated reaction data object

func RandomReactionsData added in v0.10.0

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

Jump to

Keyboard shortcuts

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