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

Conversation

romac
Copy link
Member

@romac romac commented Jan 18, 2024

Closes: #181

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.

See this Hermes PR for background information: informalsystems/hermes#3768

… 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.
@romac
Copy link
Member Author

romac commented Jan 22, 2024

Here is the diff between tendermint_proto::v0_38::abci::EventAttribute and tendermint_proto::v0_34::abci::EventAttribute:

--- /tmp/038.rs	2024-01-22 10:37:42
+++ /tmp/034.rs	2024-01-22 10:38:27
@@ -2,10 +2,10 @@
 #[allow(clippy::derive_partial_eq_without_eq)]
 #[derive(Clone, PartialEq, ::prost::Message)]
 pub struct EventAttribute {
-    #[prost(string, tag = "1")]
-    pub key: ::prost::alloc::string::String,
-    #[prost(string, tag = "2")]
-    pub value: ::prost::alloc::string::String,
+    #[prost(bytes = "bytes", tag = "1")]
+    pub key: ::prost::bytes::Bytes,
+    #[prost(bytes = "bytes", tag = "2")]
+    pub value: ::prost::bytes::Bytes,
     /// nondeterministic
     #[prost(bool, tag = "3")]
     pub index: bool,

@romac romac changed the title Use the v0.34 definition of abci.Event which does not enforce valid UTF-8 data Use the v0.34 definition of tendermint.abci.Event which does not enforce valid UTF-8 data Jan 22, 2024
@romac
Copy link
Member Author

romac commented Feb 7, 2024

This PR has been confirmed to fix the issue seen in Hermes.

@romac romac marked this pull request as ready for review February 7, 2024 09:24
@romac romac requested a review from Farhad-Shabani February 7, 2024 09:25
@romac romac merged commit 47b310c into main Feb 7, 2024
10 checks passed
@romac romac deleted the romac/event-attribute-bytes branch February 7, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use the CometBFT v0.34 definition of tendermint.abci.Event which does not enforce valid UTF-8 data
2 participants