Skip to content

Commit a16c549

Browse files
GAtom22crodriguezvegaDimitrisJimcolin-axner
authored
fix(ica-host): refactor newModuleQuerySafeAllowList to avoid panic (cosmos#6436)
* fix(ica-host): refactor newModuleQuerySafeAllowList to avoid panic due to AllowUnresolvable field * add changelog entry * Apply suggestions from code review Co-authored-by: colin axnér <[email protected]> --------- Co-authored-by: Carlos Rodriguez <[email protected]> Co-authored-by: DimitrisJim <[email protected]> Co-authored-by: colin axnér <[email protected]>
1 parent 87dfd76 commit a16c549

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
6767

6868
* (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.
6969
* (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.
70+
* (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.
7071

7172
### Features
7273

modules/apps/27-interchain-accounts/host/keeper/keeper.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
gogoproto "github.com/cosmos/gogoproto/proto"
99
"google.golang.org/protobuf/proto"
10+
"google.golang.org/protobuf/reflect/protodesc"
1011
"google.golang.org/protobuf/reflect/protoreflect"
1112

1213
msgv1 "cosmossdk.io/api/cosmos/msg/v1"
@@ -276,7 +277,15 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
276277

277278
// newModuleQuerySafeAllowList returns a list of all query paths labeled with module_query_safe in the proto files.
278279
func newModuleQuerySafeAllowList() []string {
279-
protoFiles, err := gogoproto.MergedRegistry()
280+
fds, err := gogoproto.MergedGlobalFileDescriptors()
281+
if err != nil {
282+
panic(err)
283+
}
284+
// create the files using 'AllowUnresolvable' to avoid
285+
// unnecessary panic: https://github.com/cosmos/ibc-go/issues/6435
286+
protoFiles, err := protodesc.FileOptions{
287+
AllowUnresolvable: true,
288+
}.NewFiles(fds)
280289
if err != nil {
281290
panic(err)
282291
}

0 commit comments

Comments
 (0)