Skip to content

Commit

Permalink
Handle errors from tfhe-rs (ethereum#135)
Browse files Browse the repository at this point in the history
Overall strategy is:
 * we assume operations on well-formed ciphertexts don't fail
 * for operations we assume shouldn't fail, we use asserts
 * for operations that we assume can fail, we use return codes

Essentially, allowing malformed ciphertexts from txns means these ops
could fail at some point in the lifetime of a cihpertext and/or on
ciphertexts that are produced from the original one:
 * deserialization or ciphertexts
 * decrypt
 * any FHE operation
 * serialization

We assume the following ops don't fail if all inputs are well-formed:
 * deser of FHE keys
 * encryption

We also assume that tfhe-rs failures are always deterministic. That
allows us to not stop the node on such a failure and assume that all
nodes have the same behaviour, leaving nodes in sync.

Also, do not use Go finalizers anymore. Instead, ser/deser ciphertexts
across the C/Go boundary. That avoids complications with finalizers and
memory management. However, it has a performance overhead and we need to
be extra careful that we free all C memory manually.
  • Loading branch information
dartdart26 authored Jun 30, 2023
1 parent 12e6610 commit 364286e
Show file tree
Hide file tree
Showing 6 changed files with 1,157 additions and 1,160 deletions.
Loading

0 comments on commit 364286e

Please sign in to comment.