forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for compact pub keys and ciphertexts (ethereum#108)
The public key `pks` is now a `CompactPublicKey` in tfhe-rs terminology. For inputs, we use compact lists from tfhe-rs. Essentially, transaction inputs are serialized tfhe-rs compact lists. In the verifyCiphertext precompile, we deserialize the list and then expand it to a normal ciphertext. From that point on, nothing changes and we compute on and persist expanded ciphertexts. Ciphertexts in protected storage are not compact and are always persisted in their expanded form. Use trivial encryption to determine expanded ciphertext size at startup. Remove secret key encryption in tfhe_test.go - instead, only use public key encryption. The `pks` key is expected to always be available to the node. We will use that later for serving it to clients (potentially over a special precompile for that purpose). Add tests for the verifyCiphertext precompile. Note: As of now, we cannot detect arbitrary ciphertexts during deserialization time. Therefore, verifyCiphertext might or might not fail and might produce random ciphertexts. Will work on that separately. Generate keys using the zbc-fhe-tool. Remove "random" tfheCiphertexts and, instead, always use public key encryption during gas estimation. Rationale is that this ensures valid ciphertexts in all code paths and it also ensures the actual ciphertext is random-looking bytes. Always persists ciphertexts in protected storage during opSstore, even if the Commit flag is not set. Reason is that we want the same code paths during gas estimation and actual transaction. If we skip persisting, opSload will behave differently on gas estimation and transactions. Do not skip ciphertext verification on verifyCiphertext when the Commit flag is not set. Rationale is, again, that we want the same code path for gas estimation and transactions.
- Loading branch information
1 parent
db57ed7
commit 1bdc776
Showing
8 changed files
with
575 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.