From 51003311f381f5f473104554fb9101c9e12ece7d Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 30 May 2024 17:06:38 -0300 Subject: [PATCH 1/3] 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) } From 9d8b5aa8fa8cf804eba5f2dbcc41fdd0c9c48a48 Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 30 May 2024 17:20:39 -0300 Subject: [PATCH 2/3] add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c14dcab09a5..550327965c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/27-interchain-accounts) [\#5533](https://github.com/cosmos/ibc-go/pull/5533) ICA host sets the host connection ID on `OnChanOpenTry`, so that ICA controller implementations are not obliged to set the value on `OnChanOpenInit` if they are not able. * (core/02-client, core/03-connection, apps/27-interchain-accounts) [\#6256](https://github.com/cosmos/ibc-go/pull/6256) Add length checking of array fields in messages. +* (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 From aa1d470627ec9a4a3d07d284cb512bdacb0c6080 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Wed, 5 Jun 2024 18:18:30 +0300 Subject: [PATCH 3/3] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> --- CHANGELOG.md | 1 - modules/apps/27-interchain-accounts/host/keeper/keeper.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d41530a7d3..8da14958ab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,7 +68,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core/02-client, core/03-connection, apps/27-interchain-accounts) [\#6256](https://github.com/cosmos/ibc-go/pull/6256) Add length checking of array fields in messages. * (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 dd654cd122d..97e335a6d8f 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -282,7 +282,7 @@ func newModuleQuerySafeAllowList() []string { panic(err) } // create the files using 'AllowUnresolvable' to avoid - // unnecessary panic + // unnecessary panic: https://github.com/cosmos/ibc-go/issues/6435 protoFiles, err := protodesc.FileOptions{ AllowUnresolvable: true, }.NewFiles(fds)