Skip to content

Commit

Permalink
refactor: limit deser to tests
Browse files Browse the repository at this point in the history
this should make it less stressful not to have the deny_unknown_fields.
  • Loading branch information
Joonas Koivunen committed May 20, 2022
1 parent 4fecd99 commit a9f3424
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/pathfinder/src/rpc/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,9 @@ pub mod reply {
}

/// Describes Starknet's syncing status RPC reply.
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, PartialEq)]
#[serde(untagged)]
#[cfg_attr(test, derive(Deserialize))]
pub enum Syncing {
False(bool),
Status(syncing::Status),
Expand All @@ -695,11 +696,12 @@ pub mod reply {
core::{StarknetBlockHash, StarknetBlockNumber},
rpc::serde::StarknetBlockNumberAsHexStr,
};
use serde::{Deserialize, Serialize};
use serde::Serialize;
use serde_with::serde_as;

/// Represents Starknet node syncing status.
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, PartialEq, Serialize)]
#[cfg_attr(test, derive(serde::Deserialize))]
pub struct Status {
#[serde(flatten, with = "prefix_starting")]
pub starting: NumberedBlock,
Expand All @@ -725,7 +727,8 @@ pub mod reply {

/// Block hash and a number, for `starknet_syncing` response only.
#[serde_as]
#[derive(Clone, Copy, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Copy, Serialize, PartialEq)]
#[cfg_attr(test, derive(serde::Deserialize))]
pub struct NumberedBlock {
#[serde(rename = "block_hash")]
pub hash: StarknetBlockHash,
Expand Down

0 comments on commit a9f3424

Please sign in to comment.