4ea9b6dc6d
* add note fix note * add TestAppStateFn TestRandomAccounts * marshal int slice to json * add paramschange for enableCreate and enableCall * AppStateFn -> StateFn * add TestDecodeStore * update github actions to run evm simulation * add TestParamChanges * add TestRandomizedGenState * use go install for runsim * resolve conflict * use random gasCap to estimate gas * use estimateGas to calculate max transferableAmount * update godoc * TestAppStateFn -> TestStateFn * Update x/evm/simulation/genesis.go * comment Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package simulation
|
|
|
|
// DONTCOVER
|
|
|
|
import (
|
|
"fmt"
|
|
"math/rand"
|
|
|
|
amino "github.com/cosmos/cosmos-sdk/codec"
|
|
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
|
"github.com/cosmos/cosmos-sdk/x/simulation"
|
|
"github.com/tharsis/ethermint/x/evm/types"
|
|
)
|
|
|
|
// ParamChanges defines the parameters that can be modified by param change proposals
|
|
// on the simulation.
|
|
func ParamChanges(r *rand.Rand) []simtypes.ParamChange {
|
|
return []simtypes.ParamChange{
|
|
simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyExtraEIPs),
|
|
func(r *rand.Rand) string {
|
|
extraEIPs := GenExtraEIPs(r)
|
|
amino := amino.NewLegacyAmino()
|
|
bz, err := amino.MarshalJSON(extraEIPs)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return string(bz)
|
|
},
|
|
),
|
|
simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyEnableCreate),
|
|
func(r *rand.Rand) string {
|
|
return fmt.Sprintf("%v", GenEnableCreate(r))
|
|
},
|
|
),
|
|
simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyEnableCall),
|
|
func(r *rand.Rand) string {
|
|
return fmt.Sprintf("%v", GenEnableCall(r))
|
|
},
|
|
),
|
|
}
|
|
}
|