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

[Bug]: Protobuf Any cachedValue is lost in gogoHybridHandler #22779

Closed
1 task done
damiannolan opened this issue Dec 5, 2024 · 0 comments · Fixed by #22866
Closed
1 task done

[Bug]: Protobuf Any cachedValue is lost in gogoHybridHandler #22779

damiannolan opened this issue Dec 5, 2024 · 0 comments · Fixed by #22866
Assignees
Labels

Comments

@damiannolan
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Users rely on the cachedValue in Any when dealing with interface types using the sdk. Currently when a msg handler is invoked through the environment MsgRouterService (e.g. in x/gov msg execution) we lose the cachedValue on proto Any here: https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/internal/protocompat/protocompat.go#L130

I suspect this is due to cachedValue behind an unexported/private field and therefore, proto.Merge cannot merge it from inReq to msg, but not 100% certain on that.

This leads to a problem when trying to use the Any later as an interface type like here: https://github.com/cosmos/ibc-go/blob/main/modules/core/02-client/types/codec.go#L77-L80

This will explode as GetCachedValue will return nil.

This surfaced in an e2e test which attempts to execute an IBC client upgrade via x/gov proposal. The ibc msg contains an Any when msg is routed through gov's msg router it loses the cachedValue and errors out.

Attaching screenshot of debugger:
Image

Cosmos SDK Version

0.52

How to reproduce?

I reproduced the same failure seen in e2e in a unit test here for easier debugging.

It's possible to check out the following the commit and revert the diffs in msg_server.go.
cosmos/ibc-go@785dc47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🥳 Done
Development

Successfully merging a pull request may close this issue.

2 participants