ignite/cli

Template `RegisterIBC` func needs app module adaptor for registering interfaces on cdc

damiannolan opened this issue · 0 comments

Describe the bug

It seems that when RegisterIBC is called and the modules are looped over and an interface assertion is performed to call RegisterInterfaces that we should be handling the appmodule with the same adaptor which @julienrbrt used to fix genesis issues.

See here:

for _, module := range modules {
if mod, ok := module.(interface {
RegisterInterfaces(registry cdctypes.InterfaceRegistry)
}); ok {
mod.RegisterInterfaces(registry)
}
}

To reproduce

Generate a new app using the ignite cli and try to use some ibc types registered on the cdc. E.g. 08-wasm.

Quick diff from my local env:

--- a/gm/app/ibc.go
+++ b/gm/app/ibc.go
@@ -4,6 +4,7 @@ import (
        "cosmossdk.io/core/appmodule"
        storetypes "cosmossdk.io/store/types"
        cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
+       "github.com/cosmos/cosmos-sdk/types/module"
        authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
        govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
        govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
@@ -203,8 +204,9 @@ func RegisterIBC(registry cdctypes.InterfaceRegistry) map[string]appmodule.AppMo
                ibcwasmtypes.ModuleName:     ibcwasm.AppModule{},
        }

-       for _, module := range modules {
-               if mod, ok := module.(interface {
+       for name, m := range modules {
+               ibcModule := module.CoreAppModuleBasicAdaptor(name, m)
+               if mod, ok := ibcModule.(interface {
                        RegisterInterfaces(registry cdctypes.InterfaceRegistry)
                }); ok {
                        mod.RegisterInterfaces(registry)

What version are you using?

Ignite CLI version:             v28.2.0
Ignite CLI build date:          2024-02-06T11:21:56Z
Ignite CLI source hash:         af25183a2d312aa4d679e65e3d627025b17a7120
Ignite CLI config version:      v1
Cosmos SDK version:             v0.50.3
Your OS:                        darwin
Your arch:                      amd64
Your Node.js version:           v14.15.0
Your go version:                go version go1.22.0 darwin/amd64