From f955b3fdc2fd787b7a93a362bc68c8e39304b062 Mon Sep 17 00:00:00 2001 From: Nicolas Sarlin Date: Wed, 11 Sep 2024 14:33:08 +0200 Subject: [PATCH] chore(backward): adds a test for proven list versioning --- .../backward_compatibility/high_level_api.rs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tfhe/tests/backward_compatibility/high_level_api.rs b/tfhe/tests/backward_compatibility/high_level_api.rs index 5422426e74..98be5071ba 100644 --- a/tfhe/tests/backward_compatibility/high_level_api.rs +++ b/tfhe/tests/backward_compatibility/high_level_api.rs @@ -8,6 +8,8 @@ use tfhe::backward_compatibility::integers::{ use tfhe::prelude::{CiphertextList, FheDecrypt, FheEncrypt}; use tfhe::shortint::PBSParameters; +#[cfg(feature = "zk-pok")] +use tfhe::ProvenCompactCiphertextList; use tfhe::{ set_server_key, ClientKey, CompactCiphertextList, CompressedCiphertextList, CompressedCompactPublicKey, CompressedFheBool, CompressedFheInt8, CompressedFheUint8, @@ -261,7 +263,6 @@ pub fn test_hl_bool_ciphertext_list( /// Test HL ciphertext list: loads the ciphertext list and compare the decrypted values to the ones /// in the metadata. - pub fn test_hl_heterogeneous_ciphertext_list( dir: &Path, test: &HlHeterogeneousCiphertextListTest, @@ -279,9 +280,26 @@ pub fn test_hl_heterogeneous_ciphertext_list( if test.compressed { let list: CompressedCiphertextList = load_and_unversionize(dir, test, format)?; test_hl_heterogeneous_ciphertext_list_elements(list, &key, test) + } else if test.proven { + #[cfg(feature = "zk-pok")] + { + let list: ProvenCompactCiphertextList = load_and_unversionize(dir, test, format)?; + test_hl_heterogeneous_ciphertext_list_elements( + list.verify_and_expand() + .map_err(|msg| test.failure(msg, format))?, + &key, + test, + ) + } + #[cfg(not(feature = "zk-pok"))] + Ok(()) } else { let list: CompactCiphertextList = load_and_unversionize(dir, test, format)?; - test_hl_heterogeneous_ciphertext_list_elements(list.expand().unwrap(), &key, test) + test_hl_heterogeneous_ciphertext_list_elements( + list.expand().map_err(|msg| test.failure(msg, format))?, + &key, + test, + ) } .map(|_| test.success(format)) .map_err(|msg| test.failure(msg, format))