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

chore(all): use destructuring in conformance #1449

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

mayeul-zama
Copy link
Contributor

No description provided.

@cla-bot cla-bot bot added the cla-signed label Aug 2, 2024
Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, some comments

@@ -25,11 +25,18 @@ impl<T: UnsignedInteger> ParameterSetConformant for SeededLweCiphertext<T> {
type ParameterSet = LweCiphertextParameters<T>;

fn is_conformant(&self, lwe_ct_parameters: &LweCiphertextParameters<T>) -> bool {
let Self {
data: _,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to ignore, change the from_ref below to use that scalar

@@ -761,9 +761,14 @@ where
type ParameterSet = LweCiphertextParameters<C::Element>;

fn is_conformant(&self, lwe_ct_parameters: &LweCiphertextParameters<C::Element>) -> bool {
let Self {
data: _,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not ignore data and replace self in the check encrypted_content_respects_mod by data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 654 to 655
== glwe_ct_parameters.glwe_dim.to_glwe_size().0
* glwe_ct_parameters.polynomial_size.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if need be there should be a primitive that compute the glwe ciphertext size given a size/dim and a polynomial size

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines 53 to 56
&& modulus_switched_glwe_ciphertext_list.iter().all(|glwe| {
glwe.glwe_dimension() == params.ct_params.glwe_dim
&& glwe.polynomial_size() == params.ct_params.polynomial_size
&& glwe.uncompressed_ciphertext_modulus() == params.ct_params.ct_modulus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we forward the conformance check to glwe.is_conformant maybe ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

carry_modulus,
pbs_order,
lwe_per_glwe,
count: _,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

count ignored ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now checked

@mayeul-zama mayeul-zama force-pushed the mz/destruct_conformance branch 2 times, most recently from 2bfa6ee to 88239f0 Compare August 22, 2024 07:30
Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small remark about the size primitive

Comment on lines 109 to 112

pub const fn to_glwe_ct_size(self, poly_size: PolynomialSize) -> usize {
self.0 * poly_size.0
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glwe_ciphertext_size already exists as a free standing function in tfhe/src/core_crypto/entities/glwe_ciphertext.rs

Comment on lines 654 to 657
== glwe_ct_parameters
.glwe_dim
.to_glwe_size()
.to_glwe_ct_size(glwe_ct_parameters.polynomial_size)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glwe_ciphertext_size

@mayeul-zama mayeul-zama force-pushed the mz/destruct_conformance branch from 88239f0 to 5cdc80f Compare August 23, 2024 11:31
Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! This looks good and will be more robust to structure changes !

@IceTDrinker
Copy link
Member

looks like some auto imports do not work

@mayeul-zama mayeul-zama force-pushed the mz/destruct_conformance branch from 5cdc80f to e6bec08 Compare August 23, 2024 12:21
@zama-bot zama-bot removed the approved label Aug 23, 2024
@mayeul-zama mayeul-zama merged commit 11a8f97 into main Aug 26, 2024
86 of 87 checks passed
@mayeul-zama mayeul-zama deleted the mz/destruct_conformance branch August 26, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants