From db2d84cabd8f868d349a6b976c6462780db8662b Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Wed, 20 Jun 2018 10:21:52 +0200 Subject: [PATCH] Support serde by default. This removes the `serialization-serde` feature, since serde is already used internally and therefore a dependency anyway. --- mod.rs | 5 +---- poly.rs | 10 ++++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/mod.rs b/mod.rs index 0d26299..4986af6 100644 --- a/mod.rs +++ b/mod.rs @@ -2,7 +2,6 @@ pub mod error; pub mod poly; #[cfg(feature = "serialization-protobuf")] pub mod protobuf_impl; -#[cfg(feature = "serialization-serde")] mod serde_impl; use self::poly::{Commitment, Poly}; @@ -179,8 +178,7 @@ impl PartialEq for DecryptionShare { } /// A public key and an associated set of public key shares. -#[cfg_attr(feature = "serialization-serde", derive(Serialize, Deserialize))] -#[derive(Clone, Debug)] +#[derive(Serialize, Deserialize, Clone, Debug)] pub struct PublicKeySet { /// The coefficients of a polynomial whose value at `0` is the "master key", and value at /// `i + 1` is key share number `i`. @@ -526,7 +524,6 @@ mod tests { assert_eq!(20, hash(g0, 20).len()); } - #[cfg(feature = "serialization-serde")] #[test] fn test_serde() { use bincode; diff --git a/poly.rs b/poly.rs index 63d7c0e..989a875 100644 --- a/poly.rs +++ b/poly.rs @@ -248,11 +248,10 @@ impl Poly { } /// A commitment to a univariate polynomial. -#[derive(Debug, Clone)] -#[cfg_attr(feature = "serialization-serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct Commitment { /// The coefficients of the polynomial. - #[cfg_attr(feature = "serialization-serde", serde(with = "super::serde_impl::projective_vec"))] + #[serde(with = "super::serde_impl::projective_vec")] coeff: Vec, } @@ -395,13 +394,12 @@ impl BivarPoly { } /// A commitment to a bivariate polynomial. -#[derive(Debug, Clone)] -#[cfg_attr(feature = "serialization-serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct BivarCommitment { /// The polynomial's degree in each of the two variables. degree: usize, /// The commitments to the coefficients. - #[cfg_attr(feature = "serialization-serde", serde(with = "super::serde_impl::projective_vec"))] + #[serde(with = "super::serde_impl::projective_vec")] coeff: Vec, }