Skip to content

Commit

Permalink
Support Go garbage-collected ciphertexts (ethereum#34)
Browse files Browse the repository at this point in the history
Optimize cgo <-> tfhe-rs performance by:
 * not deserializing the server key on every operation
 * not serializing/deserializing the ciphertexts on every operation
 * making sure a ciphertext is serialized/deserialized at most once
 * not copying bytes when passing them from Go to C
 * caching cihpertext serialization and hash for later uses

Keep pointers to C-allocated ciphertexts in the `verifiedCiphertexts`
EVM variable instead of their serialization. Hook these C-allocated
ciphertexts to the gargage collector by utilizing `setFinalizer()`.

Run the GC based periodically, based on number of allocated
ciphertexts.

Add an unit test for `tfhe.go`.
  • Loading branch information
dartdart26 authored Jan 31, 2023
1 parent a19532e commit 6dc797f
Show file tree
Hide file tree
Showing 6 changed files with 527 additions and 418 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ profile.cov
**/yarn-error.log

# TFHE
core/vm/tfhe*
core/vm/tfhe.h
core/vm/lib/libtfhe*
Loading

0 comments on commit 6dc797f

Please sign in to comment.