Skip to content

Commit

Permalink
fix(ica-host): refactor newModuleQuerySafeAllowList to avoid panic (b…
Browse files Browse the repository at this point in the history
…ackport #6436) (#6519)

* fix(ica-host): refactor newModuleQuerySafeAllowList to avoid panic (#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 <25233464+colin-axner@users.noreply.github.com>

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
(cherry picked from commit a16c549)

# Conflicts:
#	CHANGELOG.md

* fix conflicts in changelog.

---------

Co-authored-by: Tom <54514587+GAtom22@users.noreply.github.com>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
  • Loading branch information
3 people committed Jun 7, 2024
1 parent a4c961f commit 0f1cf8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion modules/apps/27-interchain-accounts/host/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 0f1cf8b

Please sign in to comment.