-
Notifications
You must be signed in to change notification settings - Fork 224
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
TM34 Events can't be Parsed when the Value is Binary Data #1400
Comments
Thanks for bringing this to our attention! Can you please post a minimal reproduction of the problem for us to take a look at? |
It seems indeed that we are wrongly modeling |
Yes indeed, this is also breaking on early osmosis blocks. I can't fetch block 1423377 (v0.34) because some {
"type": "distribution",
"attributes": [
{
"key": "Z2F1Z2VfaWQ=",
"value": "MTQ1Mg==",
"index": true
},
{
"key": "cmVjZWl2ZXI=",
"value": "V0RfatpWKg/BJHrErklu9FjLhBM=",
"index": true
},
{
"key": "YW1vdW50",
"value": "Mzg2dW9zbW8=",
"index": true
}
]
} and |
We'll fix this in v0.36, would gladly accept a PR if anyone has time to put one together otherwise I'll get to it next week together with the release. |
How do you expect to fix this, use |
Yes exactly! |
I'm not really familiar with tendermint and the code so I looked quickly out of curiosity since I need this to fetch early Osmosis blocks. Not sure how I'd get to do this in a small change. |
Tried my luck, would love feedback. Never contributed to tendermint so not sure that's the right way to fix it. |
…ems#1400) 0.34 doesn't enforce UTF8 for event attribute values. Adding a Vec<u8> for those, and keeping String for later versions.
…ems#1400) 0.34 doesn't enforce UTF8 for event attribute values. Adding a Vec<u8> for those, and keeping String for later versions.
…c<u8>` for Tendermint v0.34 (#1405) * tendermint: Add `Vec<u8>` for `EventAttribute` for 0.34 (#1400) 0.34 doesn't enforce UTF8 for event attribute values. Adding a Vec<u8> for those, and keeping String for later versions. * Fix clippy warnings * Rename `value_as_bytes` to `value_bytes` * Change v0.34 event attribute key type to `Vec<u8>` * Update doc comments * !fixup 0d93c60 * Fix deserialization of untagged `EventAttribute` * Fix tests * Update changelog entry * Remove TODO * Fix no_std compat * Fix warnings on nightly * Update tendermint/src/abci/event.rs Co-authored-by: Erwan Or <erwan.ounn.84@gmail.com> * Update tendermint/src/abci/event.rs Co-authored-by: Erwan Or <erwan.ounn.84@gmail.com> * Formatting * Fix compilation errors in tests --------- Co-authored-by: Romain Ruetschi <romain@informal.systems> Co-authored-by: Erwan Or <erwan.ounn.84@gmail.com>
What went wrong?
When querying for tx/block results from a TM34 chain (i.e. events are base64-encoded), the parsing fails when the event data is binary and not utf8 because the
deserialize_to_string
conversion usesString.from_utf8
which asserts the data is valid utf8 here.Steps to reproduce
Parse an event containing binary data formatted as base64, using the TM34 compatability mode. This event from the Canto chain as an example:
Definition of "done"
Parsing should not fail when the encoded data is binary. Perhaps it should leave any values which aren't utf8 as base64 strings.
The text was updated successfully, but these errors were encountered: