From 51003311f381f5f473104554fb9101c9e12ece7d Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 30 May 2024 17:06:38 -0300 Subject: [PATCH] fix(ica-host): refactor newModuleQuerySafeAllowList to avoid panic due to AllowUnresolvable field --- .../apps/27-interchain-accounts/host/keeper/keeper.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 119424053ac..dd654cd122d 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" @@ -276,7 +277,15 @@ 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 { - protoFiles, err := gogoproto.MergedRegistry() + fds, err := gogoproto.MergedGlobalFileDescriptors() + if err != nil { + panic(err) + } + // create the files using 'AllowUnresolvable' to avoid + // unnecessary panic + protoFiles, err := protodesc.FileOptions{ + AllowUnresolvable: true, + }.NewFiles(fds) if err != nil { panic(err) }