Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add solomachine and tm light client registrations #325

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ import (
ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
icaexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/gorilla/mux"
"github.com/peggyjv/gravity-bridge/module/v5/x/gravity"
gravityclient "github.com/peggyjv/gravity-bridge/module/v5/x/gravity/client"
Expand Down Expand Up @@ -192,6 +194,8 @@ var (
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
solomachine.AppModuleBasic{},
Comment on lines +197 to +198
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure full integration of new light client modules

While the ibctm.AppModuleBasic{} and solomachine.AppModuleBasic{} are added to ModuleBasics, to fully integrate these modules into the application, they should also be registered in the module manager and included in the application's lifecycle methods.

Add modules to the module manager initialization

Include the new modules in the module.NewManager:

     app.mm = module.NewManager(
         genutil.NewAppModule(
             app.AccountKeeper, app.StakingKeeper, app.BaseApp.DeliverTx,
             encodingConfig.TxConfig,
         ),
         auth.NewAppModule(appCodec, app.AccountKeeper, nil, app.GetSubspace(authtypes.ModuleName)),
         // ... existing modules
+        ibctm.NewAppModule(app.IBCKeeper.ClientKeeper),
+        solomachine.NewAppModule(),
         // ... remaining modules
     )

Register modules in application lifecycle methods

Add the modules to SetOrderBeginBlockers, SetOrderEndBlockers, and SetOrderInitGenesis to ensure they participate in the application lifecycle:

 app.mm.SetOrderBeginBlockers(
     upgradetypes.ModuleName,
     capabilitytypes.ModuleName,
     // ... existing modules
+    ibctm.ModuleName,
+    solomachine.ModuleName,
     // ... remaining modules
 )

 app.mm.SetOrderEndBlockers(
     crisistypes.ModuleName,
     govtypes.ModuleName,
     // ... existing modules
+    ibctm.ModuleName,
+    solomachine.ModuleName,
     // ... remaining modules
 )

 app.mm.SetOrderInitGenesis(
     capabilitytypes.ModuleName,
     authtypes.ModuleName,
     // ... existing modules
+    ibctm.ModuleName,
+    solomachine.ModuleName,
     // ... remaining modules
 )

Committable suggestion skipped: line range outside the PR's diff.

ica.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
upgrade.AppModuleBasic{},
Expand Down
Loading