Skip to content

Commit

Permalink
fix(ica): add controller stack (#1864)
Browse files Browse the repository at this point in the history
* fix(ica): add controller stack

* chore: update changelog

* fix: linter issues

* Update CHANGELOG.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
k-yang and coderabbitai[bot] committed May 7, 2024
1 parent 9efcccc commit 906f9c7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [v1.3.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.3.0) - 2024-05-01
## [v1.3.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.3.0) - 2024-05-07

Nibiru v1.3.0 adds interchain accounts.

Expand All @@ -51,6 +51,10 @@ Nibiru v1.3.0 adds interchain accounts.

* [#1820](https://github.com/NibiruChain/nibiru/pull/1820) - feat: add interchain accounts

### Bug Fixes

* [#1864](https://github.com/NibiruChain/nibiru/pull/1864) - fix(ica): add ICA controller stack

### Improvements

* [#1859](https://github.com/NibiruChain/nibiru/pull/1859) - refactor(oracle): add oracle slashing events
Expand Down
21 changes: 17 additions & 4 deletions app/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"

ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host"
Expand Down Expand Up @@ -527,11 +528,24 @@ func (app *NibiruApp) InitKeepers(
transferStack = ibctransfer.NewIBCModule(app.ibcTransferKeeper)
transferStack = ibcfee.NewIBCMiddleware(transferStack, app.ibcFeeKeeper)

// Create the second stack for ICA
icaHostIBCModule := icahost.NewIBCModule(app.icaHostKeeper)
// Create Interchain Accounts Stack
// SendPacket, since it is originating from the application to core IBC:
// icaAuthModuleKeeper.SendTx -> icaController.SendPacket -> channel.SendPacket
var icaControllerStack porttypes.IBCModule
// integration point for custom authentication modules
// see https://medium.com/the-interchain-foundation/ibc-go-v6-changes-to-interchain-accounts-and-how-it-impacts-your-chain-806c185300d7
var noAuthzModule porttypes.IBCModule
icaControllerStack = icacontroller.NewIBCMiddleware(noAuthzModule, app.icaControllerKeeper)

// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
// channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
icaHostStack := icahost.NewIBCModule(app.icaHostKeeper)

// Add transfer stack to IBC Router
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).AddRoute(ibctransfertypes.ModuleName, transferStack)
ibcRouter.
AddRoute(icahosttypes.SubModuleName, icaHostStack).
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(ibctransfertypes.ModuleName, transferStack)

// Create Mock IBC Fee module stack for testing
// SendPacket, since it is originating from the application to core IBC:
Expand All @@ -557,7 +571,6 @@ func (app *NibiruApp) InitKeepers(
govRouter.
AddRoute(govtypes.RouterKey, govv1beta1types.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
// AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.upgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper))

Expand Down

0 comments on commit 906f9c7

Please sign in to comment.