From f6848b075e85baf551bc5ac29e764ccc1c138e71 Mon Sep 17 00:00:00 2001 From: Eric Tu Date: Fri, 11 Oct 2024 13:32:23 -0400 Subject: [PATCH] Remove serde on Proposal e.t. al as per PR comment --- zcash_client_backend/src/fees.rs | 7 +++---- zcash_client_backend/src/proposal.rs | 5 ++--- zcash_primitives/src/transaction/fees.rs | 4 +--- zcash_primitives/src/transaction/fees/zip317.rs | 4 +--- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/zcash_client_backend/src/fees.rs b/zcash_client_backend/src/fees.rs index e9e2f7fbe6..fea9424243 100644 --- a/zcash_client_backend/src/fees.rs +++ b/zcash_client_backend/src/fees.rs @@ -1,6 +1,5 @@ use std::fmt; -use serde::{Deserialize, Serialize}; use zcash_primitives::{ consensus::{self, BlockHeight}, memo::MemoBytes, @@ -25,10 +24,10 @@ pub mod zip317; /// `ChangeValue` represents either a proposed change output to a shielded pool /// (with an optional change memo), or if the "transparent-inputs" feature is /// enabled, an ephemeral output to the transparent pool. -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct ChangeValue(ChangeValueInner); -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq)] enum ChangeValueInner { Shielded { protocol: ShieldedProtocol, @@ -115,7 +114,7 @@ impl ChangeValue { /// The amount of change and fees required to make a transaction's inputs and /// outputs balance under a specific fee rule, as computed by a particular /// [`ChangeStrategy`] that is aware of that rule. -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct TransactionBalance { proposed_change: Vec, fee_required: NonNegativeAmount, diff --git a/zcash_client_backend/src/proposal.rs b/zcash_client_backend/src/proposal.rs index 45899a7fd8..3c06be6c45 100644 --- a/zcash_client_backend/src/proposal.rs +++ b/zcash_client_backend/src/proposal.rs @@ -6,7 +6,6 @@ use std::{ }; use nonempty::NonEmpty; -use serde::{Deserialize, Serialize}; use zcash_primitives::{ consensus::BlockHeight, transaction::{components::amount::NonNegativeAmount, TxId}, @@ -331,14 +330,14 @@ impl Debug for Proposal { } /// A reference to either a payment or change output within a step. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum StepOutputIndex { Payment(usize), Change(usize), } /// A reference to the output of a step in a proposal. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct StepOutput { step_index: usize, output_index: StepOutputIndex, diff --git a/zcash_primitives/src/transaction/fees.rs b/zcash_primitives/src/transaction/fees.rs index fa170f6f8b..ae996de6ce 100644 --- a/zcash_primitives/src/transaction/fees.rs +++ b/zcash_primitives/src/transaction/fees.rs @@ -1,7 +1,5 @@ //! Abstractions and types related to fee calculations. -use serde::{Deserialize, Serialize}; - use crate::{ consensus::{self, BlockHeight}, transaction::{components::amount::NonNegativeAmount, fees::transparent::InputSize}, @@ -62,7 +60,7 @@ pub trait FutureFeeRule: FeeRule { } /// An enumeration of the standard fee rules supported by the wallet. -#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum StandardFeeRule { #[deprecated( note = "Using this fee rule violates ZIP 317, and might cause transactions built with it to fail. Use `StandardFeeRule::Zip317` instead." diff --git a/zcash_primitives/src/transaction/fees/zip317.rs b/zcash_primitives/src/transaction/fees/zip317.rs index 089c8d3b8a..48457b8007 100644 --- a/zcash_primitives/src/transaction/fees/zip317.rs +++ b/zcash_primitives/src/transaction/fees/zip317.rs @@ -4,8 +4,6 @@ //! [ZIP 317]: https//zips.z.cash/zip-0317 use core::cmp::max; -use serde::{Deserialize, Serialize}; - use crate::{ consensus::{self, BlockHeight}, transaction::{ @@ -55,7 +53,7 @@ pub const MINIMUM_FEE: NonNegativeAmount = NonNegativeAmount::const_from_u64(10_ /// /// [`FeeRule`]: crate::transaction::fees::FeeRule /// [ZIP 317]: https//zips.z.cash/zip-0317 -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug)] pub struct FeeRule { marginal_fee: NonNegativeAmount, grace_actions: usize,