From ea6a781dcd2879fb077a72098e7f71c580e7b52c Mon Sep 17 00:00:00 2001 From: Arthur Meyre Date: Mon, 4 Nov 2024 14:41:51 +0100 Subject: [PATCH] chore: update data for the 0.10 breaking change --- Cargo.lock | 72 +++++++++---------- Cargo.toml | 10 +-- .../high_level_api/client_key.bcode | 0 .../high_level_api/client_key.cbor | 0 .../compressed_server_key.bcode | 3 + .../high_level_api/compressed_server_key.cbor | 3 + .../server_key_with_compression.bcode | 3 + .../server_key_with_compression.cbor | 3 + data/0_8/high_level_api/server_key.bcode | 3 - data/0_8/high_level_api/server_key.cbor | 3 - .../server_key_with_compression.bcode | 3 - .../server_key_with_compression.cbor | 3 - .../compressed_server_key.bcode | 3 - .../high_level_api/compressed_server_key.cbor | 3 - data/high_level_api.ron | 31 +++----- src/{data_0_9.rs => data_0_10.rs} | 30 +++++--- src/data_0_8.rs | 23 +----- src/generate.rs | 6 +- src/lib.rs | 22 +++--- src/main.rs | 4 +- 20 files changed, 103 insertions(+), 125 deletions(-) rename data/{0_9 => 0_10}/high_level_api/client_key.bcode (100%) rename data/{0_9 => 0_10}/high_level_api/client_key.cbor (100%) create mode 100644 data/0_10/high_level_api/compressed_server_key.bcode create mode 100644 data/0_10/high_level_api/compressed_server_key.cbor create mode 100644 data/0_10/high_level_api/server_key_with_compression.bcode create mode 100644 data/0_10/high_level_api/server_key_with_compression.cbor delete mode 100644 data/0_8/high_level_api/server_key.bcode delete mode 100644 data/0_8/high_level_api/server_key.cbor delete mode 100644 data/0_8/high_level_api/server_key_with_compression.bcode delete mode 100644 data/0_8/high_level_api/server_key_with_compression.cbor delete mode 100644 data/0_9/high_level_api/compressed_server_key.bcode delete mode 100644 data/0_9/high_level_api/compressed_server_key.cbor rename src/{data_0_9.rs => data_0_10.rs} (86%) diff --git a/Cargo.lock b/Cargo.lock index e58d90c..f34ba78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,7 +217,7 @@ dependencies = [ [[package]] name = "concrete-csprng" version = "0.4.1" -source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/refactor/use-natural-decomposition-order#4b5aceb2b2c401b3c9ffe504f3da4994381243a6" dependencies = [ "aes", "libc", @@ -430,15 +430,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.160" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "log" @@ -508,9 +508,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -618,22 +618,22 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -665,7 +665,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -681,9 +681,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -692,9 +692,9 @@ dependencies = [ [[package]] name = "tfhe" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4504375366bae25ff025c6bc19ee6272347121147581aa0fd36c7fc20ab6600" +checksum = "24199ea1c9bc7d9449c82908e0eddefd82501427e90550a594ea8fd1e20c7510" dependencies = [ "aligned-vec", "bincode", @@ -711,18 +711,18 @@ dependencies = [ "serde", "sha3", "tfhe-versionable 0.3.1", - "tfhe-zk-pok 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tfhe-zk-pok 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tfhe" -version = "0.9.0" -source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" +version = "0.10.0" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/refactor/use-natural-decomposition-order#4b5aceb2b2c401b3c9ffe504f3da4994381243a6" dependencies = [ "aligned-vec", "bincode", "bytemuck", - "concrete-csprng 0.4.1 (git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent)", + "concrete-csprng 0.4.1 (git+https://github.com/zama-ai/tfhe-rs/?branch=am/refactor/use-natural-decomposition-order)", "concrete-fft", "concrete-ntt", "dyn-stack", @@ -734,7 +734,7 @@ dependencies = [ "serde", "sha3", "tfhe-versionable 0.3.2", - "tfhe-zk-pok 0.3.0 (git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent)", + "tfhe-zk-pok 0.3.1 (git+https://github.com/zama-ai/tfhe-rs/?branch=am/refactor/use-natural-decomposition-order)", ] [[package]] @@ -814,8 +814,8 @@ dependencies = [ "semver", "serde", "strum", - "tfhe 0.8.4", - "tfhe 0.9.0", + "tfhe 0.10.0", + "tfhe 0.8.7", "tfhe-versionable 0.3.1", "tfhe-versionable 0.3.2", ] @@ -835,7 +835,7 @@ dependencies = [ [[package]] name = "tfhe-versionable" version = "0.3.2" -source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/refactor/use-natural-decomposition-order#4b5aceb2b2c401b3c9ffe504f3da4994381243a6" dependencies = [ "aligned-vec", "num-complex", @@ -851,24 +851,24 @@ checksum = "01d985f9645ed62be4aefb9c06ec70563291ec475036ebcd2cf95c5429a12e8a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "tfhe-versionable-derive" version = "0.3.2" -source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/refactor/use-natural-decomposition-order#4b5aceb2b2c401b3c9ffe504f3da4994381243a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "tfhe-zk-pok" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9978204def8b8549b8ed160b983071781726884f2bd9401eeebe951b997cb185" +checksum = "4e729c5020b72de76996496be235ba9e2b0d1629b8df4c881de9a67f587f32d5" dependencies = [ "num-bigint", "rand", @@ -885,8 +885,8 @@ dependencies = [ [[package]] name = "tfhe-zk-pok" -version = "0.3.0" -source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" +version = "0.3.1" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/refactor/use-natural-decomposition-order#4b5aceb2b2c401b3c9ffe504f3da4994381243a6" dependencies = [ "num-bigint", "rand", @@ -947,7 +947,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "wasm-bindgen-shared", ] @@ -969,7 +969,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -998,7 +998,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1018,5 +1018,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] diff --git a/Cargo.toml b/Cargo.toml index 43ebf4b..8e90093 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,17 +17,17 @@ tfhe_0_8 = { version = "0.8", features = [ "zk-pok", "experimental-force_fft_algo_dif4", ], package = "tfhe", optional = true } -tfhe_0_9 = { version = "0.9", features = [ +tfhe_0_10 = { version = "0.10", features = [ "boolean", "integer", "shortint", "x86_64-unix", "zk-pok", "experimental-force_fft_algo_dif4", -], package = "tfhe", optional = true, git = "https://github.com/zama-ai/tfhe-rs/", branch = "am/chore/make-ks-level-order-consistent" } +], package = "tfhe", optional = true, git = "https://github.com/zama-ai/tfhe-rs/", branch = "am/refactor/use-natural-decomposition-order" } tfhe_0_8-versionable = { version = "0.3", optional = true, package = "tfhe-versionable" } -tfhe_0_9-versionable = { version = "0.3", optional = true, package = "tfhe-versionable", git = "https://github.com/zama-ai/tfhe-rs/", branch = "am/chore/make-ks-level-order-consistent" } +tfhe_0_10-versionable = { version = "0.3", optional = true, package = "tfhe-versionable", git = "https://github.com/zama-ai/tfhe-rs/", branch = "am/refactor/use-natural-decomposition-order" } # other deps serde = { version = "1.0", features = ["derive"] } @@ -46,8 +46,8 @@ default = ["generate"] generate = [ "dep:tfhe_0_8", - "dep:tfhe_0_9", + "dep:tfhe_0_10", "dep:tfhe_0_8-versionable", - "dep:tfhe_0_9-versionable", + "dep:tfhe_0_10-versionable", ] load = ["dep:semver"] diff --git a/data/0_9/high_level_api/client_key.bcode b/data/0_10/high_level_api/client_key.bcode similarity index 100% rename from data/0_9/high_level_api/client_key.bcode rename to data/0_10/high_level_api/client_key.bcode diff --git a/data/0_9/high_level_api/client_key.cbor b/data/0_10/high_level_api/client_key.cbor similarity index 100% rename from data/0_9/high_level_api/client_key.cbor rename to data/0_10/high_level_api/client_key.cbor diff --git a/data/0_10/high_level_api/compressed_server_key.bcode b/data/0_10/high_level_api/compressed_server_key.bcode new file mode 100644 index 0000000..a1badfc --- /dev/null +++ b/data/0_10/high_level_api/compressed_server_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca23804965ad52b18c4c55e092c7f8fb9155d7118eff45bb5eaffa769d671a3a +size 79479387 diff --git a/data/0_10/high_level_api/compressed_server_key.cbor b/data/0_10/high_level_api/compressed_server_key.cbor new file mode 100644 index 0000000..bf29bf3 --- /dev/null +++ b/data/0_10/high_level_api/compressed_server_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fb66b429b3fc8bb722e5161b84aac0e71a528bd457089adafe4e527dc6a53ab +size 89414885 diff --git a/data/0_10/high_level_api/server_key_with_compression.bcode b/data/0_10/high_level_api/server_key_with_compression.bcode new file mode 100644 index 0000000..b11eba1 --- /dev/null +++ b/data/0_10/high_level_api/server_key_with_compression.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb1e0dd0d081b34f2819d216028777b26a38e161055bfd15d20b3d5e2ad5446e +size 281931995 diff --git a/data/0_10/high_level_api/server_key_with_compression.cbor b/data/0_10/high_level_api/server_key_with_compression.cbor new file mode 100644 index 0000000..ae09d2c --- /dev/null +++ b/data/0_10/high_level_api/server_key_with_compression.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6549ea09324d0d9cccee89b21eb85982fa1bf41cf21873fda78939f06e1613b +size 324955532 diff --git a/data/0_8/high_level_api/server_key.bcode b/data/0_8/high_level_api/server_key.bcode deleted file mode 100644 index b9f5254..0000000 --- a/data/0_8/high_level_api/server_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dcf12f83fbe7aed110dd9bcd8faf305927a0312a680b19dde99cdb7d8bfdac19 -size 130904055 diff --git a/data/0_8/high_level_api/server_key.cbor b/data/0_8/high_level_api/server_key.cbor deleted file mode 100644 index b67ab12..0000000 --- a/data/0_8/high_level_api/server_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9d92313a6f7020c2cce7529a9660a5f8ad56ee7cc97f649d414a9d214173beaa -size 150879193 diff --git a/data/0_8/high_level_api/server_key_with_compression.bcode b/data/0_8/high_level_api/server_key_with_compression.bcode deleted file mode 100644 index 89cdc0b..0000000 --- a/data/0_8/high_level_api/server_key_with_compression.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:37da58d8d27281c72d87f8b9b61c0db8d4bf01f5c447cc097f54227e666663f6 -size 281931995 diff --git a/data/0_8/high_level_api/server_key_with_compression.cbor b/data/0_8/high_level_api/server_key_with_compression.cbor deleted file mode 100644 index 802002a..0000000 --- a/data/0_8/high_level_api/server_key_with_compression.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4b43658dc031ec17ddc9e8bfffc81f3d8f99083d19a944c4c6558547f66b1099 -size 324955532 diff --git a/data/0_9/high_level_api/compressed_server_key.bcode b/data/0_9/high_level_api/compressed_server_key.bcode deleted file mode 100644 index f78ef58..0000000 --- a/data/0_9/high_level_api/compressed_server_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:28eef5a67971dfedd00b2173141574f859a766230aeb85fc7d7e0bbff729bc7b -size 79479387 diff --git a/data/0_9/high_level_api/compressed_server_key.cbor b/data/0_9/high_level_api/compressed_server_key.cbor deleted file mode 100644 index bfe178e..0000000 --- a/data/0_9/high_level_api/compressed_server_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e3a986bd2e8331094ae61284ae85c696ddab978994d8c5c193372c6a3a443c88 -size 89414885 diff --git a/data/high_level_api.ron b/data/high_level_api.ron index 221eaf5..cb13d4f 100644 --- a/data/high_level_api.ron +++ b/data/high_level_api.ron @@ -27,15 +27,6 @@ ), )), ), - ( - tfhe_version_min: "0.8", - tfhe_module: "high_level_api", - metadata: HlServerKey(( - test_filename: "server_key", - client_key_filename: "batch_1_client_key", - compressed: false, - )), - ), ( tfhe_version_min: "0.8", tfhe_module: "high_level_api", @@ -330,16 +321,7 @@ )), ), ( - tfhe_version_min: "0.8", - tfhe_module: "high_level_api", - metadata: HlServerKey(( - test_filename: "server_key_with_compression", - client_key_filename: "client_key_with_compression", - compressed: false, - )), - ), - ( - tfhe_version_min: "0.9", + tfhe_version_min: "0.10", tfhe_module: "high_level_api", metadata: HlClientKey(( test_filename: "client_key", @@ -367,7 +349,7 @@ )), ), ( - tfhe_version_min: "0.9", + tfhe_version_min: "0.10", tfhe_module: "high_level_api", metadata: HlServerKey(( test_filename: "compressed_server_key", @@ -375,4 +357,13 @@ compressed: true, )), ), + ( + tfhe_version_min: "0.10", + tfhe_module: "high_level_api", + metadata: HlServerKey(( + test_filename: "server_key_with_compression", + client_key_filename: "client_key.cbor", + compressed: false, + )), + ), ] \ No newline at end of file diff --git a/src/data_0_9.rs b/src/data_0_10.rs similarity index 86% rename from src/data_0_9.rs rename to src/data_0_10.rs index 46c2bbb..ca75907 100644 --- a/src/data_0_9.rs +++ b/src/data_0_10.rs @@ -1,5 +1,5 @@ use crate::generate::{ - store_versioned_test_tfhe_09, TfhersVersion, VALID_TEST_PARAMS_TUNIFORM, + store_versioned_test_tfhe_010, TfhersVersion, VALID_TEST_PARAMS_TUNIFORM, VALID_TEST_PARAMS_TUNIFORM_COMPRESSION, }; use crate::{ @@ -7,7 +7,7 @@ use crate::{ TestParameterSet, HL_MODULE_NAME, }; use std::{borrow::Cow, fs::create_dir_all}; -use tfhe_0_9::{ +use tfhe_0_10::{ boolean::engine::BooleanEngine, core_crypto::commons::generators::DeterministicSeeder, core_crypto::commons::math::random::ActivatedRandomGenerator, @@ -19,12 +19,12 @@ use tfhe_0_9::{ GlweDimension, LweDimension, MaxNoiseLevel, MessageModulus, PBSParameters, PolynomialSize, StandardDev, }, - ClientKey, CompressedServerKey, Seed, + CompressedServerKey, Seed, }; macro_rules! store_versioned_test { ($msg:expr, $dir:expr, $test_filename:expr $(,)? ) => { - store_versioned_test_tfhe_09($msg, $dir, $test_filename) + store_versioned_test_tfhe_010($msg, $dir, $test_filename) }; } @@ -114,10 +114,16 @@ const HL_COMPRESSED_SERVERKEY_TEST: HlServerKeyTest = HlServerKeyTest { compressed: true, }; -pub struct V0_9; +const HL_SERVERKEY_WITH_COMPRESSION_TEST: HlServerKeyTest = HlServerKeyTest { + test_filename: Cow::Borrowed("server_key_with_compression"), + client_key_filename: Cow::Borrowed("client_key.cbor"), + compressed: false, +}; + +pub struct V0_10; -impl TfhersVersion for V0_9 { - const VERSION_NUMBER: &'static str = "0.9"; +impl TfhersVersion for V0_10 { + const VERSION_NUMBER: &'static str = "0.10"; fn seed_prng(seed: u128) { let mut seeder = DeterministicSeeder::::new(Seed(seed)); @@ -138,10 +144,10 @@ impl TfhersVersion for V0_9 { let dir = Self::data_dir().join(HL_MODULE_NAME); create_dir_all(&dir).unwrap(); - let config = tfhe_0_9::ConfigBuilder::with_custom_parameters(HL_CLIENTKEY_TEST.parameters) + let config = tfhe_0_10::ConfigBuilder::with_custom_parameters(HL_CLIENTKEY_TEST.parameters) .enable_compression(VALID_TEST_PARAMS_TUNIFORM_COMPRESSION.into()) .build(); - let hl_client_key = ClientKey::generate(config); + let (hl_client_key, hl_server_key) = tfhe_0_10::generate_keys(config); let compressed_server_key = CompressedServerKey::new(&hl_client_key); store_versioned_test!(&hl_client_key, &dir, &HL_CLIENTKEY_TEST.test_filename); @@ -150,10 +156,16 @@ impl TfhersVersion for V0_9 { &dir, &HL_COMPRESSED_SERVERKEY_TEST.test_filename, ); + store_versioned_test!( + &hl_server_key, + &dir, + &HL_SERVERKEY_WITH_COMPRESSION_TEST.test_filename, + ); vec![ TestMetadata::HlClientKey(HL_CLIENTKEY_TEST), TestMetadata::HlServerKey(HL_COMPRESSED_SERVERKEY_TEST), + TestMetadata::HlServerKey(HL_SERVERKEY_WITH_COMPRESSION_TEST), ] } } diff --git a/src/data_0_8.rs b/src/data_0_8.rs index 3a64d34..41a2fa6 100644 --- a/src/data_0_8.rs +++ b/src/data_0_8.rs @@ -32,7 +32,7 @@ use crate::{ VALID_TEST_PARAMS_TUNIFORM_COMPRESSION, }, DataKind, HlBoolCiphertextTest, HlCiphertextTest, HlClientKeyTest, - HlHeterogeneousCiphertextListTest, HlPublicKeyTest, HlServerKeyTest, HlSignedCiphertextTest, + HlHeterogeneousCiphertextListTest, HlPublicKeyTest, HlSignedCiphertextTest, PkeZkProofAuxilliaryInfo, ShortintCiphertextTest, ShortintClientKeyTest, TestCompressionParameterSet, TestDistribution, TestMetadata, TestParameterSet, ZkPkePublicParamsTest, HL_MODULE_NAME, SHORTINT_MODULE_NAME, @@ -153,12 +153,6 @@ const HL_CLIENTKEY_TEST: HlClientKeyTest = HlClientKeyTest { parameters: VALID_TEST_PARAMS_TUNIFORM, }; -const HL_SERVERKEY_TEST: HlServerKeyTest = HlServerKeyTest { - test_filename: Cow::Borrowed("server_key"), - client_key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), - compressed: false, -}; - // We use a client key with specific parmeters for the pubkey since it can be very large const HL_LEGACY_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { test_filename: Cow::Borrowed("legacy_public_key"), @@ -356,12 +350,6 @@ const HL_CLIENTKEY_WITH_COMPRESSION_TEST: HlClientKeyTest = HlClientKeyTest { parameters: VALID_TEST_PARAMS_TUNIFORM, }; -const HL_SERVERKEY_WITH_COMPRESSION_TEST: HlServerKeyTest = HlServerKeyTest { - test_filename: Cow::Borrowed("server_key_with_compression"), - client_key_filename: Cow::Borrowed(HL_CLIENT_W_COMP_KEY_BATCH_2_FILENAME), - compressed: false, -}; - pub struct V0_8; impl TfhersVersion for V0_8 { @@ -431,7 +419,6 @@ impl TfhersVersion for V0_8 { store_versioned_test!(&hl_client_key, &dir, &HL_CLIENTKEY_TEST.test_filename); - store_versioned_test!(&hl_server_key, &dir, &HL_SERVERKEY_TEST.test_filename); store_versioned_test!(&pub_key, &dir, &HL_LEGACY_PUBKEY_TEST.test_filename); store_versioned_auxiliary!( &client_key_for_pk, @@ -540,7 +527,6 @@ impl TfhersVersion for V0_8 { let test_batch_1 = [ TestMetadata::HlClientKey(HL_CLIENTKEY_TEST), - TestMetadata::HlServerKey(HL_SERVERKEY_TEST), TestMetadata::HlPublicKey(HL_LEGACY_PUBKEY_TEST), TestMetadata::HlPublicKey(HL_COMPRESSED_LEGACY_PUBKEY_TEST), TestMetadata::HlPublicKey(HL_COMPACT_PUBKEY_TEST), @@ -681,12 +667,6 @@ impl TfhersVersion for V0_8 { &HL_CLIENTKEY_WITH_COMPRESSION_TEST.test_filename, ); - store_versioned_test!( - &hl_server_key, - &dir, - &HL_SERVERKEY_WITH_COMPRESSION_TEST.test_filename, - ); - let test_batch_2 = [ TestMetadata::HlHeterogeneousCiphertextList(HL_COMPACTLIST_TEST), TestMetadata::HlHeterogeneousCiphertextList(HL_PACKED_COMPACTLIST_TEST), @@ -694,7 +674,6 @@ impl TfhersVersion for V0_8 { TestMetadata::HlHeterogeneousCiphertextList(HL_PROVEN_COMPACTLIST_TEST), TestMetadata::ZkPkePublicParams(ZK_PKE_PUBLIC_PARAMS_TEST), TestMetadata::HlClientKey(HL_CLIENTKEY_WITH_COMPRESSION_TEST), - TestMetadata::HlServerKey(HL_SERVERKEY_WITH_COMPRESSION_TEST), ]; all_tests.extend(test_batch_2); diff --git a/src/generate.rs b/src/generate.rs index 212a79c..6a74b7a 100644 --- a/src/generate.rs +++ b/src/generate.rs @@ -6,8 +6,8 @@ use std::{ use bincode::Options; use serde::Serialize; +use tfhe_0_10_versionable::Versionize as VersionizeTfhe010; use tfhe_0_8_versionable::Versionize as VersionizeTfhe08; -use tfhe_0_9_versionable::Versionize as VersionizeTfhe09; use crate::{ data_dir, dir_for_version, TestCompressionParameterSet, TestDistribution, TestMetadata, @@ -162,7 +162,7 @@ macro_rules! define_store_versioned_test_fn { }; } define_store_versioned_test_fn!(store_versioned_test_tfhe_08, VersionizeTfhe08); -define_store_versioned_test_fn!(store_versioned_test_tfhe_09, VersionizeTfhe09); +define_store_versioned_test_fn!(store_versioned_test_tfhe_010, VersionizeTfhe010); /// Stores the auxiliary data in `dir`, encoded in cbor, using the right tfhe-versionable version macro_rules! define_store_versioned_auxiliary_fn { @@ -181,7 +181,7 @@ macro_rules! define_store_versioned_auxiliary_fn { }; } define_store_versioned_auxiliary_fn!(store_versioned_auxiliary_tfhe_08, VersionizeTfhe08); -define_store_versioned_auxiliary_fn!(store_versioned_auxiliary_tfhe_09, VersionizeTfhe09); +define_store_versioned_auxiliary_fn!(store_versioned_auxiliary_tfhe_010, VersionizeTfhe010); pub fn store_metadata>(value: &Meta, path: P) { let serialized = ron::ser::to_string_pretty(value, ron::ser::PrettyConfig::default()).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 04e7f99..d9ec1d4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,9 +13,9 @@ use strum::Display; use serde::{Deserialize, Serialize}; #[cfg(feature = "generate")] -pub mod data_0_8; +pub mod data_0_10; #[cfg(feature = "generate")] -pub mod data_0_9; +pub mod data_0_8; #[cfg(feature = "generate")] pub mod generate; #[cfg(feature = "load")] @@ -27,10 +27,11 @@ pub const SHORTINT_MODULE_NAME: &str = "shortint"; pub const HL_MODULE_NAME: &str = "high_level_api"; pub const ZK_MODULE_NAME: &str = "zk"; -/// This struct re-defines tfhe-rs parameter sets but this allows to be independant -/// of changes made into the ParameterSet of tfhe-rs. The idea here is to define a type -/// that is able to carry the information of the used parameters without using any tfhe-rs -/// types. +/// This struct re-defines tfhe-rs parameter sets but this allows to be independant of changes made +/// into the ParameterSet of tfhe-rs. +/// +/// The idea here is to define a type that is able to carry the information of the used parameters +/// without using any tfhe-rs types. #[derive(Serialize, Deserialize, Clone, Debug)] pub struct TestParameterSet { pub lwe_dimension: usize, @@ -50,10 +51,11 @@ pub struct TestParameterSet { pub encryption_key_choice: Cow<'static, str>, } -/// This struct re-defines tfhe-rs compression parameter sets but this allows to be independant -/// of changes made into the ParameterSet of tfhe-rs. The idea here is to define a type -/// that is able to carry the information of the used parameters without using any tfhe-rs -/// types. +/// This struct re-defines tfhe-rs compression parameter sets but this allows to be independant of +/// changes made into the ParameterSet of tfhe-rs. +/// +/// The idea here is to define a type that is able to carry the information of the used parameters +/// without using any tfhe-rs types. #[derive(Serialize, Deserialize, Clone, Debug)] pub struct TestCompressionParameterSet { pub br_level: usize, diff --git a/src/main.rs b/src/main.rs index b910aa9..6ab78aa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use std::fs::remove_dir_all; use tfhe_backward_compat_data::{ + data_0_10::V0_10, data_0_8::V0_8, - data_0_9::V0_9, data_dir, generate::{store_metadata, TfhersVersion, PRNG_SEED}, Testcase, HL_MODULE_NAME, SHORTINT_MODULE_NAME, @@ -38,7 +38,7 @@ fn main() { remove_dir_all(&data_dir_path).unwrap(); let mut testcases = gen_all_data::(); - testcases.extend(gen_all_data::()); + testcases.extend(gen_all_data::()); let shortint_testcases: Vec = testcases .iter()