Documentation ¶
Index ¶
- Constants
- Variables
- func CreateRandomValidEthTx(ctx *simulateContext, from, to *common.Address, amount *big.Int, ...) (ethTx *types.MsgEthereumTx, err error)
- func EstimateGas(ctx *simulateContext, from, to *common.Address, data *hexutil.Bytes, ...) (gas uint64, err error)
- func GenEnableCall(r *rand.Rand) bool
- func GenEnableCreate(r *rand.Rand) bool
- func GenExtraEIPs(r *rand.Rand) []int64
- func GetSignedTx(ctx *simulateContext, txBuilder client.TxBuilder, msg *types.MsgEthereumTx, ...) (signedTx signing.Tx, err error)
- func NewDecodeStore() func(kvA, kvB kv.Pair) string
- func ParamChanges(r *rand.Rand) []simtypes.LegacyParamChange
- func RandomTransferableAmount(ctx *simulateContext, address common.Address, estimateGas uint64, ...) (amount *big.Int, err error)
- func RandomizedGenState(simState *module.SimulationState)
- func SimulateEthCreateContract(ak types.AccountKeeper, k *keeper.Keeper) simtypes.Operation
- func SimulateEthSimpleTransfer(ak types.AccountKeeper, k *keeper.Keeper) simtypes.Operation
- func SimulateEthTx(ctx *simulateContext, from, to *common.Address, amount *big.Int, ...) (simtypes.OperationMsg, []simtypes.FutureOperation, error)
- func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper, ...) simulation.WeightedOperations
Constants ¶
const ( OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" )
const ( WeightMsgEthSimpleTransfer = 50 WeightMsgEthCreateContract = 50 )
Variables ¶
var ErrNoEnoughBalance = fmt.Errorf("no enough balance")
Functions ¶
func CreateRandomValidEthTx ¶
func CreateRandomValidEthTx(ctx *simulateContext, from, to *common.Address, amount *big.Int, data *hexutil.Bytes) (ethTx *types.MsgEthereumTx, err error)
CreateRandomValidEthTx create the ethereum tx with valid random values
func EstimateGas ¶
func EstimateGas(ctx *simulateContext, from, to *common.Address, data *hexutil.Bytes, gasCap uint64) (gas uint64, err error)
EstimateGas estimates the gas used by quering the keeper.
func GenEnableCall ¶
GenEnableCall enables the EnableCall param with 80% probability
func GenEnableCreate ¶
GenEnableCreate enables the EnableCreate param with 80% probability
func GenExtraEIPs ¶
GenExtraEIPs defines a set of extra EIPs with 50% probability
func GetSignedTx ¶
func GetSignedTx(ctx *simulateContext, txBuilder client.TxBuilder, msg *types.MsgEthereumTx, prv cryptotypes.PrivKey) (signedTx signing.Tx, err error)
GetSignedTx sign the ethereum tx and packs it as a signing.Tx .
func NewDecodeStore ¶
NewDecodeStore returns a decoder function closure that unmarshals the KVPair's value to the corresponding EVM type.
func ParamChanges ¶
func ParamChanges(r *rand.Rand) []simtypes.LegacyParamChange
ParamChanges defines the parameters that can be modified by param change proposals on the simulation.
func RandomTransferableAmount ¶
func RandomTransferableAmount(ctx *simulateContext, address common.Address, estimateGas uint64, gasFeeCap *big.Int) (amount *big.Int, err error)
RandomTransferableAmount generates a random valid transferable amount. Transferable amount is between the range [0, spendable), spendable = balance - gasFeeCap * GasLimit.
func RandomizedGenState ¶
func RandomizedGenState(simState *module.SimulationState)
RandomizedGenState generates a random GenesisState for the EVM module
func SimulateEthCreateContract ¶
SimulateEthCreateContract simulate create an ERC20 contract. It makes operationSimulateEthCallContract the future operations of SimulateEthCreateContract to ensure valid contract call.
func SimulateEthSimpleTransfer ¶
SimulateEthSimpleTransfer simulate simple eth account transferring gas token. It randomly choose sender, recipient and transferable amount. Other tx details like nonce, gasprice, gaslimit are calculated to get valid value.
func SimulateEthTx ¶
func SimulateEthTx( ctx *simulateContext, from, to *common.Address, amount *big.Int, data *hexutil.Bytes, prv cryptotypes.PrivKey, fops []simtypes.FutureOperation, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error)
SimulateEthTx creates valid ethereum tx and pack it as cosmos tx, and deliver it.
func WeightedOperations ¶
func WeightedOperations( appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper, k *keeper.Keeper, ) simulation.WeightedOperations
WeightedOperations generate Two kinds of operations: SimulateEthSimpleTransfer, SimulateEthCreateContract. Contract call operations work as the future operations of SimulateEthCreateContract.
Types ¶
This section is empty.