diff --git a/tfhe-zk-pok/Cargo.toml b/tfhe-zk-pok/Cargo.toml index c075970d0b..08cf923196 100644 --- a/tfhe-zk-pok/Cargo.toml +++ b/tfhe-zk-pok/Cargo.toml @@ -23,6 +23,7 @@ sha3 = "0.10.8" serde = { version = "~1.0", features = ["derive"] } zeroize = "1.7.0" num-bigint = "0.4.5" +tfhe-versionable = { version = "0.1.0", path = "../utils/tfhe-versionable" } # TODO update to latest after rebase [dev-dependencies] serde_json = "~1.0" diff --git a/tfhe-zk-pok/src/backward_compatibility/mod.rs b/tfhe-zk-pok/src/backward_compatibility/mod.rs new file mode 100644 index 0000000000..f9ffd2bdc7 --- /dev/null +++ b/tfhe-zk-pok/src/backward_compatibility/mod.rs @@ -0,0 +1,41 @@ +use tfhe_versionable::{Unversionize, Versionize, VersionsDispatch}; + +use crate::curve_api::Curve; +use crate::proofs::pke_v2::Proof; +use crate::serialization::{ + SerializableAffine, SerializableCubicExtField, SerializableFp, SerializableFp2, + SerializableFp6, SerializableQuadExtField, +}; + +#[derive(VersionsDispatch)] +pub enum SerializableAffineVersions { + V0(SerializableAffine), +} + +#[derive(VersionsDispatch)] +pub enum SerializableFpVersions { + V0(SerializableFp), +} + +#[derive(VersionsDispatch)] +pub enum SerializableQuadExtFieldVersions { + V0(SerializableQuadExtField), +} + +#[derive(VersionsDispatch)] +pub enum SerializableCubicExtFieldVersions { + V0(SerializableCubicExtField), +} + +pub type SerializableG1AffineVersions = SerializableAffineVersions; +pub type SerializableG2AffineVersions = SerializableAffineVersions; +pub type SerializableFp12Versions = SerializableQuadExtFieldVersions; + +#[derive(VersionsDispatch)] +pub enum ProofVersions +where + G::G1: Versionize + Unversionize, + G::G2: Versionize + Unversionize, +{ + V0(Proof), +} diff --git a/tfhe-zk-pok/src/curve_api.rs b/tfhe-zk-pok/src/curve_api.rs index ca83cd887d..13ab8f9a99 100644 --- a/tfhe-zk-pok/src/curve_api.rs +++ b/tfhe-zk-pok/src/curve_api.rs @@ -7,6 +7,7 @@ use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; use core::fmt; use core::ops::{Add, AddAssign, Div, Mul, Neg, Sub, SubAssign}; use serde::{Deserialize, Serialize}; +use tfhe_versionable::NotVersioned; use crate::serialization::{SerializableAffine, SerializableFp, SerializableFp12, SerializableFp2}; @@ -412,9 +413,11 @@ impl PairingGroupOps for bls12_446: } } -#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize)] +// These are just ZSTs that are not actually produced and are only used for their +// associated types. So it's ok to derive "NotVersioned" for them. +#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize, NotVersioned)] pub struct Bls12_381; -#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize, NotVersioned)] pub struct Bls12_446; impl Curve for Bls12_381 { diff --git a/tfhe-zk-pok/src/curve_api/bls12_381.rs b/tfhe-zk-pok/src/curve_api/bls12_381.rs index 20e231061c..3bd0fa498c 100644 --- a/tfhe-zk-pok/src/curve_api/bls12_381.rs +++ b/tfhe-zk-pok/src/curve_api/bls12_381.rs @@ -34,6 +34,11 @@ fn bigint_to_le_bytes(x: [u64; 6]) -> [u8; 6 * 8] { } mod g1 { + use tfhe_versionable::Versionize; + + use crate::backward_compatibility::SerializableG1AffineVersions; + use crate::serialization::SerializableG1Affine; + use super::*; #[derive( @@ -47,10 +52,13 @@ mod g1 { Hash, CanonicalSerialize, CanonicalDeserialize, + Versionize, )] - #[serde( - try_from = "SerializableAffine", - into = "SerializableAffine" + #[serde(try_from = "SerializableG1Affine", into = "SerializableG1Affine")] + #[versionize( + SerializableG1AffineVersions, + try_from = "SerializableG1Affine", + into = "SerializableG1Affine" )] #[repr(transparent)] pub struct G1Affine { @@ -98,10 +106,13 @@ mod g1 { Hash, CanonicalSerialize, CanonicalDeserialize, + Versionize, )] - #[serde( - try_from = "SerializableAffine", - into = "SerializableAffine" + #[serde(try_from = "SerializableG1Affine", into = "SerializableG1Affine")] + #[versionize( + SerializableG1AffineVersions, + try_from = "SerializableG1Affine", + into = "SerializableG1Affine" )] #[repr(transparent)] pub struct G1 { @@ -250,6 +261,11 @@ mod g1 { } mod g2 { + use tfhe_versionable::Versionize; + + use crate::backward_compatibility::SerializableG2AffineVersions; + use crate::serialization::SerializableG2Affine; + use super::*; #[derive( @@ -263,10 +279,13 @@ mod g2 { Hash, CanonicalSerialize, CanonicalDeserialize, + Versionize, )] - #[serde( - try_from = "SerializableAffine", - into = "SerializableAffine" + #[serde(try_from = "SerializableG2Affine", into = "SerializableG2Affine")] + #[versionize( + SerializableG2AffineVersions, + try_from = "SerializableG2Affine", + into = "SerializableG2Affine" )] #[repr(transparent)] pub struct G2Affine { @@ -314,10 +333,13 @@ mod g2 { Hash, CanonicalSerialize, CanonicalDeserialize, + Versionize, )] - #[serde( - try_from = "SerializableAffine", - into = "SerializableAffine" + #[serde(try_from = "SerializableG2Affine", into = "SerializableG2Affine")] + #[versionize( + SerializableG2AffineVersions, + try_from = "SerializableG2Affine", + into = "SerializableG2Affine" )] #[repr(transparent)] pub struct G2 { @@ -513,11 +535,19 @@ mod g2 { } mod gt { + use crate::backward_compatibility::SerializableFp12Versions; + use super::*; use ark_ec::pairing::Pairing; + use tfhe_versionable::Versionize; - #[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)] + #[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Versionize, Hash)] #[serde(try_from = "SerializableFp12", into = "SerializableFp12")] + #[versionize( + SerializableFp12Versions, + try_from = "SerializableFp12", + into = "SerializableFp12" + )] #[repr(transparent)] pub struct Gt { inner: ark_ec::pairing::PairingOutput, @@ -662,8 +692,11 @@ mod gt { } mod zp { + use crate::backward_compatibility::SerializableFpVersions; + use super::*; use ark_ff::Fp; + use tfhe_versionable::Versionize; use zeroize::Zeroize; fn redc(n: [u64; 4], nprime: u64, mut t: [u64; 6]) -> [u64; 4] { @@ -700,8 +733,13 @@ mod zp { t } - #[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, Zeroize)] + #[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Versionize, Hash, Zeroize)] #[serde(try_from = "SerializableFp", into = "SerializableFp")] + #[versionize( + SerializableFpVersions, + try_from = "SerializableFp", + into = "SerializableFp" + )] #[repr(transparent)] pub struct Zp { pub(crate) inner: ark_bls12_381::Fr, diff --git a/tfhe-zk-pok/src/curve_api/bls12_446.rs b/tfhe-zk-pok/src/curve_api/bls12_446.rs index 85cea34302..fb9bfa31d6 100644 --- a/tfhe-zk-pok/src/curve_api/bls12_446.rs +++ b/tfhe-zk-pok/src/curve_api/bls12_446.rs @@ -34,6 +34,11 @@ fn bigint_to_le_bytes(x: [u64; 7]) -> [u8; 7 * 8] { } mod g1 { + use tfhe_versionable::Versionize; + + use crate::backward_compatibility::SerializableG1AffineVersions; + use crate::serialization::SerializableG1Affine; + use super::*; #[derive( @@ -47,10 +52,13 @@ mod g1 { Hash, CanonicalDeserialize, CanonicalSerialize, + Versionize, )] - #[serde( - try_from = "SerializableAffine", - into = "SerializableAffine" + #[serde(try_from = "SerializableG1Affine", into = "SerializableG1Affine")] + #[versionize( + SerializableG1AffineVersions, + try_from = "SerializableG1Affine", + into = "SerializableG1Affine" )] #[repr(transparent)] pub struct G1Affine { @@ -99,10 +107,13 @@ mod g1 { Hash, CanonicalSerialize, CanonicalDeserialize, + Versionize, )] - #[serde( - try_from = "SerializableAffine", - into = "SerializableAffine" + #[serde(try_from = "SerializableG1Affine", into = "SerializableG1Affine")] + #[versionize( + SerializableG1AffineVersions, + try_from = "SerializableG1Affine", + into = "SerializableG1Affine" )] #[repr(transparent)] pub struct G1 { @@ -251,6 +262,11 @@ mod g1 { } mod g2 { + use tfhe_versionable::Versionize; + + use crate::backward_compatibility::SerializableG2AffineVersions; + use crate::serialization::SerializableG2Affine; + use super::*; #[derive( @@ -264,10 +280,13 @@ mod g2 { Hash, CanonicalSerialize, CanonicalDeserialize, + Versionize, )] - #[serde( - try_from = "SerializableAffine", - into = "SerializableAffine" + #[serde(try_from = "SerializableG2Affine", into = "SerializableG2Affine")] + #[versionize( + SerializableG2AffineVersions, + try_from = "SerializableG2Affine", + into = "SerializableG2Affine" )] #[repr(transparent)] pub struct G2Affine { @@ -406,10 +425,13 @@ mod g2 { Hash, CanonicalSerialize, CanonicalDeserialize, + Versionize, )] - #[serde( - try_from = "SerializableAffine", - into = "SerializableAffine" + #[serde(try_from = "SerializableG2Affine", into = "SerializableG2Affine")] + #[versionize( + SerializableG2AffineVersions, + try_from = "SerializableG2Affine", + into = "SerializableG2Affine" )] #[repr(transparent)] pub struct G2 { @@ -604,11 +626,13 @@ mod g2 { } mod gt { + use crate::backward_compatibility::SerializableFp12Versions; use crate::curve_446::{Fq, Fq12, Fq2}; use super::*; use ark_ec::pairing::{MillerLoopOutput, Pairing}; use ark_ff::{CubicExtField, QuadExtField}; + use tfhe_versionable::Versionize; type Bls = crate::curve_446::Bls12_446; @@ -778,8 +802,13 @@ mod gt { } } - #[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)] + #[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Versionize, Hash)] #[serde(try_from = "SerializableFp12", into = "SerializableFp12")] + #[versionize( + SerializableFp12Versions, + try_from = "SerializableFp12", + into = "SerializableFp12" + )] #[repr(transparent)] pub struct Gt { pub(crate) inner: ark_ec::pairing::PairingOutput, @@ -922,8 +951,11 @@ mod gt { } mod zp { + use crate::backward_compatibility::SerializableFpVersions; + use super::*; use ark_ff::Fp; + use tfhe_versionable::Versionize; use zeroize::Zeroize; fn redc(n: [u64; 5], nprime: u64, mut t: [u64; 7]) -> [u64; 5] { @@ -960,8 +992,13 @@ mod zp { t } - #[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, Zeroize)] + #[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Versionize, Hash, Zeroize)] #[serde(try_from = "SerializableFp", into = "SerializableFp")] + #[versionize( + SerializableFpVersions, + try_from = "SerializableFp", + into = "SerializableFp" + )] #[repr(transparent)] pub struct Zp { pub inner: crate::curve_446::Fr, diff --git a/tfhe-zk-pok/src/lib.rs b/tfhe-zk-pok/src/lib.rs index 87a41c80e0..5d4d44f430 100644 --- a/tfhe-zk-pok/src/lib.rs +++ b/tfhe-zk-pok/src/lib.rs @@ -5,4 +5,5 @@ pub mod curve_api; pub mod proofs; pub mod serialization; +pub mod backward_compatibility; mod four_squares; diff --git a/tfhe-zk-pok/src/proofs/pke_v2.rs b/tfhe-zk-pok/src/proofs/pke_v2.rs index 160a59aee2..cc6720cd9e 100644 --- a/tfhe-zk-pok/src/proofs/pke_v2.rs +++ b/tfhe-zk-pok/src/proofs/pke_v2.rs @@ -2,9 +2,11 @@ #![allow(non_snake_case)] use super::*; +use crate::backward_compatibility::ProofVersions; use crate::four_squares::*; use core::marker::PhantomData; use rayon::prelude::*; +use tfhe_versionable::{Unversionize, Versionize}; fn bit_iter(x: u64, nbits: u32) -> impl Iterator { (0..nbits).map(move |idx| ((x >> idx) & 1) != 0) @@ -88,11 +90,15 @@ impl PublicParams { } } -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Versionize)] #[serde(bound( deserialize = "G: Curve, G::G1: serde::Deserialize<'de>, G::G2: serde::Deserialize<'de>", serialize = "G: Curve, G::G1: serde::Serialize, G::G2: serde::Serialize" ))] +#[versionize( + ProofVersions, + bound = "G::G1: Versionize + Unversionize, G::G2: Versionize + Unversionize" +)] pub struct Proof { C_hat_e: G::G2, C_e: G::G1, diff --git a/tfhe-zk-pok/src/serialization.rs b/tfhe-zk-pok/src/serialization.rs index 341a7c0d75..f47643f4dc 100644 --- a/tfhe-zk-pok/src/serialization.rs +++ b/tfhe-zk-pok/src/serialization.rs @@ -4,11 +4,42 @@ use ark_ec::short_weierstrass::{Affine, SWCurveConfig}; use ark_ec::AffineRepr; use ark_ff::{BigInt, Field, Fp, Fp2, Fp6, Fp6Config, FpConfig, QuadExtConfig, QuadExtField}; use serde::{Deserialize, Serialize}; +use tfhe_versionable::Versionize; + +use crate::backward_compatibility::{ + SerializableAffineVersions, SerializableCubicExtFieldVersions, SerializableFpVersions, + SerializableQuadExtFieldVersions, +}; + +/// Serialization equivalent of the [`Fp`] struct, where the bigint is split into +/// multiple u64. +#[derive(Serialize, Deserialize, Versionize)] +#[versionize(SerializableFpVersions)] +pub struct SerializableFp { + val: Vec, // Use a Vec since serde does not support fixed size arrays +} + +impl, const N: usize> From> for SerializableFp { + fn from(value: Fp) -> Self { + Self { + val: value.0 .0.to_vec(), + } + } +} + +impl, const N: usize> TryFrom for Fp { + type Error = Vec; // TODO + + fn try_from(value: SerializableFp) -> Result { + Ok(Fp(BigInt(value.val.try_into()?), PhantomData)) + } +} /// Serialization equivalent to the [`Affine`], which support an optional compression mode /// where only the `x` coordinate is stored, and the `y` is computed on load. -#[derive(Serialize, Deserialize)] -pub(crate) enum SerializableAffine { +#[derive(Serialize, Deserialize, Versionize)] +#[versionize(SerializableAffineVersions)] +pub enum SerializableAffine { Infinity, Compressed { x: F, take_largest_y: bool }, Uncompressed { x: F, y: F }, @@ -66,36 +97,17 @@ where } } -/// Serialization equivalent of the [`Fp`] struct, where the bigint is split into -/// multiple u64. -#[derive(Serialize, Deserialize)] -pub(crate) struct SerializableFp { - val: Vec, // Use a Vec since serde does not support fixed size arrays -} - -impl, const N: usize> From> for SerializableFp { - fn from(value: Fp) -> Self { - Self { - val: value.0 .0.to_vec(), - } - } -} - -impl, const N: usize> TryFrom for Fp { - type Error = Vec; // TODO - - fn try_from(value: SerializableFp) -> Result { - Ok(Fp(BigInt(value.val.try_into()?), PhantomData)) - } -} +pub(crate) type SerializableG1Affine = SerializableAffine; -#[derive(Serialize, Deserialize)] -pub(crate) struct SerializableQuadExtField { +#[derive(Serialize, Deserialize, Versionize)] +#[versionize(SerializableQuadExtFieldVersions)] +pub struct SerializableQuadExtField { c0: F, c1: F, } pub(crate) type SerializableFp2 = SerializableQuadExtField; +pub type SerializableG2Affine = SerializableAffine; impl From> for SerializableQuadExtField where @@ -123,14 +135,15 @@ where } } -#[derive(Serialize, Deserialize)] -pub(crate) struct SerializableCubicExtField { +#[derive(Serialize, Deserialize, Versionize)] +#[versionize(SerializableCubicExtFieldVersions)] +pub struct SerializableCubicExtField { c0: F, c1: F, c2: F, } -type SerializableFp6 = SerializableCubicExtField; +pub(crate) type SerializableFp6 = SerializableCubicExtField; impl From> for SerializableCubicExtField where diff --git a/tfhe/src/high_level_api/backward_compatibility/compact_list.rs b/tfhe/src/high_level_api/backward_compatibility/compact_list.rs index d531b094e3..ecb425a204 100644 --- a/tfhe/src/high_level_api/backward_compatibility/compact_list.rs +++ b/tfhe/src/high_level_api/backward_compatibility/compact_list.rs @@ -1,8 +1,16 @@ use tfhe_versionable::VersionsDispatch; use crate::CompactCiphertextList; +#[cfg(feature = "zk-pok")] +use crate::ProvenCompactCiphertextList; #[derive(VersionsDispatch)] pub enum CompactCiphertextListVersions { V0(CompactCiphertextList), } + +#[cfg(feature = "zk-pok")] +#[derive(VersionsDispatch)] +pub enum ProvenCompactCiphertextListVersions { + V0(ProvenCompactCiphertextList), +} diff --git a/tfhe/src/high_level_api/compact_list.rs b/tfhe/src/high_level_api/compact_list.rs index 9d86d6c596..d574b1b542 100644 --- a/tfhe/src/high_level_api/compact_list.rs +++ b/tfhe/src/high_level_api/compact_list.rs @@ -1,6 +1,8 @@ use tfhe_versionable::Versionize; use crate::backward_compatibility::compact_list::CompactCiphertextListVersions; +#[cfg(feature = "zk-pok")] +use crate::backward_compatibility::compact_list::ProvenCompactCiphertextListVersions; use crate::conformance::ParameterSetConformant; use crate::core_crypto::commons::math::random::{Deserialize, Serialize}; use crate::core_crypto::prelude::Numeric; @@ -96,7 +98,8 @@ impl ParameterSetConformant for CompactCiphertextList { } #[cfg(feature = "zk-pok")] -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone, Serialize, Deserialize, Versionize)] +#[versionize(ProvenCompactCiphertextListVersions)] pub struct ProvenCompactCiphertextList(crate::integer::ciphertext::ProvenCompactCiphertextList); #[cfg(feature = "zk-pok")] diff --git a/tfhe/src/integer/backward_compatibility/ciphertext/mod.rs b/tfhe/src/integer/backward_compatibility/ciphertext/mod.rs index d62f0e520e..941d964128 100644 --- a/tfhe/src/integer/backward_compatibility/ciphertext/mod.rs +++ b/tfhe/src/integer/backward_compatibility/ciphertext/mod.rs @@ -6,6 +6,8 @@ use crate::integer::ciphertext::{ CompressedModulusSwitchedSignedRadixCiphertext, DataKind, }; use crate::integer::BooleanBlock; +#[cfg(feature = "zk-pok")] +use crate::integer::ProvenCompactCiphertextList; use crate::shortint::ciphertext::CompressedModulusSwitchedCiphertext; #[derive(VersionsDispatch)] @@ -48,6 +50,12 @@ pub enum CompactCiphertextListVersions { V1(CompactCiphertextList), } +#[cfg(feature = "zk-pok")] +#[derive(VersionsDispatch)] +pub enum ProvenCompactCiphertextListVersions { + V0(ProvenCompactCiphertextList), +} + #[derive(VersionsDispatch)] pub enum DataKindVersions { V0(DataKind), diff --git a/tfhe/src/integer/ciphertext/compact_list.rs b/tfhe/src/integer/ciphertext/compact_list.rs index f8e3e91411..78dc8dc373 100644 --- a/tfhe/src/integer/ciphertext/compact_list.rs +++ b/tfhe/src/integer/ciphertext/compact_list.rs @@ -2,6 +2,8 @@ use super::{DataKind, Expandable}; use crate::conformance::{ListSizeConstraint, ParameterSetConformant}; use crate::core_crypto::prelude::Numeric; use crate::integer::backward_compatibility::ciphertext::CompactCiphertextListVersions; +#[cfg(feature = "zk-pok")] +use crate::integer::backward_compatibility::ciphertext::ProvenCompactCiphertextListVersions; use crate::integer::block_decomposition::DecomposableInto; use crate::integer::encryption::{create_clear_radix_block_iterator, KnowsMessageModulus}; use crate::integer::parameters::CompactCiphertextListConformanceParams; @@ -534,7 +536,8 @@ impl CompactCiphertextList { } #[cfg(feature = "zk-pok")] -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone, Serialize, Deserialize, Versionize)] +#[versionize(ProvenCompactCiphertextListVersions)] pub struct ProvenCompactCiphertextList { pub(crate) ct_list: crate::shortint::ciphertext::ProvenCompactCiphertextList, // Integers stored can have a heterogeneous number of blocks and signedness diff --git a/tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs b/tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs index 236efc94bb..69c917c6f7 100644 --- a/tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs +++ b/tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs @@ -60,6 +60,12 @@ pub enum CompactCiphertextListVersions { V1(CompactCiphertextList), } +#[cfg(feature = "zk-pok")] +#[derive(VersionsDispatch)] +pub enum ProvenCompactCiphertextListVersions { + V0(ProvenCompactCiphertextList), +} + #[derive(VersionsDispatch)] pub enum CompressedCiphertextVersions { V0(CompressedCiphertext), diff --git a/tfhe/src/shortint/ciphertext/zk.rs b/tfhe/src/shortint/ciphertext/zk.rs index d898619382..dfb26be865 100644 --- a/tfhe/src/shortint/ciphertext/zk.rs +++ b/tfhe/src/shortint/ciphertext/zk.rs @@ -1,5 +1,6 @@ use crate::core_crypto::algorithms::verify_lwe_compact_ciphertext_list; use crate::core_crypto::prelude::verify_lwe_ciphertext; +use crate::shortint::backward_compatibility::ciphertext::ProvenCompactCiphertextListVersions; use crate::shortint::ciphertext::CompactCiphertextList; use crate::shortint::parameters::{ CompactPublicKeyEncryptionParameters, ShortintCompactCiphertextListCastingMode, @@ -8,6 +9,7 @@ use crate::shortint::{Ciphertext, CompactPublicKey}; use crate::zk::{CompactPkeCrs, CompactPkeProof, CompactPkePublicParams, ZkVerificationOutCome}; use rayon::prelude::*; use serde::{Deserialize, Serialize}; +use tfhe_versionable::Versionize; impl CompactPkeCrs { /// Construct the CRS that corresponds to the given parameters @@ -71,7 +73,8 @@ impl ProvenCiphertext { /// A List of CompactCiphertext with their zero-knowledge proofs /// /// The proofs can only be generated during the encryption with a [CompactPublicKey] -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone, Serialize, Deserialize, Versionize)] +#[versionize(ProvenCompactCiphertextListVersions)] pub struct ProvenCompactCiphertextList { pub(crate) proved_lists: Vec<(CompactCiphertextList, CompactPkeProof)>, } diff --git a/tfhe/src/zk.rs b/tfhe/src/zk.rs index 1c0f30e92f..3aa28b0ad3 100644 --- a/tfhe/src/zk.rs +++ b/tfhe/src/zk.rs @@ -9,8 +9,8 @@ use tfhe_zk_pok::proofs::pke_v2::crs_gen; pub use tfhe_zk_pok::proofs::ComputeLoad as ZkComputeLoad; pub use tfhe_zk_pok::{CanonicalDeserialize, CanonicalSerialize, Compress, Validate}; type Curve = tfhe_zk_pok::curve_api::Bls12_446; -pub type CompactPkeProof = tfhe_zk_pok::proofs::pke::Proof; -pub type CompactPkePublicParams = tfhe_zk_pok::proofs::pke::PublicParams; +pub type CompactPkeProof = tfhe_zk_pok::proofs::pke_v2::Proof; +pub type CompactPkePublicParams = tfhe_zk_pok::proofs::pke_v2::PublicParams; #[derive(Copy, Clone, Eq, PartialEq)] pub enum ZkVerificationOutCome {