From 568f843becc80bce00cf12fa1bf58eebfcba273d Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Thu, 11 Jul 2024 19:00:37 +0200 Subject: [PATCH] Moved allow_empty_object to serializers module and fix issue with Osmosis fixture test --- rpc/src/endpoint/block_results.rs | 4 +++- tendermint/src/consensus/params.rs | 5 +++-- tendermint/src/deserializers/mod.rs | 1 - tendermint/src/lib.rs | 1 - tendermint/src/serializers.rs | 1 + .../src/{deserializers => serializers}/allow_empty_object.rs | 0 6 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 tendermint/src/deserializers/mod.rs rename tendermint/src/{deserializers => serializers}/allow_empty_object.rs (100%) diff --git a/rpc/src/endpoint/block_results.rs b/rpc/src/endpoint/block_results.rs index d6ab348b9..a633154f6 100644 --- a/rpc/src/endpoint/block_results.rs +++ b/rpc/src/endpoint/block_results.rs @@ -1,7 +1,7 @@ //! `/block_results` endpoint JSON-RPC wrapper use serde::{Deserialize, Serialize}; -use tendermint::deserializers::allow_empty_object::allow_empty_object; +use tendermint::serializers::allow_empty_object::allow_empty_object; use tendermint::{abci, block, consensus, serializers, validator, AppHash}; use crate::dialect::{self, Dialect}; @@ -101,6 +101,7 @@ pub mod v0_34 { use crate::prelude::*; use crate::{dialect, serializers}; use serde::{Deserialize, Serialize}; + use tendermint::serializers::allow_empty_object::allow_empty_object; use tendermint::{block, consensus, validator}; /// RPC dialect helper for serialization of the response. @@ -123,6 +124,7 @@ pub mod v0_34 { pub validator_updates: Vec, /// New consensus params (might be explicit null) + #[serde(deserialize_with = "allow_empty_object")] pub consensus_param_updates: Option, } diff --git a/tendermint/src/consensus/params.rs b/tendermint/src/consensus/params.rs index 20af296db..8719b640b 100644 --- a/tendermint/src/consensus/params.rs +++ b/tendermint/src/consensus/params.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::{ - block, deserializers::allow_empty_object::allow_empty_object, evidence, prelude::*, public_key, + block, evidence, prelude::*, public_key, serializers::allow_empty_object::allow_empty_object, }; /// All consensus-relevant parameters that can be adjusted by the ABCI app. @@ -19,6 +19,7 @@ pub struct Params { pub validator: ValidatorParams, /// The ABCI application version. Will default to None if not present. #[serde(default, deserialize_with = "allow_empty_object")] + //#[serde(skip)] pub version: Option, /// Parameters specific to the Application Blockchain Interface. /// @@ -43,7 +44,7 @@ pub struct ValidatorParams { #[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq, Default)] pub struct VersionParams { /// The ABCI application version. - #[serde(with = "crate::serializers::from_str")] + #[serde(with = "crate::serializers::from_str", alias = "app_version")] pub app: u64, } diff --git a/tendermint/src/deserializers/mod.rs b/tendermint/src/deserializers/mod.rs deleted file mode 100644 index aef7d2e56..000000000 --- a/tendermint/src/deserializers/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod allow_empty_object; diff --git a/tendermint/src/lib.rs b/tendermint/src/lib.rs index 9c140e4f2..96315820f 100644 --- a/tendermint/src/lib.rs +++ b/tendermint/src/lib.rs @@ -35,7 +35,6 @@ pub mod chain; pub mod channel; pub mod consensus; pub mod crypto; -pub mod deserializers; pub mod evidence; pub mod genesis; pub mod hash; diff --git a/tendermint/src/serializers.rs b/tendermint/src/serializers.rs index 458f79c89..4845030f5 100644 --- a/tendermint/src/serializers.rs +++ b/tendermint/src/serializers.rs @@ -7,6 +7,7 @@ //! risk. pub use tendermint_proto::serializers::*; +pub mod allow_empty_object; pub mod apphash; pub mod apphash_base64; pub mod hash; diff --git a/tendermint/src/deserializers/allow_empty_object.rs b/tendermint/src/serializers/allow_empty_object.rs similarity index 100% rename from tendermint/src/deserializers/allow_empty_object.rs rename to tendermint/src/serializers/allow_empty_object.rs