From e1095dec67a6d746a8aa2bbde08270a0527169a1 Mon Sep 17 00:00:00 2001 From: Spoorthi Satheesha <9302666+spoo-bar@users.noreply.github.com> Date: Wed, 20 Sep 2023 12:16:25 +0530 Subject: [PATCH] adding consensusparamtypes.StoreKey storekey && fixing staking keeper --- app/app.go | 25 +++++++++++++------------ app/export.go | 2 +- app/keepers/keepers.go | 2 +- app/test_access.go | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/app.go b/app/app.go index 0e72210a..eb3e5f85 100644 --- a/app/app.go +++ b/app/app.go @@ -76,7 +76,6 @@ import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govV1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govV1Beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" @@ -322,8 +321,10 @@ func NewArchwayApp( minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, - feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, - trackingTypes.StoreKey, rewardsTypes.StoreKey, icahosttypes.StoreKey, ibcfeetypes.StoreKey, crisistypes.StoreKey, group.StoreKey, nftkeeper.StoreKey, + feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, consensusparamtypes.StoreKey, + icahosttypes.StoreKey, ibcfeetypes.StoreKey, crisistypes.StoreKey, group.StoreKey, nftkeeper.StoreKey, + + trackingTypes.StoreKey, rewardsTypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -391,7 +392,7 @@ func NewArchwayApp( keys[feegrant.StoreKey], app.Keepers.AccountKeeper, ) - stakingKeeper := stakingkeeper.NewKeeper( + app.Keepers.StakingKeeper = stakingkeeper.NewKeeper( appCodec, keys[stakingtypes.StoreKey], app.Keepers.AccountKeeper, @@ -403,7 +404,7 @@ func NewArchwayApp( keys[distrtypes.StoreKey], app.Keepers.AccountKeeper, app.Keepers.BankKeeper, - stakingKeeper, + app.Keepers.StakingKeeper, authtypes.FeeCollectorName, govModuleAddr, ) @@ -411,7 +412,7 @@ func NewArchwayApp( appCodec, legacyAmino, keys[slashingtypes.StoreKey], - stakingKeeper, + app.Keepers.StakingKeeper, govModuleAddr, ) app.Keepers.CrisisKeeper = *crisiskeeper.NewKeeper( @@ -443,7 +444,7 @@ func NewArchwayApp( // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - stakingKeeper.SetHooks( + app.Keepers.StakingKeeper.SetHooks( stakingtypes.NewMultiStakingHooks(app.Keepers.DistrKeeper.Hooks(), app.Keepers.SlashingKeeper.Hooks()), ) @@ -502,7 +503,7 @@ func NewArchwayApp( evidenceKeeper := evidencekeeper.NewKeeper( appCodec, keys[evidencetypes.StoreKey], - &app.Keepers.StakingKeeper, + app.Keepers.StakingKeeper, app.Keepers.SlashingKeeper, ) app.Keepers.EvidenceKeeper = *evidenceKeeper @@ -613,7 +614,7 @@ func NewArchwayApp( keys[govtypes.StoreKey], app.Keepers.AccountKeeper, app.Keepers.BankKeeper, - stakingKeeper, + app.Keepers.StakingKeeper, app.MsgServiceRouter(), govtypes.DefaultConfig(), govModuleAddr, @@ -644,7 +645,7 @@ func NewArchwayApp( mint.NewAppModule(appCodec, app.Keepers.MintKeeper, app.Keepers.AccountKeeper, nil, app.getSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.Keepers.SlashingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.StakingKeeper, app.getSubspace(slashingtypes.ModuleName)), distr.NewAppModule(appCodec, app.Keepers.DistrKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.StakingKeeper, app.getSubspace(distrtypes.ModuleName)), - staking.NewAppModule(appCodec, &app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.getSubspace(stakingtypes.ModuleName)), + staking.NewAppModule(appCodec, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.getSubspace(stakingtypes.ModuleName)), upgrade.NewAppModule(&app.Keepers.UpgradeKeeper), wasm.NewAppModule(appCodec, &app.Keepers.WASMKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.MsgServiceRouter(), app.getSubspace(wasm.ModuleName)), evidence.NewAppModule(app.Keepers.EvidenceKeeper), @@ -795,7 +796,7 @@ func NewArchwayApp( authzmodule.NewAppModule(appCodec, app.Keepers.AuthzKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.Keepers.GovKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.getSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.Keepers.MintKeeper, app.Keepers.AccountKeeper, nil, app.getSubspace(minttypes.ModuleName)), - staking.NewAppModule(appCodec, &app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.getSubspace(stakingtypes.ModuleName)), + staking.NewAppModule(appCodec, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.getSubspace(stakingtypes.ModuleName)), distr.NewAppModule(appCodec, app.Keepers.DistrKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.StakingKeeper, app.getSubspace(distrtypes.ModuleName)), slashing.NewAppModule(appCodec, app.Keepers.SlashingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.StakingKeeper, app.getSubspace(slashingtypes.ModuleName)), params.NewAppModule(app.Keepers.ParamsKeeper), @@ -1036,7 +1037,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(minttypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govV1types.ParamKeyTable()) + paramsKeeper.Subspace(govtypes.ModuleName) paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibcexported.ModuleName) diff --git a/app/export.go b/app/export.go index 7a747185..f87bce73 100644 --- a/app/export.go +++ b/app/export.go @@ -35,7 +35,7 @@ func (app *ArchwayApp) ExportAppStateAndValidators( return servertypes.ExportedApp{}, err } - validators, err := staking.WriteValidators(ctx, &app.Keepers.StakingKeeper) + validators, err := staking.WriteValidators(ctx, app.Keepers.StakingKeeper) return servertypes.ExportedApp{ AppState: appState, Validators: validators, diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 4f302390..b09df1d7 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -32,7 +32,7 @@ type ArchwayKeepers struct { AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper CapabilityKeeper *capabilitykeeper.Keeper - StakingKeeper stakingkeeper.Keeper + StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper diff --git a/app/test_access.go b/app/test_access.go index 92b84138..b75c2c49 100644 --- a/app/test_access.go +++ b/app/test_access.go @@ -45,7 +45,7 @@ func (s TestSupport) ScopedTransferKeeper() capabilitykeeper.ScopedKeeper { } func (s TestSupport) StakingKeeper() stakingkeeper.Keeper { - return s.app.Keepers.StakingKeeper + return *s.app.Keepers.StakingKeeper } func (s TestSupport) BankKeeper() bankkeeper.Keeper {