-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(engine)!: add Elgamal verifiable encryption (optional view key) …
…support (#976) Description --- feat(engine)!: add Elgamal verifiable encryption (optional view key) support feat: implement brute force value decryption for confidential outputs using secret view key refactor: move confidential wallet crypto into new crate refactor(wallet/sdk): use wallet crypto crate refactor(test tooling): use wallet crypto crate tests(engine): new test checking confidential transfers with a view key enabled tests(wallet/crypto): checks that proof generation, verification and decryption are valid feat(engine): add simple interface for value lookup table Motivation and Context --- Allow a template author to specify a view key on confidential resources optionally. This allows anyone with the secret key to uncover the balance of commitments generated for the resource. ```rust let coins = ResourceBuilder::confidential() .initial_supply(confidential_proof) .with_view_key(view_key) .build_bucket(); ``` Wallets MUST generate a ViewableBalanceProof for all confidential outputs for the resource, allowing validators to verify that the encrypted balance was generated correctly without revealing the balance. All confidential crypto was duplicated in the test tooling and wallet SDK. Since duplicating the Elgamal verifiable encryption scheme could lead to issues down the road, or is just plain ugly, this PR puts all confidential crypto into a crate that is used by the test tooling and wallet SDK. A value lookup table is passed into the brute force function. A production implementation of may make use of the binary file provided by the new generate_ristretto_value_lookup bin crate to return canonical (compressed) bytes for a value. The implementation can optimise for sequential reads and a low memory footprint. A binary file containing 1 billion entries (assuming 6 decimals, whole values from 0 - 1000) will be 32 x 1B in size (32Gb). A future PR will add wallet support for attempting to reveal the balance of vaults. How Has This Been Tested? --- New unit tests What process can a PR reviewer use to test or verify this change? --- Create a template using the view key in a resource. Check transfers work as before. Fetch the commitments from a vault and reveal the balance (this is a manual process currently without wallet support) Breaking Changes --- - [ ] None - [ ] Requires data directory to be deleted - [x] Other - Please specify BREAKING CHANGES: added field to resource create args, meaning any template using this would need to be recompiled.
- Loading branch information
Showing
67 changed files
with
1,843 additions
and
616 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.