Skip to content

Commit

Permalink
Fix icaauth router registration
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianBorst committed Jun 8, 2023
1 parent 51b1e35 commit fe91e97
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
28 changes: 20 additions & 8 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,22 @@ type AppKeepers struct {
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
ICAAuthKeeper icaauthkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
LiquidityKeeper liquiditykeeper.Keeper
// IntertxKeeper intertxkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
LiquidityKeeper liquiditykeeper.Keeper

// ICS
ProviderKeeper ibcproviderkeeper.Keeper

RouterKeeper *routerkeeper.Keeper

// Modules
ICAModule ica.AppModule
ICAModule ica.AppModule
// IntertxModule intertx.AppModule
// IntertxIBCModule intertx.IBCModule
ICAAuthModule icaauth.AppModule
ICAHostIBCModule icahost.IBCModule
ICAAuthIBCModule icaauth.IBCModule
Expand All @@ -122,7 +125,8 @@ type AppKeepers struct {
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedICAAuthKeeper capabilitykeeper.ScopedKeeper
ScopedIBCProviderKeeper capabilitykeeper.ScopedKeeper
// ScopedIntertxKeeper capabilitykeeper.ScopedKeeper
ScopedIBCProviderKeeper capabilitykeeper.ScopedKeeper
}

func NewAppKeeper(
Expand Down Expand Up @@ -169,6 +173,7 @@ func NewAppKeeper(
appKeepers.ScopedICAControllerKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
appKeepers.ScopedICAHostKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
appKeepers.ScopedICAAuthKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icaauthtypes.ModuleName)
// appKeepers.ScopedIntertxKeeper = appKeepers.CapabilityKeeper.ScopeToModule(intertxtypes.ModuleName)
appKeepers.ScopedIBCProviderKeeper = appKeepers.CapabilityKeeper.ScopeToModule(providertypes.ModuleName)

appKeepers.CapabilityKeeper.Seal()
Expand Down Expand Up @@ -390,6 +395,13 @@ func NewAppKeeper(

appKeepers.ICAModule = ica.NewAppModule(&appKeepers.ICAControllerKeeper, &appKeepers.ICAHostKeeper)
icaControllerStack := icacontroller.NewIBCMiddleware(appKeepers.ICAAuthIBCModule, appKeepers.ICAControllerKeeper)
// With the intertx module:
// appKeepers.IntertxKeeper = intertxkeeper.NewKeeper(appCodec, appKeepers.GetKey(intertxtypes.StoreKey), appKeepers.ICAControllerKeeper, appKeepers.ScopedIntertxKeeper)
// appKeepers.IntertxModule = intertx.NewAppModule(appCodec, appKeepers.IntertxKeeper)
// appKeepers.IntertxIBCModule = intertx.NewIBCModule(appKeepers.IntertxKeeper)

// icaControllerStack := icacontroller.NewIBCMiddleware(appKeepers.IntertxIBCModule, appKeepers.ICAControllerKeeper)

appKeepers.ICAHostIBCModule = icahost.NewIBCModule(appKeepers.ICAHostKeeper)

appKeepers.RouterModule = router.NewAppModule(appKeepers.RouterKeeper)
Expand All @@ -406,9 +418,9 @@ func NewAppKeeper(

// create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter().
AddRoute(icaauthtypes.ModuleName, icaControllerStack).
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icahosttypes.SubModuleName, appKeepers.ICAHostIBCModule).
AddRoute(icaauthtypes.ModuleName, appKeepers.ICAAuthIBCModule).
AddRoute(ibctransfertypes.ModuleName, ibcTransferStack).
AddRoute(providertypes.ModuleName, appKeepers.ProviderModule)

Expand Down
1 change: 1 addition & 0 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (appKeepers *AppKeepers) GenerateKeys() {
evidencetypes.StoreKey, liquiditytypes.StoreKey, ibctransfertypes.StoreKey,
capabilitytypes.StoreKey, feegrant.StoreKey, authzkeeper.StoreKey, routertypes.StoreKey,
icahosttypes.StoreKey, providertypes.StoreKey, icacontrollertypes.StoreKey, icaauthtypes.StoreKey,
// intertxtypes.StoreKey,
)

// Define transient store keys
Expand Down
5 changes: 4 additions & 1 deletion app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ import (

gaiaappparams "github.com/althea-net/ibc-test-chain/v9/app/params"
"github.com/althea-net/ibc-test-chain/v9/x/globalfee"
// "github.com/althea-net/ibc-test-chain/v9/x/intertx"
// intertxkeeper "github.com/althea-net/ibc-test-chain/v9/x/intertx/keeper"
// intertxtypes "github.com/althea-net/ibc-test-chain/v9/x/intertx/types"
)

var maccPerms = map[string][]string{
Expand Down Expand Up @@ -106,7 +109,7 @@ var ModuleBasics = module.NewBasicManager(
liquidity.AppModuleBasic{},
router.AppModuleBasic{},
ica.AppModuleBasic{},
icaauth.AppModuleBasic{},
// intertx.AppModuleBasic{},
globalfee.AppModule{},
ibcprovider.AppModuleBasic{},
)
Expand Down

0 comments on commit fe91e97

Please sign in to comment.