Skip to content

Commit

Permalink
app: fix broken event indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Jan 28, 2025
1 parent 0d8fa13 commit eba4324
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions crates/core/app/src/server/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,24 @@ impl EventIndexLayer {
// Perform matching on a nested key in the same format used by
// the cosmos SDK: https://docs.cosmos.network/main/core/config
// e.g., "message.sender", "message.recipient"
let key_str = attr.key_str();
let value_str = attr.value_str();

// XXX: tendermint-rs now supports v034 events types, which are
// plain bytes and need not be utf8. This messes with the
// regex and is likely not desirable to have in downstream
// consumers of the indexed events.
match attr.key_str() {
Ok(key) => {
let nested_key = format!("{}.{}", e.kind, key);
match (key_str, value_str) {
(Ok(key), Ok(value)) => {
let nested_key = format!("{}.{}", key, value);

if self.no_index.is_match(&nested_key) {
attr.set_index(false)
attr.set_index(false);
}
// This comes second so that explicit index requests take priority over no-index requests.
if self.index.is_match(&nested_key) {
attr.set_index(false)
attr.set_index(true);
}
}
// TODO: what should be done with this error? Emit a warning?
Err(_err) => {
attr.set_index(false);
_ => {
// If either the key or value is not a valid UTF-8 string, we can't
// match it against the regexes, so we skip it.
}
}
}
Expand Down

0 comments on commit eba4324

Please sign in to comment.