Skip to content

Commit

Permalink
Moved allow_empty_object to serializers module and fix issue with Osm…
Browse files Browse the repository at this point in the history
…osis fixture test
  • Loading branch information
ljoss17 committed Jul 11, 2024
1 parent b7351cf commit 568f843
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion rpc/src/endpoint/block_results.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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.
Expand All @@ -123,6 +124,7 @@ pub mod v0_34 {
pub validator_updates: Vec<validator::Update>,

/// New consensus params (might be explicit null)
#[serde(deserialize_with = "allow_empty_object")]
pub consensus_param_updates: Option<consensus::Params>,
}

Expand Down
5 changes: 3 additions & 2 deletions tendermint/src/consensus/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<VersionParams>,
/// Parameters specific to the Application Blockchain Interface.
///
Expand All @@ -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,
}

Expand Down
1 change: 0 additions & 1 deletion tendermint/src/deserializers/mod.rs

This file was deleted.

1 change: 0 additions & 1 deletion tendermint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tendermint/src/serializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 568f843

Please sign in to comment.