From 34a0d014784792ca361adbd50f57acc533afb0f4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:05:11 +0300 Subject: [PATCH] fix: attempt to fix panics for unresolvable imports by using GogoResolver (backport #7277) (#7281) * fix: attempt to fix panics for unresolvable imports by using GogoResolver (#7277) * fix: attempt to fix panics for unresolvable imports by using GogoResolver * chore: add changelog * chore: amend changelog (cherry picked from commit 79ddda541a51352bad0c4b64a96673f508187f63) # Conflicts: # CHANGELOG.md * chore: address merge conflicts in changelog --------- Co-authored-by: Damian Nolan --- CHANGELOG.md | 2 ++ .../27-interchain-accounts/host/keeper/keeper.go | 16 +--------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c821ec2c4b9..bcea50a7fde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (apps/27-interchain-accounts) [\#7277](https://github.com/cosmos/ibc-go/pull/7277) Use `GogoResolver` when populating module query safe allow list to avoid panics from unresolvable protobuf dependencies. + ## [v8.5.0](https://github.com/cosmos/ibc-go/releases/tag/v8.5.0) - 2024-08-30 ### Dependencies diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 03bf79c3de0..008b0bc26f4 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -7,7 +7,6 @@ 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" @@ -283,21 +282,8 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { // newModuleQuerySafeAllowList returns a list of all query paths labeled with module_query_safe in the proto files. func newModuleQuerySafeAllowList() []string { - 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) - } - allowList := []string{} - protoFiles.RangeFiles(func(fd protoreflect.FileDescriptor) bool { + gogoproto.GogoResolver.RangeFiles(func(fd protoreflect.FileDescriptor) bool { for i := 0; i < fd.Services().Len(); i++ { // Get the service descriptor sd := fd.Services().Get(i)