From fbb74fcc0d75562c20ee914da278813c08406ef4 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Tue, 19 Sep 2023 13:49:30 +0200 Subject: [PATCH] feat: set govhook --- app/provider/app.go | 9 +++++++-- x/ccv/provider/keeper/gov_hook.go | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/provider/app.go b/app/provider/app.go index ef3f6508f7..1f9e984d87 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -442,7 +442,7 @@ func New( AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) govConfig := govtypes.DefaultConfig() - app.GovKeeper = *govkeeper.NewKeeper( + govKeeper := govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], app.AccountKeeper, @@ -454,7 +454,12 @@ func New( ) // Set legacy router for backwards compatibility with gov v1beta1 - app.GovKeeper.SetLegacyRouter(govRouter) + govKeeper.SetLegacyRouter(govRouter) + + govHook := app.ProviderKeeper.GovHooks(govKeeper) + app.GovKeeper = *govKeeper.SetHooks( + govtypes.NewMultiGovHooks(govHook), + ) app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, diff --git a/x/ccv/provider/keeper/gov_hook.go b/x/ccv/provider/keeper/gov_hook.go index a05e1ab657..1b7a45ff1d 100644 --- a/x/ccv/provider/keeper/gov_hook.go +++ b/x/ccv/provider/keeper/gov_hook.go @@ -12,7 +12,7 @@ import ( ) type GovHooks struct { - gk govkeeper.Keeper + gk *govkeeper.Keeper k *Keeper } @@ -20,7 +20,7 @@ type GovHooks struct { // GovHooks exist in cosmos-sdk/x/gov/keeper/hooks.go of v0.45.16-lsm-ics and on var _ sdkgov.GovHooks = GovHooks{} -func (k *Keeper) GovHooks(gk govkeeper.Keeper) GovHooks { +func (k *Keeper) GovHooks(gk *govkeeper.Keeper) GovHooks { return GovHooks{ gk: gk, k: k,