Support serde by default.

This removes the `serialization-serde` feature, since serde is already
used internally and therefore a dependency anyway.
master
Andreas Fackler 7 years ago committed by Vladimir Komendantskiy
parent 78b2a008c1
commit db2d84cabd
  1. 5
      mod.rs
  2. 10
      poly.rs

@ -2,7 +2,6 @@ pub mod error;
pub mod poly; pub mod poly;
#[cfg(feature = "serialization-protobuf")] #[cfg(feature = "serialization-protobuf")]
pub mod protobuf_impl; pub mod protobuf_impl;
#[cfg(feature = "serialization-serde")]
mod serde_impl; mod serde_impl;
use self::poly::{Commitment, Poly}; use self::poly::{Commitment, Poly};
@ -179,8 +178,7 @@ impl<E: Engine> PartialEq for DecryptionShare<E> {
} }
/// A public key and an associated set of public key shares. /// A public key and an associated set of public key shares.
#[cfg_attr(feature = "serialization-serde", derive(Serialize, Deserialize))] #[derive(Serialize, Deserialize, Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicKeySet<E: Engine> { pub struct PublicKeySet<E: Engine> {
/// The coefficients of a polynomial whose value at `0` is the "master key", and value at /// The coefficients of a polynomial whose value at `0` is the "master key", and value at
/// `i + 1` is key share number `i`. /// `i + 1` is key share number `i`.
@ -526,7 +524,6 @@ mod tests {
assert_eq!(20, hash(g0, 20).len()); assert_eq!(20, hash(g0, 20).len());
} }
#[cfg(feature = "serialization-serde")]
#[test] #[test]
fn test_serde() { fn test_serde() {
use bincode; use bincode;

@ -248,11 +248,10 @@ impl<E: Engine> Poly<E> {
} }
/// A commitment to a univariate polynomial. /// A commitment to a univariate polynomial.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "serialization-serde", derive(Serialize, Deserialize))]
pub struct Commitment<E: Engine> { pub struct Commitment<E: Engine> {
/// The coefficients of the polynomial. /// 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<E::G1>, coeff: Vec<E::G1>,
} }
@ -395,13 +394,12 @@ impl<E: Engine> BivarPoly<E> {
} }
/// A commitment to a bivariate polynomial. /// A commitment to a bivariate polynomial.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "serialization-serde", derive(Serialize, Deserialize))]
pub struct BivarCommitment<E: Engine> { pub struct BivarCommitment<E: Engine> {
/// The polynomial's degree in each of the two variables. /// The polynomial's degree in each of the two variables.
degree: usize, degree: usize,
/// The commitments to the coefficients. /// 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<E::G1>, coeff: Vec<E::G1>,
} }

Loading…
Cancel
Save