Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ica-host): refactor newModuleQuerySafeAllowList to avoid panic #6436

Merged
merged 11 commits into from
Jun 6, 2024
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

DimitrisJim marked this conversation as resolved.
Show resolved Hide resolved

GAtom22 marked this conversation as resolved.
Show resolved Hide resolved
### Features

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 @@ -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
DimitrisJim marked this conversation as resolved.
Show resolved Hide resolved
protoFiles, err := protodesc.FileOptions{
AllowUnresolvable: true,
}.NewFiles(fds)
if err != nil {
panic(err)
}
Expand Down
Loading