cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.27k stars 3.64k forks source link

[Bug]: Panic in proto decoding (v0.52) #22574

Open chatton opened 3 days ago

chatton commented 3 days ago

Is there an existing issue for this?

What happened?

While upgrading ibc-go to v0.52.0, we ran into an issue in which some tests were failing when broadcasting a message. They were failing with the following error

 builder.go:103: test panicked: unable to decode tx: ibc.core.channel.v1.UpgradeFields: {TagNum: 1, WireType:"varint"}: unknown protobuf field: tx parse error [/home/cianhatton/go/pkg/mod/cosmossdk.io/x/tx@v1.0.0-alpha.1/decode/decode.go:97]

We were able to fix the issue by moving all of the contents of this file into this file.

link to list of replace statements being used.

Cosmos SDK Version

v0.0.0-20241108061010-a0458127fccf

How to reproduce?

Checkout this commit 0eb8205cd77c2b9d9bce7130726eb04238bafb0e in the ibc-go repo and run make test

damiannolan commented 3 days ago

We stepped through this and found that there is no FieldDescriptors found for the UpgradeFields protobuf message when landing here in x/tx/decode - https://github.com/cosmos/cosmos-sdk/blob/main/x/tx/decode/unknown.go#L40

damiannolan commented 3 days ago

Will add screenshots for clarity.

  1. On commit 0eb8205cd77c2b9d9bce7130726eb04238bafb0e as mentioned in the issue we see FieldDescriptor == nil.

Image

  1. When moving the contents of the proto files as @chatton mentions we see it fulfilled correctly.

Image

tac0turtle commented 2 days ago

i was debugging this as well on ibc but never completed it. Is the generated file from the upgrade imported into a module anywhere?

damiannolan commented 2 days ago

Yeah, the generated upgrade.pb.go has its types used in 04-channel/types alongside everything else. e.g. here -> https://github.com/cosmos/ibc-go/blob/main/modules/core/04-channel/types/upgrade.go#L15

Were you thinking that maybe the generated pb.go wasn't getting included by go pkg loader?