From fbb334a5e066a7d0b5445eb76422ca119a6804d8 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 (cherry picked from commit 8aaa84bda305baf7cacac59d7853c1c0bc7da76a) --- 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 179e46a350d..ba60ea78d9e 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 4bea94823c5..e1bc10185e5 100644 --- a/x/superfluid/keeper/keeper.go +++ b/x/superfluid/keeper/keeper.go @@ -10,6 +10,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" ) @@ -31,6 +32,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