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

Use the v0.34 definition of tendermint.abci.Event which does not enforce valid UTF-8 data #180

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- Use the v0.34 definition of `abci.Event` which does not enforce
valid UTF-8 data for its `key` and `value` attributes, specifying
them as `bytes` instead of `string`. ([#180](https://github.com/cosmos/ibc-proto-rs/issues/180))

This is required, because ibc-go emits event attributes which are not valid UTF-8,
so we need to use this definition to be able to parse them.

In Protobuf, `bytes` and `string` are wire-compatible, so doing this strictly increases the amount fo data we can parse.

See this Hermes PR for background information: https://github.com/informalsystems/hermes/pull/3768
4 changes: 2 additions & 2 deletions src/prost/cosmos.base.abci.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct TxResponse {
///
/// Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
#[prost(message, repeated, tag = "13")]
pub events: ::prost::alloc::vec::Vec<::tendermint_proto::abci::Event>,
pub events: ::prost::alloc::vec::Vec<::tendermint_proto::v0_34::abci::Event>,
}
impl ::prost::Name for TxResponse {
const NAME: &'static str = "TxResponse";
Expand Down Expand Up @@ -147,7 +147,7 @@ pub struct Result {
/// Events contains a slice of Event objects that were emitted during message
/// or handler execution.
#[prost(message, repeated, tag = "3")]
pub events: ::prost::alloc::vec::Vec<::tendermint_proto::abci::Event>,
pub events: ::prost::alloc::vec::Vec<::tendermint_proto::v0_34::abci::Event>,
/// msg_responses contains the Msg handler responses type packed in Anys.
///
/// Since: cosmos-sdk 0.46
Expand Down
10 changes: 10 additions & 0 deletions tools/proto-compiler/src/cmd/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ impl CompileCmd {
.server_mod_attribute(".", r#"#[cfg(feature = "server")]"#)
.out_dir(out_dir)
.file_descriptor_set_path(out_dir.join("proto_descriptor.bin"))
// Use the v0.34 definition of `abci.Event` which does not enforce valid UTF-8 data
// for its `key` and `value` attributes, specifying them as `bytes` instead of `string`.
// This is required, because ibc-go emits event attributes which are not valid UTF-8,
// so we need to use this definition to be able to parse them.
// In Protobuf, `bytes` and `string` are wire-compatible, so doing this strictly
// increases the amount fo data we can parse.
.extern_path(
".tendermint.abci.Event",
"::tendermint_proto::v0_34::abci::Event",
)
.extern_path(".tendermint", "::tendermint_proto")
.extern_path(".ics23", "::ics23")
.type_attribute(".google.protobuf.Any", attrs_eq)
Expand Down
Loading