diff --git a/modules/core/02-client/types/router.go b/modules/core/02-client/types/router.go index c13449274c1..792700fadc6 100644 --- a/modules/core/02-client/types/router.go +++ b/modules/core/02-client/types/router.go @@ -64,3 +64,13 @@ func (rtr *Router) GetRoute(clientID string) (exported.LightClientModule, bool) } return rtr.routes[clientType], true } + +type LightClientModuleWrapper struct{ exported.LightClientModule } + +func NewLightClientModuleWrapper(clientModule exported.LightClientModule) LightClientModuleWrapper { + return LightClientModuleWrapper{ + clientModule, + } +} + +func (LightClientModuleWrapper) IsOnePerModuleType() {} diff --git a/modules/core/depinject.go b/modules/core/depinject.go index c8979c010fa..47cd160e3f2 100644 --- a/modules/core/depinject.go +++ b/modules/core/depinject.go @@ -96,9 +96,9 @@ func InvokeAddAppRoutes(keeper *ibckeeper.Keeper, appRoutes []porttypes.IBCModul // InvokeAddClientRoutes defines a depinject Invoker for registering ibc light client modules on the core ibc client router. // TODO: Maybe this should align with app router. i.e. create router here, add routes, and set on ibc keeper. // For app_v1 this would be the same approach, just create clientRouter in app.go instead of implicit creation inside of ibc.NewKeeper() -func InvokeAddClientRoutes(keeper *ibckeeper.Keeper, clientRoutes map[string]exported.LightClientModule) { +func InvokeAddClientRoutes(keeper *ibckeeper.Keeper, clientRoutes map[string]clienttypes.LightClientModuleWrapper) { router := keeper.ClientKeeper.GetRouter() for modName, route := range clientRoutes { - router.AddRoute(modName, route) + router.AddRoute(modName, route.LightClientModule) } } diff --git a/modules/light-clients/06-solomachine/depinject.go b/modules/light-clients/06-solomachine/depinject.go index 081abba5857..99c302debab 100644 --- a/modules/light-clients/06-solomachine/depinject.go +++ b/modules/light-clients/06-solomachine/depinject.go @@ -7,6 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" modulev1 "github.com/cosmos/ibc-go/api/ibc/lightclients/solomachine/module/v1" + + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) var ( @@ -38,13 +40,13 @@ type ModuleInputs struct { type ModuleOutputs struct { depinject.Out - LightClientModule *LightClientModule - Module appmodule.AppModule + LightClientModuleWrapper clienttypes.LightClientModuleWrapper + Module appmodule.AppModule } // ProvideModule returns the 06-solomachine module outputs for dependency injection func ProvideModule(in ModuleInputs) ModuleOutputs { lightClientModule := NewLightClientModule(in.Cdc) m := NewAppModule(lightClientModule) - return ModuleOutputs{LightClientModule: &lightClientModule, Module: m} + return ModuleOutputs{LightClientModuleWrapper: clienttypes.NewLightClientModuleWrapper(&lightClientModule), Module: m} } diff --git a/modules/light-clients/07-tendermint/depinject.go b/modules/light-clients/07-tendermint/depinject.go index c51ddd916ee..674550aa422 100644 --- a/modules/light-clients/07-tendermint/depinject.go +++ b/modules/light-clients/07-tendermint/depinject.go @@ -9,6 +9,8 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" modulev1 "github.com/cosmos/ibc-go/api/ibc/lightclients/tendermint/module/v1" + + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) var ( @@ -41,8 +43,8 @@ type ModuleInputs struct { type ModuleOutputs struct { depinject.Out - LightClientModule *LightClientModule - Module appmodule.AppModule + LightClientModuleWrapper clienttypes.LightClientModuleWrapper + Module appmodule.AppModule } // ProvideModule returns the 07-tendermint module outputs for dependency injection @@ -55,5 +57,5 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { lightClientModule := NewLightClientModule(in.Cdc, authority.String()) m := NewAppModule(lightClientModule) - return ModuleOutputs{LightClientModule: &lightClientModule, Module: m} + return ModuleOutputs{LightClientModuleWrapper: clienttypes.NewLightClientModuleWrapper(&lightClientModule), Module: m} }