-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ns/plug zk v2 #1846
Ns/plug zk v2 #1846
Conversation
dd5e5d0
to
74813d9
Compare
74813d9
to
0768a5d
Compare
13a73e4
to
7e57b6a
Compare
/// This parameter set should be used when doing zk proof of public key encryption | ||
pub const PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64: CompactPublicKeyEncryptionParameters = | ||
CompactPublicKeyEncryptionParameters { | ||
encryption_lwe_dimension: LweDimension(1024), | ||
encryption_noise_distribution: DynamicDistribution::new_t_uniform(42), | ||
encryption_lwe_dimension: LweDimension(2048), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check if the keyswitching parameters need an update as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the keyswitch to big key needs a small update, I'll give you the info to update and have legacy constants there as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments
FYI I only had a quick look at the "plug zk v2" commit
7e57b6a
to
5e55167
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
please don't merge right away, I'd like to have a chance to discuss the keyswitching parameters before you do (and read the PR as well) |
eb461a7
to
b700a24
Compare
tfhe/src/zk/mod.rs
Outdated
|
||
pub struct CompactPkeCrsConformanceParams { | ||
lwe_dim: LweDimension, | ||
max_num_message: usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new type ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we are missing a check on k_max <= d it seems, otherwise we are looking good, after the parameter stuff
3b94cf0
to
64c4476
Compare
/// This parameter set should be used when doing zk proof of public key encryption | ||
pub const PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64: CompactPublicKeyEncryptionParameters = | ||
CompactPublicKeyEncryptionParameters { | ||
encryption_lwe_dimension: LweDimension(1024), | ||
encryption_noise_distribution: DynamicDistribution::new_t_uniform(42), | ||
encryption_lwe_dimension: LweDimension(2048), | ||
encryption_noise_distribution: DynamicDistribution::new_t_uniform(17), | ||
message_modulus: MessageModulus(4), | ||
carry_modulus: CarryModulus(4), | ||
ciphertext_modulus: CiphertextModulus::new_native(), | ||
expansion_kind: CompactCiphertextListExpansionKind::RequiresCasting, | ||
} | ||
.validate(); | ||
|
||
/// This legacy parameter set should be used with the v1 pke zk scheme | ||
pub const PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZK_V1: | ||
CompactPublicKeyEncryptionParameters = CompactPublicKeyEncryptionParameters { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you do the keyswitch parameters update ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not yet !
/// This legacy parameter set should be used with the v1 pke zk scheme | ||
pub const PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZK_V1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this does not respect the potential TFHE-rs version being in the name of consts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, I did not reworked the params yet
64c4476
to
55dafc1
Compare
55dafc1
to
ad65d19
Compare
BREAKING CHANGE: - The object ZkVerificationOutCome has been renamed ZkVerificationOutcome. - Conformance of proofs now checks the scheme version of the CRS. This is breaking at the shortint and core_crypto levels, and for manually built integer conformance params. New CRS will be generated with the V2 Scheme by default, but V1 CRS and proofs are still accepted, so this is not breaking. New methods have been added to generate a V1 CRS.
This allows to detect unused dispatch enums
ad65d19
to
a68f83e
Compare
closes: https://github.com/zama-ai/tfhe-rs-internal/issues/772
PR content/description
Plugs ZK V2. The CompactPkeCrs type is now an enum with a variant for V1 and V2, each holding the right 'PublicParam' type from
tfhe_zk_pok
. The proof is similarly wrapped in an enum. A prove method has been added on the Crs object that will generate a proof compatible with this Crs. Similarly, a verify method will always reject proofs that are not of the right kind.Backward compatibility is maintained and old crs/proofs are automatically wrapped in the V1 scheme. A fix was needed in versionable for this, to make it handle type that evolve from
#[repr(transparent)]
to their own type.By default new Crs are created using v2, but methods have been added to create a Crs with v1.
Proof conformance checks the version of the scheme.
Check-list: