From 0c3317ed084ec1edac65d5d87231f275dc3feb80 Mon Sep 17 00:00:00 2001 From: Srinivas Baride Date: Sun, 9 Oct 2022 23:57:46 +0530 Subject: [PATCH] Fix IBC port router initialization --- app.go | 53 ++++++++++++++++++++++++--------------------- x/vpn/types/init.go | 1 + 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/app.go b/app.go index ae1f8095..9f040b3f 100644 --- a/app.go +++ b/app.go @@ -398,25 +398,6 @@ func NewApp( app.scopedIBCKeeper, ) - govRouter := govtypes.NewRouter() - govRouter. - AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). - AddRoute(paramsproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). - AddRoute(distributiontypes.RouterKey, distribution.NewCommunityPoolSpendProposalHandler(app.distributionKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)). - AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)) - - app.govKeeper = govkeeper.NewKeeper( - app.cdc, - app.keys[govtypes.StoreKey], - app.GetSubspace(govtypes.ModuleName), - app.accountKeeper, - app.bankKeeper, - &stakingKeeper, - govRouter, - ) - app.ibcTransferKeeper = ibctransferkeeper.NewKeeper( app.cdc, app.keys[ibctransfertypes.StoreKey], @@ -450,11 +431,6 @@ func NewApp( ibcICAHostIBCModule = ibcicahost.NewIBCModule(app.ibcICAHostKeeper) ) - ibcPortRouter := ibcporttypes.NewRouter() - ibcPortRouter.AddRoute(ibcicahosttypes.SubModuleName, ibcICAHostIBCModule). - AddRoute(ibctransfertypes.ModuleName, ibcTransferIBCModule) - app.ibcKeeper.SetRouter(ibcPortRouter) - app.evidenceKeeper = *evidencekeeper.NewKeeper( app.cdc, app.keys[evidencetypes.StoreKey], @@ -514,11 +490,34 @@ func NewApp( wasmOpts..., ) - ibcPortRouter.AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)) + ibcPortRouter := ibcporttypes.NewRouter() + ibcPortRouter.AddRoute(ibcicahosttypes.SubModuleName, ibcICAHostIBCModule). + AddRoute(ibctransfertypes.ModuleName, ibcTransferIBCModule). + AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)) + app.ibcKeeper.SetRouter(ibcPortRouter) + + govRouter := govtypes.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). + AddRoute(paramsproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). + AddRoute(distributiontypes.RouterKey, distribution.NewCommunityPoolSpendProposalHandler(app.distributionKeeper)). + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)). + AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)). + AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)) + if len(enabledProposals) != 0 { govRouter.AddRoute(wasmtypes.RouterKey, wasmkeeper.NewWasmProposalHandler(app.wasmKeeper, enabledProposals)) } + app.govKeeper = govkeeper.NewKeeper( + app.cdc, + app.keys[govtypes.StoreKey], + app.GetSubspace(govtypes.ModuleName), + app.accountKeeper, + app.bankKeeper, + &stakingKeeper, + govRouter, + ) + skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) app.moduleManager = module.NewManager( @@ -568,6 +567,8 @@ func NewApp( feegrant.ModuleName, paramstypes.ModuleName, authvestingtypes.ModuleName, + swaptypes.ModuleName, + vpntypes.ModuleName, wasmtypes.ModuleName, ) app.moduleManager.SetOrderEndBlockers( @@ -590,6 +591,8 @@ func NewApp( paramstypes.ModuleName, upgradetypes.ModuleName, authvestingtypes.ModuleName, + customminttypes.ModuleName, + swaptypes.ModuleName, vpntypes.ModuleName, wasmtypes.ModuleName, ) diff --git a/x/vpn/types/init.go b/x/vpn/types/init.go index 4c5239d0..786c8bd2 100644 --- a/x/vpn/types/init.go +++ b/x/vpn/types/init.go @@ -12,6 +12,7 @@ import ( ) func init() { + providertypes.ParamsSubspace = fmt.Sprintf("%s/%s", ModuleName, providertypes.ModuleName) nodetypes.ParamsSubspace = fmt.Sprintf("%s/%s", ModuleName, nodetypes.ModuleName) subscriptiontypes.ParamsSubspace = fmt.Sprintf("%s/%s", ModuleName, subscriptiontypes.ModuleName) sessiontypes.ParamsSubspace = fmt.Sprintf("%s/%s", ModuleName, sessiontypes.ModuleName)