Skip to content
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/test/pr close #16

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 43 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ edition = "2021"
tfhe_0_6 = { version = "0.6", features = ["boolean", "integer", "shortint", "x86_64-unix", "experimental-force_fft_algo_dif4"], package = "tfhe", optional = true }
tfhe_0_7 = { version = "0.7", features = ["boolean", "integer", "shortint", "x86_64-unix", "experimental-force_fft_algo_dif4"], package = "tfhe", optional = true }

tfhe-versionable = { version = "0.1", optional = true }
tfhe-versionable_0_1 = { version = "0.1", optional = true, package = "tfhe-versionable" }
tfhe-versionable_0_2 = { version = "0.2", optional = true, package = "tfhe-versionable" }

# other deps
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -29,5 +30,5 @@ required-features = ["generate"]
[features]
default = ["generate"]

generate = ["dep:tfhe_0_6", "dep:tfhe_0_7", "dep:tfhe-versionable"]
generate = ["dep:tfhe_0_6", "dep:tfhe_0_7", "dep:tfhe-versionable_0_1", "dep:tfhe-versionable_0_2"]
load = ["dep:semver"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# tfhe-rs backwards compatibility test corpus
TEST
This repo contains various messages from [TFHE-rs](https://github.com/zama-ai/tfhe-rs) that have been versioned and serialized.
The goal is to detect in TFHE-rs CI when the version of a type should be updated because a breaking change has been added.

Expand Down Expand Up @@ -26,7 +27,7 @@ Any commits to `main` should be backported to the latest version branch.
To re-generate the data, run the binary target for this project: `cargo run --release`. The prng is seeded with a fixed seed, so the data should be identical.

# Adding a test for an existing type
To add a new test for a type that is already tested, you need to create a const global variable with the metadata for that test. The type of metadata depends on the type being tested (for example, the metadata for a test of the `ClientKey' from the `high_level_api' is `HlClientKEy'). Then go to the `data_vvv.rs` file (where "vvv" is the TFHE-rs version of the tested data) and update the `gen_xxx_data` method (where "xxx" is the API layer of your test (hl, shortint, integer,...)). In this method, create the object you want to test and serialize it using the `store_versioned_test` method. Add the metadata of your test to the vector returned by this method.
To add a new test for a type that is already tested, you need to create a const global variable with the metadata for that test. The type of metadata depends on the type being tested (for example, the metadata for a test of the `ClientKey' from the `high_level_api' is `HlClientKEy'). Then go to the `data_vvv.rs` file (where "vvv" is the TFHE-rs version of the tested data) and update the `gen_xxx_data` method (where "xxx" is the API layer of your test (hl, shortint, integer,...)). In this method, create the object you want to test and serialize it using the `store_versioned_test` macro. Add the metadata of your test to the vector returned by this method.

The test will be automatically selected when you run TFHE-rs `make test_backward_compatibility`.

Expand Down Expand Up @@ -55,7 +56,7 @@ impl TfhersVersion for V0_6 {
let ct1 = fheint8::encrypt(HL_CT1_TEST.clear_value, &hl_client_key);

// 3. Store it
store_versioned_test(&ct1, &dir, &HL_CT1_TEST.test_filename);
store_versioned_test!(&ct1, &dir, &HL_CT1_TEST.test_filename);

// 4. Return the metadata
vec![
Expand Down
3 changes: 3 additions & 0 deletions data/0_7/high_level_api/client_key.cbor
Git LFS file not shown
3 changes: 0 additions & 3 deletions data/0_7/high_level_api/client_key.cbor.bcode

This file was deleted.

3 changes: 0 additions & 3 deletions data/0_7/high_level_api/client_key.cbor.cbor

This file was deleted.

Git LFS file not shown
3 changes: 3 additions & 0 deletions data/0_7/high_level_api/hl_compressed_heterogeneous_list.cbor
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/0_7/high_level_api/hl_heterogeneous_list.bcode
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/0_7/high_level_api/hl_heterogeneous_list.cbor
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/0_7/high_level_api/hl_packed_heterogeneous_list.bcode
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/0_7/high_level_api/hl_packed_heterogeneous_list.cbor
Git LFS file not shown
21 changes: 21 additions & 0 deletions data/high_level_api.ron
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,25 @@
],
)),
),
(
tfhe_version_min: "0.7",
tfhe_module: "high_level_api",
metadata: HlHeterogeneousCiphertextList((
test_filename: "hl_compressed_heterogeneous_list",
key_filename: "client_key.cbor",
compressed: true,
clear_values: [
17,
18446744073709551604,
0,
1,
],
data_kinds: [
Unsigned,
Signed,
Bool,
Bool,
],
)),
),
]
Loading