fix(tfhe): add automatic initialization for ciphertexts #72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes the following incorrect logic of some binary operators:
and introduces initialization logic such that if a
0
handle is passed to any binary operator, the handle is set to point to the trivial encryption of0
.This makes it so that FHE operations on uninitialized ciphertexts do not revert, even in the case of ciphertext/plaintext operations.
This PR also introduces a fix for a bug regarding ciphertext/plaintext operations and Solidity's overload resolution.
With this fix, ciphertext/plaintext operations are only defined for values of the same bit width, meaning
add(euint32 a, uint32 b)
is defined butadd(euint16 a, uint32 b)
is not.It is worth noting that the overload resolution process will implicitely upcast the
uint
value such that bothwill work but
will not.