From 8aaa84bda305baf7cacac59d7853c1c0bc7da76a Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 21 May 2022 13:15:18 -0700 Subject: [PATCH] fix: gov support for superfluid (#1555) Closes: #XXX ## What is the purpose of the change @czarcas7ic and I ran into issues manually testing #1191 . We both reproduces this test case: https://github.com/osmosis-labs/osmosis/discussions/1543#discussioncomment-2786650 Upon further investigation, it was found that staking keeper was never replaced with superfluid keeper in the gov module so that the new logic could not be used for calculating tally and overriding validator votes by SF stakers. We need to e2e test this case in a future PR: https://github.com/osmosis-labs/osmosis/issues/1556 ## Testing and Verifying This change is a trivial rework / code cleanup without any test coverage. ## Documentation and Release Note - Does this pull request introduce a new feature or user-facing behavior changes? no - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? no - How is the feature or change documented? not applicable --- app/keepers/keepers.go | 2 +- x/superfluid/keeper/keeper.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 7298d7175e9..19af2725c00 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -366,7 +366,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( govKeeper := govkeeper.NewKeeper( appCodec, appKeepers.keys[govtypes.StoreKey], appKeepers.GetSubspace(govtypes.ModuleName), appKeepers.AccountKeeper, appKeepers.BankKeeper, - appKeepers.StakingKeeper, govRouter) + appKeepers.SuperfluidKeeper, govRouter) appKeepers.GovKeeper = &govKeeper } diff --git a/x/superfluid/keeper/keeper.go b/x/superfluid/keeper/keeper.go index 854e51b1f55..a91ca541fad 100644 --- a/x/superfluid/keeper/keeper.go +++ b/x/superfluid/keeper/keeper.go @@ -9,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) @@ -30,6 +31,8 @@ type Keeper struct { lms types.LockupMsgServer } +var _ govtypes.StakingKeeper = (*Keeper)(nil) + // NewKeeper returns an instance of Keeper. func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, ak authkeeper.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, dk types.DistrKeeper, ek types.EpochKeeper, lk types.LockupKeeper, gk types.GammKeeper, ik types.IncentivesKeeper, lms types.LockupMsgServer) *Keeper { // set KeyTable if it has not already been set