Skip to content

Commit c807bce

Browse files
committed
chore(tfhe): update ZK related parameters to use TUniform ones
1 parent 2674782 commit c807bce

File tree

9 files changed

+16
-28
lines changed

9 files changed

+16
-28
lines changed

tfhe/c_api_tests/test_high_level_zk.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ int main(void) {
99

1010
// Note that simply changing parameters like this does not yield secure parameters
1111
// Its only done for the example / tests
12-
ShortintPBSParameters params = SHORTINT_PARAM_MESSAGE_2_CARRY_2_KS_PBS;
13-
params.glwe_noise_distribution = new_t_uniform(9);
12+
ShortintPBSParameters params = SHORTINT_PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
1413
assert(params.encryption_key_choice == ShortintEncryptionKeyChoiceBig);
1514

1615
int status;

tfhe/docs/guides/zk-pok.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
2222

2323
let max_num_message = 1;
2424

25-
let mut params = tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS;
26-
params.glwe_noise_distribution = DynamicDistribution::new_t_uniform(9);
25+
let mut params =
26+
tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
2727

2828
let client_key = tfhe::ClientKey::generate(tfhe::ConfigBuilder::with_custom_parameters(params, None));
2929
// This is done in an offline phase and the CRS is shared to all clients and the server

tfhe/js_on_wasm_tests/test-hlapi-unsigned.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,7 @@ function generateRandomBigInt(bitLength) {
658658
}
659659

660660
test('hlapi_compact_public_key_encrypt_and_prove_compact_uint256', (t) => {
661-
let block_params = new ShortintParameters(ShortintParametersName.PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS);
662-
block_params.set_lwe_noise_distribution(Shortint.try_new_t_uniform(9));
661+
let block_params = new ShortintParameters(ShortintParametersName.PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40);
663662

664663
let config = TfheConfigBuilder.default()
665664
.use_custom_parameters(block_params)

tfhe/src/high_level_api/booleans/tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,11 +832,10 @@ mod cpu {
832832
#[cfg(feature = "zk-pok-experimental")]
833833
#[test]
834834
fn test_fhe_bool_zk() {
835-
use crate::core_crypto::prelude::DynamicDistribution;
836835
use crate::zk::{CompactPkeCrs, ZkComputeLoad};
837836

838-
let mut params = crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS;
839-
params.glwe_noise_distribution = DynamicDistribution::new_t_uniform(9);
837+
let params =
838+
crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
840839

841840
let config = ConfigBuilder::with_custom_parameters(params, None).build();
842841
let crs = CompactPkeCrs::from_config(config, 2).unwrap();

tfhe/src/high_level_api/integers/signed/tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,11 +805,10 @@ fn test_safe_deserialize_conformant_compact_fhe_int32_list() {
805805
#[cfg(feature = "zk-pok-experimental")]
806806
#[test]
807807
fn test_fhe_int_zk() {
808-
use crate::core_crypto::prelude::DynamicDistribution;
809808
use crate::zk::{CompactPkeCrs, ZkComputeLoad};
810809

811-
let mut params = crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS;
812-
params.glwe_noise_distribution = DynamicDistribution::new_t_uniform(9);
810+
let params =
811+
crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
813812

814813
let config = ConfigBuilder::with_custom_parameters(params, None).build();
815814
let crs = CompactPkeCrs::from_config(config, 32).unwrap();

tfhe/src/high_level_api/integers/unsigned/tests/cpu.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,7 @@ fn test_safe_deserialize_conformant_compact_fhe_uint32_list() {
550550
fn test_fhe_uint_zk() {
551551
use crate::zk::{CompactPkeCrs, ZkComputeLoad};
552552

553-
let mut params = PARAM_MESSAGE_2_CARRY_2_KS_PBS;
554-
params.glwe_noise_distribution = DynamicDistribution::new_t_uniform(9);
553+
let params = PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
555554

556555
let config = ConfigBuilder::with_custom_parameters(params, None).build();
557556
let crs = CompactPkeCrs::from_config(config, 32).unwrap();

tfhe/src/integer/zk.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ impl ProvenCompactCiphertextList {
9494
#[cfg(test)]
9595
mod tests {
9696
use crate::integer::{ClientKey, CompactPublicKey};
97-
use crate::shortint::parameters::DynamicDistribution;
98-
use crate::shortint::prelude::PARAM_MESSAGE_2_CARRY_2_KS_PBS;
97+
use crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
9998
use crate::zk::{CompactPkeCrs, ZkComputeLoad};
10099
use rand::random;
101100

102101
#[test]
103102
fn test_zk_compact_ciphertext_list_encryption_ci_run_filter() {
104-
let mut params = PARAM_MESSAGE_2_CARRY_2_KS_PBS;
105-
params.glwe_noise_distribution = DynamicDistribution::new_t_uniform(9);
103+
let params = PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
106104

107105
let num_blocks = 4usize;
108106
let modulus = (params.message_modulus.0 as u64)

tfhe/src/shortint/ciphertext/zk.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,14 @@ impl ProvenCompactCiphertextList {
138138

139139
#[cfg(test)]
140140
mod tests {
141-
use crate::shortint::parameters::DynamicDistribution;
142-
use crate::shortint::prelude::PARAM_MESSAGE_2_CARRY_2_KS_PBS;
141+
use crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
143142
use crate::shortint::{ClientKey, CompactPublicKey};
144143
use crate::zk::{CompactPkeCrs, ZkComputeLoad};
145144
use rand::random;
146145

147146
#[test]
148147
fn test_zk_ciphertext_encryption_ci_run_filter() {
149-
let mut params = PARAM_MESSAGE_2_CARRY_2_KS_PBS;
150-
params.glwe_noise_distribution = DynamicDistribution::new_t_uniform(9);
148+
let params = PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
151149

152150
let crs = CompactPkeCrs::from_shortint_params(params, 4).unwrap();
153151
let cks = ClientKey::new(params);
@@ -166,8 +164,7 @@ mod tests {
166164

167165
#[test]
168166
fn test_zk_compact_ciphertext_list_encryption_ci_run_filter() {
169-
let mut params = PARAM_MESSAGE_2_CARRY_2_KS_PBS;
170-
params.glwe_noise_distribution = DynamicDistribution::new_t_uniform(9);
167+
let params = PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40;
171168

172169
let crs = CompactPkeCrs::from_shortint_params(params, 512).unwrap();
173170
let cks = ClientKey::new(params);

tfhe/web_wasm_parallel_tests/worker.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,8 @@ function generateRandomBigInt(bitLen) {
388388

389389
async function compactPublicKeyZeroKnowledge() {
390390
let block_params = new ShortintParameters(
391-
ShortintParametersName.PARAM_MESSAGE_2_CARRY_2_KS_PBS,
391+
ShortintParametersName.PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40,
392392
);
393-
block_params.set_glwe_noise_distribution(Shortint.try_new_t_uniform(9));
394393

395394
let config = TfheConfigBuilder.default()
396395
.use_custom_parameters(block_params)
@@ -650,9 +649,8 @@ async function compressedServerKeyBenchMessage2Carry2() {
650649

651650
async function compactPublicKeyZeroKnowledgeBench() {
652651
let block_params = new ShortintParameters(
653-
ShortintParametersName.PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS,
652+
ShortintParametersName.PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_TUNIFORM_2M40,
654653
);
655-
block_params.set_lwe_noise_distribution(Shortint.try_new_t_uniform(9));
656654

657655
let config = TfheConfigBuilder.default()
658656
.use_custom_parameters(block_params)

0 commit comments

Comments
 (0)