2021-10-11 11:09:53 +00:00
|
|
|
package simulation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
2022-04-28 07:43:39 +00:00
|
|
|
"math/rand"
|
2021-10-11 11:09:53 +00:00
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
|
|
|
|
|
|
"github.com/tharsis/ethermint/x/evm/types"
|
|
|
|
)
|
|
|
|
|
2022-04-28 07:43:39 +00:00
|
|
|
// GenExtraEIPs randomly generates specific extra eips or not.
|
|
|
|
func genExtraEIPs(r *rand.Rand) []int64 {
|
|
|
|
var extraEIPs []int64
|
|
|
|
if r.Uint32()%2 == 0 {
|
|
|
|
extraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529}
|
|
|
|
}
|
|
|
|
return extraEIPs
|
|
|
|
}
|
|
|
|
|
2021-10-11 11:09:53 +00:00
|
|
|
// RandomizedGenState generates a random GenesisState for nft
|
|
|
|
func RandomizedGenState(simState *module.SimulationState) {
|
|
|
|
params := types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig())
|
|
|
|
if simState.Rand.Uint32()%2 == 0 {
|
|
|
|
params = types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), 1344, 1884, 2200, 2929, 3198, 3529)
|
|
|
|
}
|
|
|
|
evmGenesis := types.NewGenesisState(params, []types.GenesisAccount{})
|
|
|
|
|
|
|
|
bz, err := json.MarshalIndent(evmGenesis, "", " ")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
|
|
|
|
|
|
|
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(evmGenesis)
|
|
|
|
}
|