Skip to content

Commit

Permalink
update: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kstoykov committed Apr 28, 2022
1 parent 62e9b4e commit 32f16dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions module/app/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"

Expand Down Expand Up @@ -85,10 +86,14 @@ func AppStateRandomizedFn(

// generate a random amount of initial stake coins and a random initial
// number of bonded accounts
var initialStake, numInitiallyBonded int64
var initialStake sdk.Int
var numInitiallyBonded int64
minSelfDeleg := sdk.TokensFromConsensusPower(2000000, sdk.DefaultPowerReduction)
appParams.GetOrGenerate(
cdc, simappparams.StakePerAccount, &initialStake, r,
func(r *rand.Rand) { initialStake = r.Int63n(1e12) },
func(r *rand.Rand) {
initialStake = minSelfDeleg.Add(sdk.NewInt(r.Int63n(10)).Mul(sdk.NewInt(10000000)).Mul(minSelfDeleg))
},
)
appParams.GetOrGenerate(
cdc, simappparams.InitiallyBondedValidators, &numInitiallyBonded, r,
Expand Down
2 changes: 1 addition & 1 deletion module/app/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func SimulationOperations(app Gravity, cdc codec.JSONCodec, config simtypes.Conf
Rand: &rand.Rand{},
GenState: map[string]json.RawMessage{},
Accounts: []simtypes.Account{},
InitialStake: 0,
InitialStake: sdk.TokensFromConsensusPower(2000000, sdk.DefaultPowerReduction),
NumBonded: 0,
GenTimestamp: time.Time{},
UnbondTime: 0,
Expand Down

0 comments on commit 32f16dd

Please sign in to comment.