-
Notifications
You must be signed in to change notification settings - Fork 152
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
feat(wasm): bind CompactListExpander::get_kind_of #1496
Conversation
And other things to allow wasm users to explore what kind of data is stored in the compact list.
Technically, the get_kind_of API could be implemented on the This would allow users to chek the data kinds at each slot before having to expand or verify the zk proof, is it something that we want to have ? |
For BC we need to be able to do it without expanding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed it would likely be better to be able to call those functions on the objects themselves as the issue is to be able to fetch metadata without expanding (as if there is packing currently it's not possible to run PBSes in wasm to unpack the blocks)
This adds the ability to query the length and types contained in a CompactCiphertextList and ProvenCompactCiphertextList without having to expand or verify the proof(s)
pub fn get_kind_of(&self, index: usize) -> Option<crate::FheTypes> { | ||
self.0.get_kind_of(index).and_then(|data_kind| { | ||
crate::FheTypes::from_data_kind(data_kind, self.0.ct_list.message_modulus) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not work for packed lists ? the modulus would be message_modulus * carry_modulus ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it work because the metada is metadata, it does not care whether the actual block are packed or not
The integer metadata keeps the bool or signed/unsigned kind with the number of blocks of the original input, the hlapi list just require the message modulus to be able to know how many bits a block encrypts to then be able to translate a num blocks in a num bits
damn it may not be possible to properly return the data kind without expansion if we have a block ending at a boundary in a ciphertext when things are packed ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarifications !
The test of get_kind_of used on ProvenCompactCiphertextList (which iirc is packed) should prove that things are ok even when data is packed |
And other things to allow wasm users to explore
what kind of data is stored in the compact list.