Skip to content

Commit

Permalink
Fix IBC port router initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Oct 9, 2022
1 parent 99234ad commit 0c3317e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
53 changes: 28 additions & 25 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -568,6 +567,8 @@ func NewApp(
feegrant.ModuleName,
paramstypes.ModuleName,
authvestingtypes.ModuleName,
swaptypes.ModuleName,
vpntypes.ModuleName,
wasmtypes.ModuleName,
)
app.moduleManager.SetOrderEndBlockers(
Expand All @@ -590,6 +591,8 @@ func NewApp(
paramstypes.ModuleName,
upgradetypes.ModuleName,
authvestingtypes.ModuleName,
customminttypes.ModuleName,
swaptypes.ModuleName,
vpntypes.ModuleName,
wasmtypes.ModuleName,
)
Expand Down
1 change: 1 addition & 0 deletions x/vpn/types/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0c3317e

Please sign in to comment.