Skip to content

Commit

Permalink
docs: fix migration/docs for ICA controller middleware (#2737)
Browse files Browse the repository at this point in the history
* update docs/migration with the change to middleware for ICA controller

* improve variable naming

* alignment

Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
(cherry picked from commit 1b7745f)
  • Loading branch information
crodriguezvega authored and mergify[bot] committed Nov 15, 2022
1 parent df1dad2 commit b69deb5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
20 changes: 11 additions & 9 deletions docs/apps/interchain-accounts/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ icaAuthModule := icaauth.NewAppModule(appCodec, app.ICAAuthKeeper)
// ICA auth IBC Module
icaAuthIBCModule := icaauth.NewIBCModule(app.ICAAuthKeeper)

// Create host and controller IBC Modules as desired
icaControllerIBCModule := icacontroller.NewIBCModule(app.ICAControllerKeeper, icaAuthIBCModule)
// Create controller IBC application stack and host IBC module as desired
icaControllerStack := icacontroller.NewIBCMiddleware(icaAuthIBCModule, app.ICAControllerKeeper)
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)

// Register host and authentication routes
ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule).
AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(icaauthtypes.ModuleName, icaControllerIBCModule) // Note, the authentication module is routed to the top level of the middleware stack
ibcRouter.
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(icaauthtypes.ModuleName, icaControllerStack) // Note, the authentication module is routed to the top level of the middleware stack

...

Expand Down Expand Up @@ -178,10 +179,11 @@ app.ICAAuthKeeper = icaauthkeeper.NewKeeper(appCodec, keys[icaauthtypes.StoreKey
icaAuthModule := icaauth.NewAppModule(appCodec, app.ICAAuthKeeper)
icaAuthIBCModule := icaauth.NewIBCModule(app.ICAAuthKeeper)

// Create controller IBC Module
icaControllerIBCModule := icacontroller.NewIBCModule(app.ICAControllerKeeper, icaAuthIBCModule)
// Create controller IBC application stack
icaControllerStack := icacontroller.NewIBCMiddleware(icaAuthIBCModule, app.ICAControllerKeeper)

// Register controller and authentication routes
ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule)
ibcRouter.AddRoute(icaauthtypes.ModuleName, icaControllerIBCModule) // Note, the authentication module is routed to the top level of the middleware stack
ibcRouter.
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icaauthtypes.ModuleName, icaControllerStack) // Note, the authentication module is routed to the top level of the middleware stack
```
2 changes: 1 addition & 1 deletion docs/middleware/ics29-fee/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For Cosmos SDK chains this setup is done via the `app/app.go` file, where module

## Example integration of the Fee Middleware module

```
```go
// app.go

// Register the AppModule for the fee middleware module
Expand Down
13 changes: 12 additions & 1 deletion docs/migrations/v3-to-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@ No genesis or in-place migrations required when upgrading from v1 or v2 of ibc-g

## Chains

### Fee Middleware
### ICS27 - Interchain Accounts

The controller submodule implements now the 05-port `Middleware` interface instead of the 05-port `IBCModule` interface. Chains that integrate the controller submodule, need to create it with the `NewIBCMiddleware` constructor function. For example:

```diff
- icacontroller.NewIBCModule(app.ICAControllerKeeper, icaAuthIBCModule)
+ icacontroller.NewIBCMiddleware(icaAuthIBCModule, app.ICAControllerKeeper)
```

where `icaAuthIBCModule` is the Interchain Accounts authentication IBC Module.

### ICS29 - Fee Middleware

The Fee Middleware module, as the name suggests, plays the role of an IBC middleware and as such must be configured by chain developers to route and handle IBC messages correctly.

Expand Down

0 comments on commit b69deb5

Please sign in to comment.