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 RandomTransferableAmount(ctx *simulateContext, address common.Address, estimateGas uint64, ...) (amount *big.Int, err error)
- func RandomizedGenState(simState *module.SimulationState)
- func SimulateEthCreateContract(_ types.AccountKeeper, k *keeper.Keeper) simtypes.Operation
- func SimulateEthSimpleTransfer(_ types.AccountKeeper, k *keeper.Keeper) simtypes.Operation
- func SimulateEthTx(ctx *simulateContext, from, _ *common.Address, _ *big.Int, data *hexutil.Bytes, ...) (simtypes.OperationMsg, []simtypes.FutureOperation, error)
- func WeightedOperations(appParams simtypes.AppParams, _ codec.JSONCodec, ak types.AccountKeeper, ...) simulation.WeightedOperations
Constants ¶
const ( /* #nosec */ OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" /* #nosec */ OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" /* #nosec */ 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 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, _ *common.Address, _ *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, _ 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.