Skip to content

Commit

Permalink
tendermint: allow null in EventAttribute kv JSON (#1376)
Browse files Browse the repository at this point in the history
When deserializing EventAttribute values, allow null values in the
key and value fields. This follows the behaviour in 0.34 RPC
(where the key-value data were also base64-encoded), but technically
breaks the serde schema of everything that includes ABCI event data.
  • Loading branch information
mzabaluev authored Nov 10, 2023
1 parent 062945a commit 67354dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- `[tendermint]` Allow null values in `key` and `value` fields of
`EventAttribute` when deserializing. The serialization schema for the fields
is changed to `Option<String>`
([\#1375](https://github.com/informalsystems/tendermint-rs/issues/1375)).
3 changes: 3 additions & 0 deletions tendermint/src/abci/event.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use serde::{Deserialize, Serialize};

use crate::prelude::*;
use crate::serializers;

/// An event that occurred while processing a request.
///
Expand Down Expand Up @@ -119,8 +120,10 @@ where
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Hash)]
pub struct EventAttribute {
/// The event key.
#[serde(with = "serializers::allow_null")]
pub key: String,
/// The event value.
#[serde(with = "serializers::allow_null")]
pub value: String,
/// Whether Tendermint's indexer should index this event.
///
Expand Down

0 comments on commit 67354dd

Please sign in to comment.