simulation

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpWeightMsgStoreCode           = "op_weight_msg_store_code"
	OpWeightMsgInstantiateContract = "op_weight_msg_instantiate_contract"
	OpWeightMsgExecuteContract     = "op_weight_msg_execute_contract"
	OpReflectContractPath          = "op_reflect_contract_path"
)

Simulation operation weights constants

Variables

This section is empty.

Functions

func BuildOperationInput

func BuildOperationInput(
	r *rand.Rand,
	app *baseapp.BaseApp,
	ctx sdk.Context,
	msg interface {
		sdk.Msg
		Type() string
	},
	simAccount simtypes.Account,
	ak types.AccountKeeper,
	bk BankKeeper,
	deposit sdk.Coins,
) simulation.OperationInput

BuildOperationInput helper to build object

func DefaultSimulationCodeIDSelector

func DefaultSimulationCodeIDSelector(ctx sdk.Context, wasmKeeper WasmKeeper) uint64

DefaultSimulationCodeIDSelector picks the first code id

func DefaultSimulationExecuteContractSelector

func DefaultSimulationExecuteContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper) sdk.AccAddress

DefaultSimulationExecuteContractSelector picks the first contract address

func DefaultSimulationExecutePayloader

func DefaultSimulationExecutePayloader(msg *types.MsgExecuteContract) error

DefaultSimulationExecutePayloader implements a bank msg to send the tokens from contract account back to original sender

func DefaultSimulationExecuteSenderSelector

func DefaultSimulationExecuteSenderSelector(wasmKeeper WasmKeeper, ctx sdk.Context, contractAddr sdk.AccAddress, accs []simtypes.Account) (simtypes.Account, error)

DefaultSimulationExecuteSenderSelector queries reflect contract for owner address and selects accounts

func GenAndDeliverTx

GenAndDeliverTx generates a transactions and delivers it.

func GenAndDeliverTxWithRandFees

func GenAndDeliverTxWithRandFees(txCtx simulation.OperationInput, gas uint64) (simtypes.OperationMsg, []simtypes.FutureOperation, error)

GenAndDeliverTxWithRandFees generates a transaction with a random fee and delivers it.

func ParamChanges

func ParamChanges(r *rand.Rand, cdc codec.Codec) []simtypes.ParamChange

func RandomParams

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

func RandomizedGenState

func RandomizedGenState(simstate *module.SimulationState)

RandomizedGenState generates a random GenesisState for wasm

func SimulateMsgExecuteContract

func SimulateMsgExecuteContract(
	ak types.AccountKeeper,
	bk BankKeeper,
	wasmKeeper WasmKeeper,
	contractSelector MsgExecuteContractSelector,
	senderSelector MsgExecuteSenderSelector,
	payloader MsgExecutePayloader,
) simtypes.Operation

SimulateMsgExecuteContract create a execute message a reflect contract instance

func SimulateMsgInstantiateContract

func SimulateMsgInstantiateContract(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.Operation

SimulateMsgInstantiateContract generates a MsgInstantiateContract with random values

func SimulateMsgStoreCode

func SimulateMsgStoreCode(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, wasmBz []byte, gas uint64) simtypes.Operation

SimulateMsgStoreCode generates a MsgStoreCode with random values

func WeightedOperations

func WeightedOperations(
	simstate *module.SimulationState,
	ak types.AccountKeeper,
	bk BankKeeper,
	wasmKeeper WasmKeeper,
) simulation.WeightedOperations

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

Types

type BankKeeper

type BankKeeper interface {
	simulation.BankKeeper
	IsSendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool
}

type CodeIDSelector

type CodeIDSelector = func(ctx sdk.Context, wasmKeeper WasmKeeper) uint64

CodeIDSelector returns code id to be used in simulations

type MsgExecuteContractSelector

type MsgExecuteContractSelector = func(ctx sdk.Context, wasmKeeper WasmKeeper) sdk.AccAddress

MsgExecuteContractSelector returns contract address to be used in simulations

type MsgExecutePayloader

type MsgExecutePayloader func(msg *types.MsgExecuteContract) error

MsgExecutePayloader extension point to modify msg with custom payload

type MsgExecuteSenderSelector

type MsgExecuteSenderSelector func(wasmKeeper WasmKeeper, ctx sdk.Context, contractAddr sdk.AccAddress, accs []simtypes.Account) (simtypes.Account, error)

MsgExecuteSenderSelector extension point that returns the sender address

type WasmKeeper

type WasmKeeper interface {
	GetParams(ctx sdk.Context) types.Params
	IterateCodeInfos(ctx sdk.Context, cb func(uint64, types.CodeInfo) bool)
	IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool)
	QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error)
	PeekAutoIncrementID(ctx sdk.Context, lastIDKey []byte) uint64
}

WasmKeeper is a subset of the wasm keeper used by simulations

Jump to

Keyboard shortcuts

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