diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eb2b2f65be..9014fa2b95d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (apps/27-interchain-accounts) [\#6436](https://github.com/cosmos/ibc-go/pull/6436) Refactor ICA host keeper instantiation method to avoid panic related to proto files. + ### Features ### Bug Fixes diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 06fd63ba5cd..900ea4069a7 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -7,6 +7,7 @@ import ( gogoproto "github.com/cosmos/gogoproto/proto" "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" msgv1 "cosmossdk.io/api/cosmos/msg/v1" @@ -252,7 +253,15 @@ func (k Keeper) SetInterchainAccountAddress(ctx sdk.Context, connectionID, portI // newModuleQuerySafeAllowList returns a list of all query paths labeled with module_query_safe in the proto files. func newModuleQuerySafeAllowList() []string { - protoFiles, err := gogoproto.MergedRegistry() + fds, err := gogoproto.MergedGlobalFileDescriptors() + if err != nil { + panic(err) + } + // create the files using 'AllowUnresolvable' to avoid + // unnecessary panic: https://github.com/cosmos/ibc-go/issues/6435 + protoFiles, err := protodesc.FileOptions{ + AllowUnresolvable: true, + }.NewFiles(fds) if err != nil { panic(err) }