Skip to content

Commit

Permalink
Use the v0.34 definition of abci.Event which does not enforce valid…
Browse files Browse the repository at this point in the history
… UTF-8 data

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.
  • Loading branch information
romac committed Jan 18, 2024
1 parent da8dbee commit 4713208
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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

0 comments on commit 4713208

Please sign in to comment.