Documentation ¶
Index ¶
- Constants
- func BuildOperationInput(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, msg interface{ ... }, ...) simulation.OperationInput
- func DefaultSimulateContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper) sdk.AccAddress
- func DefaultSimulateUpdateAdminProposalContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper, adminAddress string) (sdk.AccAddress, types.ContractInfo)
- func DefaultSimulationClearAdminContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper, adminAddress string) sdk.AccAddress
- func DefaultSimulationCodeIDSelector(ctx sdk.Context, wasmKeeper WasmKeeper) uint64
- func DefaultSimulationExecuteContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper) sdk.AccAddress
- func DefaultSimulationExecutePayloader(msg *types.MsgExecuteContract) error
- func DefaultSimulationExecuteSenderSelector(wasmKeeper WasmKeeper, ctx sdk.Context, contractAddr sdk.AccAddress, ...) (simtypes.Account, error)
- func DefaultSimulationMigrateCodeIDSelector(ctx sdk.Context, wasmKeeper WasmKeeper, currentCodeID uint64) uint64
- func DefaultSimulationMigrateContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper, adminAddress string) (sdk.AccAddress, types.ContractInfo)
- func DefaultSimulationUpdateAdminContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper, adminAddress string) (sdk.AccAddress, types.ContractInfo)
- func ProposalMsgs(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedProposalMsg
- func RandomizedGenState(simstate *module.SimulationState)
- func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdminContractSelector) simtypes.MsgSimulatorFn
- func SimulateExecuteContractProposal(_ BankKeeper, wasmKeeper WasmKeeper, ...) simtypes.MsgSimulatorFn
- func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
- func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, ...) simtypes.MsgSimulatorFn
- func SimulateMsgClearAdmin(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, ...) simtypes.Operation
- func SimulateMsgExecuteContract(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, ...) simtypes.Operation
- func SimulateMsgInstantiateContract(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, ...) simtypes.Operation
- func SimulateMsgMigrateContract(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, ...) simtypes.Operation
- func SimulateMsgStoreCode(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, wasmBz []byte) simtypes.Operation
- func SimulateMsgUpdateAmin(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, ...) simtypes.Operation
- func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
- func SimulateStoreAndInstantiateContractProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn
- func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn
- func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoContractProposalContractSelector) simtypes.MsgSimulatorFn
- func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
- func SimulateUpdateAdminProposal(wasmKeeper WasmKeeper, contractSelector UpdateAdminContractSelector) simtypes.MsgSimulatorFn
- func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
- func WeightedOperations(appParams simtypes.AppParams, ak types.AccountKeeper, bk BankKeeper, ...) simulation.WeightedOperations
- type BankKeeper
- type ClearAdminContractSelector
- type CodeIDSelector
- type MigrateContractProposalContractSelector
- type MsgClearAdminContractSelector
- type MsgExecuteContractSelector
- type MsgExecutePayloader
- type MsgExecuteSenderSelector
- type MsgMigrateCodeIDSelector
- type MsgMigrateContractSelector
- type MsgUpdateAdminContractSelector
- type SudoContractProposalContractSelector
- type UpdateAdminContractSelector
- type WasmKeeper
Constants ¶
const ( OpWeightMsgStoreCode = "op_weight_msg_store_code" OpWeightMsgInstantiateContract = "op_weight_msg_instantiate_contract" OpWeightMsgExecuteContract = "op_weight_msg_execute_contract" OpWeightMsgUpdateAdmin = "op_weight_msg_update_admin" OpWeightMsgClearAdmin = "op_weight_msg_clear_admin" OpWeightMsgMigrateContract = "op_weight_msg_migrate_contract" OpReflectContractPath = "op_reflect_contract_path" DefaultWeightMsgStoreCode int = 50 DefaultWeightMsgInstantiateContract int = 100 DefaultWeightMsgExecuteContract int = 100 DefaultWeightMsgUpdateAdmin int = 25 DefaultWeightMsgClearAdmin int = 10 DefaultWeightMsgMigrateContract int = 50 )
Simulation operation weights constants
const ( WeightStoreCodeProposal = "weight_store_code_proposal" WeightInstantiateContractProposal = "weight_instantiate_contract_proposal" WeightUpdateAdminProposal = "weight_update_admin_proposal" WeightExeContractProposal = "weight_execute_contract_proposal" WeightClearAdminProposal = "weight_clear_admin_proposal" WeightMigrateContractProposal = "weight_migrate_contract_proposal" WeightSudoContractProposal = "weight_sudo_contract_proposal" WeightPinCodesProposal = "weight_pin_codes_proposal" WeightUnpinCodesProposal = "weight_unpin_codes_proposal" WeightUpdateInstantiateConfigProposal = "weight_update_instantiate_config_proposal" WeightStoreAndInstantiateContractProposal = "weight_store_and_instantiate_contract_proposal" DefaultWeightStoreCodeProposal int = 5 DefaultWeightInstantiateContractProposal int = 5 DefaultWeightUpdateAdminProposal int = 5 DefaultWeightExecuteContractProposal int = 5 DefaultWeightClearAdminProposal int = 5 DefaultWeightMigrateContractProposal int = 5 DefaultWeightSudoContractProposal int = 5 DefaultWeightPinCodesProposal int = 5 DefaultWeightUnpinCodesProposal int = 5 DefaultWeightUpdateInstantiateConfigProposal int = 5 DefaultWeightStoreAndInstantiateContractProposal int = 5 )
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 DefaultSimulateContractSelector ¶
func DefaultSimulateContractSelector( ctx sdk.Context, wasmKeeper WasmKeeper, ) sdk.AccAddress
func DefaultSimulateUpdateAdminProposalContractSelector ¶
func DefaultSimulateUpdateAdminProposalContractSelector( ctx sdk.Context, wasmKeeper WasmKeeper, adminAddress string, ) (sdk.AccAddress, types.ContractInfo)
func DefaultSimulationClearAdminContractSelector ¶
func DefaultSimulationClearAdminContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper, adminAddress string) sdk.AccAddress
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 DefaultSimulationMigrateCodeIDSelector ¶
func DefaultSimulationMigrateCodeIDSelector(ctx sdk.Context, wasmKeeper WasmKeeper, currentCodeID uint64) uint64
func DefaultSimulationMigrateContractSelector ¶
func DefaultSimulationMigrateContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper, adminAddress string) (sdk.AccAddress, types.ContractInfo)
func DefaultSimulationUpdateAdminContractSelector ¶
func DefaultSimulationUpdateAdminContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper, adminAddress string) (sdk.AccAddress, types.ContractInfo)
DefaultSimulationUpdateAdminContractSelector picks the first contract which Admin != ""
func ProposalMsgs ¶
func ProposalMsgs(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedProposalMsg
func RandomizedGenState ¶
func RandomizedGenState(simstate *module.SimulationState)
RandomizeGenState generates a random GenesisState for wasm
func SimulateClearAdminProposal ¶
func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdminContractSelector) simtypes.MsgSimulatorFn
Simulate clear admin proposal
func SimulateExecuteContractProposal ¶
func SimulateExecuteContractProposal( _ BankKeeper, wasmKeeper WasmKeeper, contractSelector MsgExecuteContractSelector, senderSelector MsgExecuteSenderSelector, payloader MsgExecutePayloader, ) simtypes.MsgSimulatorFn
Simulate execute contract proposal
func SimulateInstantiateContractProposal ¶
func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
Simulate instantiate contract proposal
func SimulateMigrateContractProposal ¶
func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector MigrateContractProposalContractSelector, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
Simulate migrate contract proposal
func SimulateMsgClearAdmin ¶
func SimulateMsgClearAdmin( ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, contractSelector MsgClearAdminContractSelector, ) simtypes.Operation
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 SimulateMsgMigrateContract ¶
func SimulateMsgMigrateContract( ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, contractSelector MsgMigrateContractSelector, codeIDSelector MsgMigrateCodeIDSelector, ) simtypes.Operation
func SimulateMsgStoreCode ¶
func SimulateMsgStoreCode( ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, wasmBz []byte, ) simtypes.Operation
SimulateMsgStoreCode generates a MsgStoreCode with random values
func SimulateMsgUpdateAmin ¶
func SimulateMsgUpdateAmin( ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, contractSelector MsgUpdateAdminContractSelector, ) simtypes.Operation
func SimulatePinContractProposal ¶
func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
Simulate pin contract proposal
func SimulateStoreAndInstantiateContractProposal ¶
func SimulateStoreAndInstantiateContractProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn
func SimulateStoreCodeProposal ¶
func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn
simulate store code proposal (unused now) Current problem: out of gas (defaul gaswanted config of gov SimulateMsgSubmitProposal is 10_000_000) but this proposal may need more than it
func SimulateSudoContractProposal ¶
func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoContractProposalContractSelector) simtypes.MsgSimulatorFn
Simulate sudo contract proposal
func SimulateUnpinContractProposal ¶
func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
Simulate unpin contract proposal
func SimulateUpdateAdminProposal ¶
func SimulateUpdateAdminProposal(wasmKeeper WasmKeeper, contractSelector UpdateAdminContractSelector) simtypes.MsgSimulatorFn
Simulate update admin contract proposal
func SimulateUpdateInstantiateConfigProposal ¶
func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn
Simulate update instantiate config proposal
func WeightedOperations ¶
func WeightedOperations( appParams simtypes.AppParams, 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 context.Context, coin sdk.Coin) bool }
type ClearAdminContractSelector ¶
type ClearAdminContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress
type CodeIDSelector ¶
type CodeIDSelector = func(ctx sdk.Context, wasmKeeper WasmKeeper) uint64
CodeIDSelector returns code id to be used in simulations
type MigrateContractProposalContractSelector ¶
type MigrateContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress
type MsgClearAdminContractSelector ¶
type MsgClearAdminContractSelector func(sdk.Context, WasmKeeper, string) sdk.AccAddress
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 MsgMigrateCodeIDSelector ¶
type MsgMigrateCodeIDSelector func(sdk.Context, WasmKeeper, uint64) uint64
type MsgMigrateContractSelector ¶
type MsgMigrateContractSelector func(sdk.Context, WasmKeeper, string) (sdk.AccAddress, types.ContractInfo)
type MsgUpdateAdminContractSelector ¶
type MsgUpdateAdminContractSelector func(sdk.Context, WasmKeeper, string) (sdk.AccAddress, types.ContractInfo)
type SudoContractProposalContractSelector ¶
type SudoContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress
type UpdateAdminContractSelector ¶
type UpdateAdminContractSelector func(sdk.Context, WasmKeeper, string) (sdk.AccAddress, types.ContractInfo)
type WasmKeeper ¶
type WasmKeeper interface { GetAuthority() string GetParams(ctx context.Context) types.Params IterateCodeInfos(ctx context.Context, cb func(uint64, types.CodeInfo) bool) IterateContractInfo(ctx context.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) QuerySmart(ctx context.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) PeekAutoIncrementID(ctx context.Context, lastIDKey []byte) (uint64, error) }
WasmKeeper is a subset of the wasm keeper used by simulations