From 2032d759169a56e68fc337d8f043d28971e4d612 Mon Sep 17 00:00:00 2001 From: chengwenxi Date: Fri, 9 Nov 2018 13:30:29 +0800 Subject: [PATCH 1/2] fix sim mock app --- simulation/mock/app.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/simulation/mock/app.go b/simulation/mock/app.go index 48e9bfe81..8690d3f13 100644 --- a/simulation/mock/app.go +++ b/simulation/mock/app.go @@ -46,6 +46,7 @@ type App struct { TkeyStake *sdk.TransientStoreKey KeyParams *sdk.KVStoreKey TkeyParams *sdk.TransientStoreKey + KeyUpgrade *sdk.KVStoreKey // TODO: Abstract this out from not needing to be auth specifically AccountKeeper auth.AccountKeeper @@ -85,6 +86,7 @@ func NewApp() *App { TkeyStake: sdk.NewTransientStoreKey("transient_stake"), KeyParams: sdk.NewKVStoreKey("params"), TkeyParams: sdk.NewTransientStoreKey("transient_params"), + KeyUpgrade: sdk.NewKVStoreKey("upgrade"), TotalCoinsSupply: sdk.Coins{}, } @@ -137,7 +139,11 @@ func NewApp() *App { func (app *App) CompleteSetup(newKeys ...sdk.StoreKey) error { newKeys = append(newKeys, app.KeyMain) newKeys = append(newKeys, app.KeyAccount) + newKeys = append(newKeys, app.KeyParams) + newKeys = append(newKeys, app.KeyStake) newKeys = append(newKeys, app.KeyFeeCollection) + newKeys = append(newKeys, app.TkeyParams) + newKeys = append(newKeys, app.TkeyStake) for _, key := range newKeys { switch key.(type) { From 4978db8b863a7a643b9fbdda9e2d35844e7e2085 Mon Sep 17 00:00:00 2001 From: chengwenxi Date: Fri, 9 Nov 2018 13:50:28 +0800 Subject: [PATCH 2/2] fix gov & stake sim test --- simulation/gov/sim_test.go | 20 +------------------- simulation/stake/sim_test.go | 2 +- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/simulation/gov/sim_test.go b/simulation/gov/sim_test.go index d7db44ffe..1dc645a5a 100644 --- a/simulation/gov/sim_test.go +++ b/simulation/gov/sim_test.go @@ -9,11 +9,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/stake" - "github.com/irisnet/irishub/iparam" "github.com/irisnet/irishub/modules/gov" - "github.com/irisnet/irishub/modules/gov/params" "github.com/irisnet/irishub/simulation/mock" "github.com/irisnet/irishub/simulation/mock/simulation" ) @@ -29,7 +26,6 @@ func TestGovWithRandomMessages(t *testing.T) { stakeKey := mapp.KeyStake stakeTKey := mapp.TkeyStake paramKey := mapp.KeyParams - paramTKey := mapp.TkeyParams govKey := sdk.NewKVStoreKey("gov") paramKeeper := mapp.ParamsKeeper @@ -45,20 +41,6 @@ func TestGovWithRandomMessages(t *testing.T) { bankKeeper, stakeKeeper, mapp.RegisterCodespace(gov.DefaultCodespace), ) - iparam.SetParamReadWriter(mapp.ParamsKeeper.Subspace(iparam.GovParamspace).WithTypeTable( - params.NewTypeTable( - govparams.DepositProcedureParameter.GetStoreKey(), govparams.DepositProcedure{}, - govparams.VotingProcedureParameter.GetStoreKey(), govparams.VotingProcedure{}, - govparams.TallyingProcedureParameter.GetStoreKey(), govparams.TallyingProcedure{}, - )), - &govparams.DepositProcedureParameter, - &govparams.VotingProcedureParameter, - &govparams.TallyingProcedureParameter) - - iparam.RegisterGovParamMapping( - &govparams.DepositProcedureParameter, - &govparams.VotingProcedureParameter, - &govparams.TallyingProcedureParameter) mapp.Router().AddRoute("gov", []*sdk.KVStoreKey{govKey, mapp.KeyAccount, stakeKey, paramKey}, gov.NewHandler(govKeeper)) mapp.SetEndBlocker(func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { @@ -66,7 +48,7 @@ func TestGovWithRandomMessages(t *testing.T) { return abci.ResponseEndBlock{} }) - err := mapp.CompleteSetup(stakeKey, stakeTKey, paramKey, paramTKey, govKey) + err := mapp.CompleteSetup(govKey) if err != nil { panic(err) } diff --git a/simulation/stake/sim_test.go b/simulation/stake/sim_test.go index 52c7c145e..fe97f65dd 100644 --- a/simulation/stake/sim_test.go +++ b/simulation/stake/sim_test.go @@ -43,7 +43,7 @@ func TestStakeWithRandomMessages(t *testing.T) { } }) - err := mapp.CompleteSetup(stakeKey, stakeTKey, paramsKey, paramsTKey, distrKey) + err := mapp.CompleteSetup(distrKey) if err != nil { panic(err) }