-
Notifications
You must be signed in to change notification settings - Fork 12
Description
We are using openfhe-rs generated binding in our rust repo. Specifically, we work with this fork of your repo which is the subject of this PR -> #14
We are running tests to assert the correctness of the decomposition operation on a newly sampled matrix (either from binary or uniform distribution). Under the hood, the matrix stores polynomials of type std::unique_ptr<DCRTPoly> binded from your library. Similarly, the arithmetic operations over such matrices are based on arithmetic operations using openfhe-rs bindings. Other bindings (such as trapdoor or matrix) are not involved in the tested functionality.
By running the following command cargo test --package diamond_io --lib poly::dcrt::sampler::hash -- --nocapture on this branch you will see the 4 tests pass. In this scenario, each of the four test instance generates new parameters using the default function let params = DCRTPolyParams::default() such that n = 16, size = 4, k_res=51 (note that such parameters are taken from here -> https://github.com/openfheorg/openfhe-development/blob/7b8346f4eac27121543e36c17237b919e03ec058/src/core/unittest/UnitTestTrapdoor.cpp#L315-L318)
As soon as we modify one of the test (https://github.com/MachinaIO/diamond-io/blob/bug/src/poly/dcrt/sampler/hash.rs#L233) to generate params using a different n (for example n=32) the test for test_bitdecomposition_hash_sampler_ring fails.
Notably, the same individual test passes when run individually with cargo test poly::dcrt::sampler::hash::tests::test_bitdecomposition_hash_sampler_ring with any of the parameter combinations. This made us think that somehow the params get inadvertently shared between different test instances. Note that the our parameter definition doesn't store any pointer to cpp. Instead we only share with the cpp code the input necessary to generate the parameters and build them on the fly in cpp, whenever we need them.
Have you ever had similar issues before? Do you have any suggestion to further debug the issue?
Thanks