Add kava modules to TestAppImportExport (#472)

* add kava modules to TestAppImportExport
This commit is contained in:
Kevin Davis 2020-04-29 10:10:41 -04:00 committed by GitHub
parent ae4aee46ff
commit c175e9e856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 72 additions and 59 deletions

View File

@ -8,9 +8,9 @@ const (
// Default simulation operation weights for messages and gov proposals // Default simulation operation weights for messages and gov proposals
const ( const (
DefaultWeightMsgPlaceBid int = 100 DefaultWeightMsgPlaceBid int = 75
DefaultWeightMsgCreateAtomicSwap int = 100 DefaultWeightMsgCreateAtomicSwap int = 50
DefaultWeightMsgUpdatePrices int = 100 DefaultWeightMsgUpdatePrices int = 50
DefaultWeightMsgCdp int = 100 DefaultWeightMsgCdp int = 100
DefaultWeightMsgClaimReward int = 100 DefaultWeightMsgClaimReward int = 50
) )

View File

@ -6,11 +6,6 @@ import (
"os" "os"
"testing" "testing"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/simapp/helpers" "github.com/cosmos/cosmos-sdk/simapp/helpers"
@ -25,6 +20,17 @@ import (
"github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/supply" "github.com/cosmos/cosmos-sdk/x/supply"
"github.com/kava-labs/kava/x/auction"
"github.com/kava-labs/kava/x/bep3"
"github.com/kava-labs/kava/x/cdp"
"github.com/kava-labs/kava/x/incentive"
"github.com/kava-labs/kava/x/kavadist"
"github.com/kava-labs/kava/x/pricefeed"
validatorvesting "github.com/kava-labs/kava/x/validator-vesting"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
) )
type StoreKeysPrefixes struct { type StoreKeysPrefixes struct {
@ -162,6 +168,13 @@ func TestAppImportExport(t *testing.T) {
{app.keys[supply.StoreKey], newApp.keys[supply.StoreKey], [][]byte{}}, {app.keys[supply.StoreKey], newApp.keys[supply.StoreKey], [][]byte{}},
{app.keys[params.StoreKey], newApp.keys[params.StoreKey], [][]byte{}}, {app.keys[params.StoreKey], newApp.keys[params.StoreKey], [][]byte{}},
{app.keys[gov.StoreKey], newApp.keys[gov.StoreKey], [][]byte{}}, {app.keys[gov.StoreKey], newApp.keys[gov.StoreKey], [][]byte{}},
{app.keys[auction.StoreKey], newApp.keys[auction.StoreKey], [][]byte{}},
{app.keys[bep3.StoreKey], newApp.keys[bep3.StoreKey], [][]byte{}},
{app.keys[cdp.StoreKey], newApp.keys[cdp.StoreKey], [][]byte{}},
{app.keys[incentive.StoreKey], newApp.keys[incentive.StoreKey], [][]byte{}},
{app.keys[kavadist.StoreKey], newApp.keys[kavadist.StoreKey], [][]byte{}},
{app.keys[pricefeed.StoreKey], newApp.keys[pricefeed.StoreKey], [][]byte{}},
{app.keys[validatorvesting.StoreKey], newApp.keys[validatorvesting.StoreKey], [][]byte{}},
} }
for _, skp := range storeKeysPrefixes { for _, skp := range storeKeysPrefixes {
@ -170,8 +183,9 @@ func TestAppImportExport(t *testing.T) {
failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes)
require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare")
if len(failedKVAs) != 0 {
fmt.Printf("compared %d key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) fmt.Printf("found %d non-equal key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B)
}
require.Equal(t, len(failedKVAs), 0, simapp.GetSimulationLog(skp.A.Name(), app.SimulationManager().StoreDecoders, app.Codec(), failedKVAs, failedKVBs)) require.Equal(t, len(failedKVAs), 0, simapp.GetSimulationLog(skp.A.Name(), app.SimulationManager().StoreDecoders, app.Codec(), failedKVAs, failedKVBs))
} }
} }

View File

@ -142,8 +142,6 @@ type (
AugmentedCDPs = types.AugmentedCDPs AugmentedCDPs = types.AugmentedCDPs
Deposit = types.Deposit Deposit = types.Deposit
Deposits = types.Deposits Deposits = types.Deposits
SupplyKeeper = types.SupplyKeeper
PricefeedKeeper = types.PricefeedKeeper
GenesisState = types.GenesisState GenesisState = types.GenesisState
MsgCreateCDP = types.MsgCreateCDP MsgCreateCDP = types.MsgCreateCDP
MsgDeposit = types.MsgDeposit MsgDeposit = types.MsgDeposit

View File

@ -4,10 +4,11 @@ import (
"fmt" "fmt"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/kava-labs/kava/x/cdp/types"
) )
// InitGenesis sets initial genesis state for cdp module // InitGenesis sets initial genesis state for cdp module
func InitGenesis(ctx sdk.Context, k Keeper, pk PricefeedKeeper, sk SupplyKeeper, gs GenesisState) { func InitGenesis(ctx sdk.Context, k Keeper, pk types.PricefeedKeeper, sk types.SupplyKeeper, gs GenesisState) {
if err := gs.Validate(); err != nil { if err := gs.Validate(); err != nil {
panic(fmt.Sprintf("failed to validate %s genesis state: %s", ModuleName, err)) panic(fmt.Sprintf("failed to validate %s genesis state: %s", ModuleName, err))
@ -61,12 +62,13 @@ func InitGenesis(ctx sdk.Context, k Keeper, pk PricefeedKeeper, sk SupplyKeeper,
k.IndexCdpByOwner(ctx, cdp) k.IndexCdpByOwner(ctx, cdp)
ratio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees)) ratio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees))
k.IndexCdpByCollateralRatio(ctx, cdp.Collateral.Denom, cdp.ID, ratio) k.IndexCdpByCollateralRatio(ctx, cdp.Collateral.Denom, cdp.ID, ratio)
k.IncrementTotalPrincipal(ctx, cdp.Collateral.Denom, cdp.Principal) k.IncrementTotalPrincipal(ctx, cdp.Collateral.Denom, cdp.Principal.Add(cdp.AccumulatedFees))
} }
k.SetNextCdpID(ctx, gs.StartingCdpID) k.SetNextCdpID(ctx, gs.StartingCdpID)
k.SetDebtDenom(ctx, gs.DebtDenom) k.SetDebtDenom(ctx, gs.DebtDenom)
k.SetGovDenom(ctx, gs.GovDenom) k.SetGovDenom(ctx, gs.GovDenom)
k.SetPreviousSavingsDistribution(ctx, gs.PreviousDistributionTime)
for _, d := range gs.Deposits { for _, d := range gs.Deposits {
k.SetDeposit(ctx, d) k.SetDeposit(ctx, d)

View File

@ -1,7 +1,6 @@
package keeper package keeper
import ( import (
"bytes"
"fmt" "fmt"
"github.com/cosmos/cosmos-sdk/store/prefix" "github.com/cosmos/cosmos-sdk/store/prefix"
@ -151,8 +150,7 @@ func (k Keeper) GetCdpID(ctx sdk.Context, owner sdk.AccAddress, denom string) (u
func (k Keeper) GetCdpIdsByOwner(ctx sdk.Context, owner sdk.AccAddress) ([]uint64, bool) { func (k Keeper) GetCdpIdsByOwner(ctx sdk.Context, owner sdk.AccAddress) ([]uint64, bool) {
store := prefix.NewStore(ctx.KVStore(k.key), types.CdpIDKeyPrefix) store := prefix.NewStore(ctx.KVStore(k.key), types.CdpIDKeyPrefix)
bz := store.Get(owner) bz := store.Get(owner)
// TODO figure out why this is necessary if bz == nil {
if bz == nil || bytes.Equal(bz, []byte{0}) {
return []uint64{}, false return []uint64{}, false
} }
var cdpIDs []uint64 var cdpIDs []uint64
@ -272,13 +270,8 @@ func (k Keeper) IndexCdpByOwner(ctx sdk.Context, cdp types.CDP) {
store.Set(cdp.Owner, idBytes) store.Set(cdp.Owner, idBytes)
return return
} }
for _, id := range cdpIDs {
if id == cdp.ID {
return
}
cdpIDs = append(cdpIDs, cdp.ID) cdpIDs = append(cdpIDs, cdp.ID)
store.Set(cdp.Owner, k.cdc.MustMarshalBinaryLengthPrefixed(cdpIDs)) store.Set(cdp.Owner, k.cdc.MustMarshalBinaryLengthPrefixed(cdpIDs))
}
} }
// RemoveCdpOwnerIndex deletes the cdp id from the store's index of cdps by owner // RemoveCdpOwnerIndex deletes the cdp id from the store's index of cdps by owner
@ -296,9 +289,9 @@ func (k Keeper) RemoveCdpOwnerIndex(ctx sdk.Context, cdp types.CDP) {
} }
if len(updatedCdpIds) == 0 { if len(updatedCdpIds) == 0 {
store.Delete(cdp.Owner) store.Delete(cdp.Owner)
return
} }
store.Set(cdp.Owner, k.cdc.MustMarshalBinaryLengthPrefixed(updatedCdpIds)) store.Set(cdp.Owner, k.cdc.MustMarshalBinaryLengthPrefixed(updatedCdpIds))
} }
// IndexCdpByCollateralRatio sets the cdp id in the store, indexed by the collateral type and collateral to debt ratio // IndexCdpByCollateralRatio sets the cdp id in the store, indexed by the collateral type and collateral to debt ratio

View File

@ -66,7 +66,7 @@ func (suite *SavingsTestSuite) TestGetSetPreviousDistributionTime() {
now := tmtime.Now() now := tmtime.Now()
_, f := suite.keeper.GetPreviousSavingsDistribution(suite.ctx) _, f := suite.keeper.GetPreviousSavingsDistribution(suite.ctx)
suite.False(f) suite.True(f)
suite.NotPanics(func() { suite.keeper.SetPreviousSavingsDistribution(suite.ctx, now) }) suite.NotPanics(func() { suite.keeper.SetPreviousSavingsDistribution(suite.ctx, now) })

View File

@ -11,13 +11,13 @@ import (
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
sim "github.com/cosmos/cosmos-sdk/x/simulation" sim "github.com/cosmos/cosmos-sdk/x/simulation"
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
"github.com/kava-labs/kava/x/cdp/client/cli" "github.com/kava-labs/kava/x/cdp/client/cli"
"github.com/kava-labs/kava/x/cdp/client/rest" "github.com/kava-labs/kava/x/cdp/client/rest"
"github.com/kava-labs/kava/x/cdp/simulation" "github.com/kava-labs/kava/x/cdp/simulation"
"github.com/kava-labs/kava/x/cdp/types"
) )
var ( var (
@ -76,13 +76,13 @@ type AppModule struct {
AppModuleBasic AppModuleBasic
keeper Keeper keeper Keeper
accountKeeper auth.AccountKeeper accountKeeper types.AccountKeeper
pricefeedKeeper PricefeedKeeper pricefeedKeeper types.PricefeedKeeper
supplyKeeper SupplyKeeper supplyKeeper types.SupplyKeeper
} }
// NewAppModule creates a new AppModule object // NewAppModule creates a new AppModule object
func NewAppModule(keeper Keeper, accountKeeper auth.AccountKeeper, pricefeedKeeper PricefeedKeeper, supplyKeeper SupplyKeeper) AppModule { func NewAppModule(keeper Keeper, accountKeeper types.AccountKeeper, pricefeedKeeper types.PricefeedKeeper, supplyKeeper types.SupplyKeeper) AppModule {
return AppModule{ return AppModule{
AppModuleBasic: AppModuleBasic{}, AppModuleBasic: AppModuleBasic{},
keeper: keeper, keeper: keeper,

View File

@ -7,7 +7,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp/helpers" "github.com/cosmos/cosmos-sdk/simapp/helpers"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
"github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/simulation"
@ -23,7 +22,7 @@ const (
// WeightedOperations returns all the operations from the module with their respective weights // WeightedOperations returns all the operations from the module with their respective weights
func WeightedOperations( func WeightedOperations(
appParams simulation.AppParams, cdc *codec.Codec, ak auth.AccountKeeper, appParams simulation.AppParams, cdc *codec.Codec, ak types.AccountKeeper,
k keeper.Keeper, pfk types.PricefeedKeeper, k keeper.Keeper, pfk types.PricefeedKeeper,
) simulation.WeightedOperations { ) simulation.WeightedOperations {
var weightMsgCdp int var weightMsgCdp int
@ -43,7 +42,7 @@ func WeightedOperations(
} }
// SimulateMsgCdp generates a MsgCreateCdp or MsgDepositCdp with random values. // SimulateMsgCdp generates a MsgCreateCdp or MsgDepositCdp with random values.
func SimulateMsgCdp(ak auth.AccountKeeper, k keeper.Keeper, pfk types.PricefeedKeeper) simulation.Operation { func SimulateMsgCdp(ak types.AccountKeeper, k keeper.Keeper, pfk types.PricefeedKeeper) simulation.Operation {
return func( return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string, r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,
) (simulation.OperationMsg, []simulation.FutureOperation, error) { ) (simulation.OperationMsg, []simulation.FutureOperation, error) {
@ -125,12 +124,12 @@ func SimulateMsgCdp(ak auth.AccountKeeper, k keeper.Keeper, pfk types.PricefeedK
simAccount.PrivKey, simAccount.PrivKey,
) )
_, result, err := app.Deliver(tx) _, _, err := app.Deliver(tx)
if err != nil { if err != nil {
return simulation.NoOpMsg(types.ModuleName), nil, err return simulation.NoOpMsg(types.ModuleName), nil, err
} }
return simulation.NewOperationMsg(msg, true, result.Log), nil, nil return simulation.NewOperationMsg(msg, true, ""), nil, nil
} }
// a cdp already exists, deposit to it, draw debt from it, or repay debt to it // a cdp already exists, deposit to it, draw debt from it, or repay debt to it
@ -149,12 +148,12 @@ func SimulateMsgCdp(ak auth.AccountKeeper, k keeper.Keeper, pfk types.PricefeedK
simAccount.PrivKey, simAccount.PrivKey,
) )
_, result, err := app.Deliver(tx) _, _, err := app.Deliver(tx)
if err != nil { if err != nil {
return simulation.NoOpMsg(types.ModuleName), nil, err return simulation.NoOpMsg(types.ModuleName), nil, err
} }
return simulation.NewOperationMsg(msg, true, result.Log), nil, nil return simulation.NewOperationMsg(msg, true, ""), nil, nil
} }
// deposit 25% of the time // deposit 25% of the time
@ -172,12 +171,12 @@ func SimulateMsgCdp(ak auth.AccountKeeper, k keeper.Keeper, pfk types.PricefeedK
simAccount.PrivKey, simAccount.PrivKey,
) )
_, result, err := app.Deliver(tx) _, _, err := app.Deliver(tx)
if err != nil { if err != nil {
return simulation.NoOpMsg(types.ModuleName), nil, err return simulation.NoOpMsg(types.ModuleName), nil, err
} }
return simulation.NewOperationMsg(msg, true, result.Log), nil, nil return simulation.NewOperationMsg(msg, true, ""), nil, nil
} }
// draw debt 25% of the time // draw debt 25% of the time
@ -215,12 +214,13 @@ func SimulateMsgCdp(ak auth.AccountKeeper, k keeper.Keeper, pfk types.PricefeedK
simAccount.PrivKey, simAccount.PrivKey,
) )
_, result, err := app.Deliver(tx) _, _, err := app.Deliver(tx)
if err != nil { if err != nil {
return simulation.NoOpMsg(types.ModuleName), nil, err return simulation.NoOpMsg(types.ModuleName), nil, err
} }
return simulation.NewOperationMsg(msg, true, result.Log), nil, nil return simulation.NewOperationMsg(msg, true, ""), nil, nil
} }
// repay debt 25% of the time // repay debt 25% of the time
@ -248,12 +248,12 @@ func SimulateMsgCdp(ak auth.AccountKeeper, k keeper.Keeper, pfk types.PricefeedK
simAccount.PrivKey, simAccount.PrivKey,
) )
_, result, err := app.Deliver(tx) _, _, err := app.Deliver(tx)
if err != nil { if err != nil {
return simulation.NoOpMsg(types.ModuleName), nil, err return simulation.NoOpMsg(types.ModuleName), nil, err
} }
return simulation.NewOperationMsg(msg, true, result.Log), nil, nil return simulation.NewOperationMsg(msg, true, ""), nil, nil
} }
return simulation.NoOpMsg(types.ModuleName), nil, nil return simulation.NoOpMsg(types.ModuleName), nil, nil

View File

@ -9,7 +9,7 @@ import (
pftypes "github.com/kava-labs/kava/x/pricefeed/types" pftypes "github.com/kava-labs/kava/x/pricefeed/types"
) )
// SupplyKeeper defines the expected supply keeper for module accounts // SupplyKeeper defines the expected supply keeper for module accounts (noalias)
type SupplyKeeper interface { type SupplyKeeper interface {
GetModuleAddress(name string) sdk.AccAddress GetModuleAddress(name string) sdk.AccAddress
GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI
@ -25,7 +25,7 @@ type SupplyKeeper interface {
GetSupply(ctx sdk.Context) (supply supplyexported.SupplyI) GetSupply(ctx sdk.Context) (supply supplyexported.SupplyI)
} }
// PricefeedKeeper defines the expected interface for the pricefeed // PricefeedKeeper defines the expected interface for the pricefeed (noalias)
type PricefeedKeeper interface { type PricefeedKeeper interface {
GetCurrentPrice(sdk.Context, string) (pftypes.CurrentPrice, error) GetCurrentPrice(sdk.Context, string) (pftypes.CurrentPrice, error)
GetParams(sdk.Context) pftypes.Params GetParams(sdk.Context) pftypes.Params
@ -45,4 +45,5 @@ type AuctionKeeper interface {
// AccountKeeper expected interface for the account keeper (noalias) // AccountKeeper expected interface for the account keeper (noalias)
type AccountKeeper interface { type AccountKeeper interface {
IterateAccounts(ctx sdk.Context, cb func(account authexported.Account) (stop bool)) IterateAccounts(ctx sdk.Context, cb func(account authexported.Account) (stop bool))
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
} }

View File

@ -6,7 +6,7 @@ import (
"time" "time"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/auth/exported" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/kava-labs/kava/x/validator-vesting/types" "github.com/kava-labs/kava/x/validator-vesting/types"
"github.com/tendermint/tendermint/libs/kv" "github.com/tendermint/tendermint/libs/kv"
) )
@ -15,9 +15,9 @@ import (
func DecodeStore(cdc *codec.Codec, kvA, kvB kv.Pair) string { func DecodeStore(cdc *codec.Codec, kvA, kvB kv.Pair) string {
switch { switch {
case bytes.Equal(kvA.Key[:1], types.ValidatorVestingAccountPrefix): case bytes.Equal(kvA.Key[:1], types.ValidatorVestingAccountPrefix):
var accA, accB exported.Account var accA, accB sdk.AccAddress
cdc.MustUnmarshalBinaryBare(kvA.Value, &accA) accA = sdk.AccAddress(kvA.Key[1:])
cdc.MustUnmarshalBinaryBare(kvB.Value, &accB) accB = sdk.AccAddress(kvB.Key[1:])
return fmt.Sprintf("%v\n%v", accA, accB) return fmt.Sprintf("%v\n%v", accA, accB)
case bytes.Equal(kvA.Key, types.BlocktimeKey): case bytes.Equal(kvA.Key, types.BlocktimeKey):
var btA, btB time.Time var btA, btB time.Time

View File

@ -5,14 +5,18 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth"
"github.com/kava-labs/kava/x/validator-vesting/types" "github.com/kava-labs/kava/x/validator-vesting/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/libs/kv"
)
var (
pk1 = ed25519.GenPrivKey().PubKey()
addr1 = sdk.AccAddress(pk1.Address())
) )
func makeTestCodec() (cdc *codec.Codec) { func makeTestCodec() (cdc *codec.Codec) {
@ -28,11 +32,10 @@ func makeTestCodec() (cdc *codec.Codec) {
func TestDecodeDistributionStore(t *testing.T) { func TestDecodeDistributionStore(t *testing.T) {
cdc := makeTestCodec() cdc := makeTestCodec()
acc := types.ValidatorVestingAccount{SigningThreshold: 1}
now := time.Now().UTC() now := time.Now().UTC()
kvPairs := kv.Pairs{ kvPairs := kv.Pairs{
kv.Pair{Key: types.ValidatorVestingAccountPrefix, Value: cdc.MustMarshalBinaryBare(acc)}, kv.Pair{Key: append(types.ValidatorVestingAccountPrefix, addr1.Bytes()...), Value: []byte{0}},
kv.Pair{Key: types.BlocktimeKey, Value: cdc.MustMarshalBinaryLengthPrefixed(now)}, kv.Pair{Key: types.BlocktimeKey, Value: cdc.MustMarshalBinaryLengthPrefixed(now)},
kv.Pair{Key: []byte{0x99}, Value: []byte{0x99}}, kv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
} }
@ -41,7 +44,7 @@ func TestDecodeDistributionStore(t *testing.T) {
name string name string
expectedLog string expectedLog string
}{ }{
{"ValidatorVestingAccount", fmt.Sprintf("%v\n%v", acc, acc)}, {"ValidatorVestingAccount", fmt.Sprintf("%v\n%v", addr1, addr1)},
{"BlockTime", fmt.Sprintf("%s\n%s", now, now)}, {"BlockTime", fmt.Sprintf("%s\n%s", now, now)},
{"other", ""}, {"other", ""},
} }

View File

@ -73,6 +73,8 @@ func RandomizedGenState(simState *module.SimulationState) {
} }
newAuthGenesis := authtypes.NewGenesisState(authGenState.Params, newGenesisAccs) newAuthGenesis := authtypes.NewGenesisState(authGenState.Params, newGenesisAccs)
simState.GenState[authtypes.ModuleName] = simState.Cdc.MustMarshalJSON(newAuthGenesis) simState.GenState[authtypes.ModuleName] = simState.Cdc.MustMarshalJSON(newAuthGenesis)
vestGenState := types.DefaultGenesisState()
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(vestGenState)
} }
func getRandomValidatorConsAddr(simState *module.SimulationState, rint int) sdk.ConsAddress { func getRandomValidatorConsAddr(simState *module.SimulationState, rint int) sdk.ConsAddress {