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

Full propa test #621

Merged
merged 2 commits into from
Oct 16, 2023
Merged

Full propa test #621

merged 2 commits into from
Oct 16, 2023

Conversation

tmontaigu
Copy link
Contributor

Check-list:

  • Tests for the changes have been added (for bug fixes / features)
    5

@cla-bot cla-bot bot added the cla-signed label Oct 10, 2023
@github-actions
Copy link

@slab-ci cpu_fast_test

@github-actions
Copy link

@slab-ci cpu_fast_test

@github-actions
Copy link

@slab-ci cpu_fast_test

@tmontaigu tmontaigu requested a review from IceTDrinker October 11, 2023 15:17
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.

Will check the expected built by hand tomorrow some small comments

);
}

if block_carry_mod == block_msg_mod {
Copy link
Member

Choose a reason for hiding this comment

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

block_carry_mod >= block_msg_mod ? I don't know if we have such parameters though

Copy link
Contributor Author

@tmontaigu tmontaigu Oct 12, 2023

Choose a reason for hiding this comment

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

We have for shortints, but we don't use them in integers.

In integers params needs as many carry bit as message bits to have all operations
But if their are more carry bits than message bits, then we would need 2 full_propagation to actually fully propagate.

Copy link
Member

Choose a reason for hiding this comment

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

ok so this is correct with our current implementation of full propagate for integers right ?

Copy link
Contributor Author

@tmontaigu tmontaigu Oct 12, 2023

Choose a reason for hiding this comment

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

Ok Finally plugged my brain,

So using params where block_carry_mod >= block_msg_mod, the full_propagations (both sequential and parallel)
will correctly work, so as long as the block has enough space to receive the carry of the next block.
Which is what is_thing_possible were reworked to ensure (there is probably some is_scalar_thing_possible left to update).

What confused me, is that the parallel carry propagation also works by default even in the case where the whole block is completely full.

For example, in 2_2, the sequential propagation requires that there is enough room to receive worst case carry of preceding block, so max degree is 15 - 3 = 12. Using the parallel algorithm we can propagate carries where blocks
have a degree of 15 (ie degree == max_degree), however that's only true if carry_modulus <= message_modulus.

Parallel propagation could be improved to support the case where carry_modulus > message_modulus and we sum until degree = (message_modulus * message_modulus)- 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm adding PARAM_MESAGE_2_CARRY_3 in the instanciated tests

Copy link
Member

Choose a reason for hiding this comment

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

ok !

assert!(ct
.blocks
.iter()
.all(|b| b.degree.0 as u64 == (block_total_mod - 1) - (block_msg_mod - 1)),);
Copy link
Member

Choose a reason for hiding this comment

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

- (block_carry_mod -1) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I think (block_carry_mod -1) is the correct thing if we want to take into account block_carry_mod >= block_msg_mod, but then In that case our full_propagate won't be a real full_propagate and so this test won't be correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about that, need to think about it 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok so in the case where params are such that block_carry_mod > block_msg_mod, the sequential propagation is fine as long as is_op_possible do proper checks.

The parallel carry propagation would require to be adapted to support that case

Copy link
Member

Choose a reason for hiding this comment

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

feel free to open follow up issues

@IceTDrinker
Copy link
Member

looks good, just the minor comments for which I may be wrong

@github-actions
Copy link

@slab-ci cpu_fast_test

@tmontaigu tmontaigu requested a review from IceTDrinker October 12, 2023 14:33
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 ! Looks good !

@github-actions
Copy link

Pull Request has been approved 🎉
Launching full test suite...
@slab-ci cpu_test
@slab-ci cpu_integer_test
@slab-ci cpu_multi_bit_test
@slab-ci cpu_wasm_test
@slab-ci csprng_randomness_testing

@tmontaigu
Copy link
Contributor Author

@slab-ci cpu_test

@tmontaigu
Copy link
Contributor Author

@slab-ci cpu_integer_test

@tmontaigu tmontaigu marked this pull request as draft October 13, 2023 08:13
@github-actions github-actions bot removed the approved label Oct 13, 2023
@github-actions
Copy link

@slab-ci cpu_fast_test

@tmontaigu tmontaigu marked this pull request as ready for review October 13, 2023 10:17
@tmontaigu tmontaigu requested a review from IceTDrinker October 13, 2023 10:17
@tmontaigu
Copy link
Contributor Author

Realized that the test was not meaningful as it did not check manually each block to verify its value (e.g no carry after propagation). Checking the result of the decryption is not a complete check, because decrypting propagtes carries, so an implemenation that did nothing would pass the tests

@github-actions
Copy link

@slab-ci cpu_fast_test

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.

Looks good, and good catch on decryption doing the propagate automatically

@github-actions
Copy link

Pull Request has been approved 🎉
Launching full test suite...
@slab-ci cpu_test
@slab-ci cpu_integer_test
@slab-ci cpu_multi_bit_test
@slab-ci cpu_wasm_test
@slab-ci csprng_randomness_testing

@tmontaigu
Copy link
Contributor Author

@slab-ci cpu_integer_test

1 similar comment
@IceTDrinker
Copy link
Member

@slab-ci cpu_integer_test

@tmontaigu tmontaigu merged commit 6d77ff1 into main Oct 16, 2023
18 of 19 checks passed
@tmontaigu tmontaigu deleted the full-propa-test branch October 16, 2023 12:11
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.

2 participants