Skip to content

Commit

Permalink
feat(zk): impl Named for zk pke proof and Params
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarlin-zama committed Sep 30, 2024
1 parent 03154d5 commit 53c4850
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tfhe/src/zk.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::core_crypto::commons::math::random::BoundedDistribution;
use crate::core_crypto::prelude::*;
use crate::named::Named;
use rand_core::RngCore;
use std::cmp::Ordering;
use std::collections::Bound;
Expand All @@ -10,7 +11,27 @@ pub use tfhe_zk_pok::curve_api::Compressible;
pub use tfhe_zk_pok::proofs::ComputeLoad as ZkComputeLoad;
type Curve = tfhe_zk_pok::curve_api::Bls12_446;
pub type CompactPkeProof = tfhe_zk_pok::proofs::pke::Proof<Curve>;

impl Named for CompactPkeProof {
const NAME: &'static str = "zk::CompactPkeProof";
}

pub type CompactPkePublicParams = tfhe_zk_pok::proofs::pke::PublicParams<Curve>;
pub type SerializableCompactPkePublicParams =
tfhe_zk_pok::serialization::SerializablePKEv1PublicParams;

impl Named for CompactPkePublicParams {
const NAME: &'static str = "zk::CompactPkePublicParams";
}

// If we call `CompactPkePublicParams::compress` we end up with a
// `SerializableCompactPkePublicParams` that should also impl Named to be serializable with
// `safe_serialization`. Since the `CompactPkePublicParams` is transformed into a
// `SerializableCompactPkePublicParams` anyways before serialization, their impl of `Named` should
// return the same string.
impl Named for SerializableCompactPkePublicParams {
const NAME: &'static str = CompactPkePublicParams::NAME;
}

#[derive(Copy, Clone, Eq, PartialEq)]
pub enum ZkVerificationOutCome {
Expand Down

0 comments on commit 53c4850

Please sign in to comment.