forked from zcash/orchard
-
Notifications
You must be signed in to change notification settings - Fork 0
V3 encryption #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
V3 encryption #38
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
9dd7ff7
Circleci project setup (#1)
PaulLaux 29c4f09
issuer keys implementation (#5)
daniben31 86abc31
Added NoteType to Notes (#2)
PaulLaux ff25221
ZSA note encryption in Orchard crate (#3)
naure 5486099
Zsa builder (#4)
PaulLaux 3ce74b2
Issuance (#12)
PaulLaux 5312b03
E2E tests for issuance (#20)
alexeykoren c48d354
disabled split notes (#22)
PaulLaux 1a1459a
Review fixes (#23)
PaulLaux 7b6b6ac
Review fixes2 (#24)
PaulLaux ee069b4
verify_issue_bundle() cleanup (#25)
PaulLaux fc5df36
updating Cargo.toml to point to appropriate librustzcash patch
vivek-arte 80b2689
orchard crate updated to build with updated librustzcash - tests stil…
vivek-arte 32b90f8
edits to test sections
vivek-arte 1f34308
changes based on reviewed changes in zcash_note_encryption
vivek-arte ea8bcb2
adding zcash_note_encryption to orchard crate for better parallel upd…
vivek-arte 5666246
using ? operator in place of match
vivek-arte 577e920
removing duplicate AEAD_TAG_SIZE definition
vivek-arte 2398891
fixing clippy errors
vivek-arte 569df61
refactoring names of NotePlaintext, EncNoteCiphertext, and versions t…
vivek-arte 3eb1614
refactoring to rename ZSA-specific constants as '.._ZSA'
vivek-arte f6da6a5
fixing tests to work with V3 notes, plus rust-fmt
vivek-arte b2ba44b
updating to use &CompactNote instead of &[u8]
vivek-arte 1cf2a2c
updating Rust to 1.61.0 to pass Clippy tests
vivek-arte f47c098
further Rustfmt fixes
vivek-arte 64407d2
fixing Clippy error
vivek-arte 914f4e9
updating the bundle commitments to include asset ID personalization
vivek-arte 9f30147
fixing Rustfmt errors
vivek-arte 1ce300a
updated names for constants
PaulLaux 4721bdd
updated naming
PaulLaux 28e3cde
added Bytes(v1)
PaulLaux ffa4921
minor update
PaulLaux 0660370
removed From<(Self::NotePlaintextBytes, AEADBytes)>
PaulLaux 80892a6
better slice handling
PaulLaux 0644aa8
removed AEADTAG data struct
PaulLaux 6e0b3c1
improved code
PaulLaux abdbf8d
removed split_tag
PaulLaux 45c3e20
chaged from_byte to from_vec #1
PaulLaux 2ebea7f
chaged from_byte to from_vec #2
PaulLaux 769758d
chaged from_byte to from_vec #3
PaulLaux 6f329f8
removed AsMut
PaulLaux 8cced99
removed AsMut #2
PaulLaux 111be37
changed style for From
PaulLaux 4c52098
changed style for From #2
PaulLaux 0f6e301
changed AsRef to AsMut
PaulLaux 82cd194
changed AsRef to AsMut #2
PaulLaux 24bf883
added extract_tag()
PaulLaux e0bd981
reverted to original v2 note encryption, modified to support the new …
PaulLaux cb72f10
minor cleanup
PaulLaux 8f02a5f
Merge branch 'zsa1' into v3_encryption
PaulLaux 0f5c714
cleanup
PaulLaux b1bf0a5
added encoding test to note_encryption v2
PaulLaux fc0c45a
cleanup
PaulLaux 6a54fea
clippy fixes
PaulLaux 0940e2b
clippy fixes 2
PaulLaux 7e7a15c
replaced DynamicUsage
PaulLaux 39e85e6
renamed OrchardDomain to OrchardDomainV2
PaulLaux ffb8d1a
added note_encryption_v2v3.rs
PaulLaux 24a52f6
updated note_encryption_v3
PaulLaux c4ab99c
adjusted types
PaulLaux d644384
updated domain to V3
PaulLaux 55ce92f
updated bundle commitmennt
PaulLaux baeb1cb
removed local zcash_note_encryption and cleanup
PaulLaux de6e87c
fixed comment
PaulLaux c6e048a
Merge branch 'zsa1' into v3_encryption
PaulLaux 343120d
updated cargo.toml
PaulLaux 49a7775
updated dep
PaulLaux bd8d553
review fixes1
PaulLaux 365d4ef
review fixes2
PaulLaux 35da288
minor fix
PaulLaux 8df5638
updeted dep
PaulLaux 79b0744
updeted dep
PaulLaux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ use crate::{ | |
| SpendingKey, | ||
| }, | ||
| note::{Note, TransmittedNoteCiphertext}, | ||
| note_encryption::OrchardNoteEncryption, | ||
| note_encryption_v3::OrchardNoteEncryption, | ||
| primitives::redpallas::{self, Binding, SpendAuth}, | ||
| tree::{Anchor, MerklePath}, | ||
| value::{self, NoteValue, OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum}, | ||
|
|
@@ -79,15 +79,20 @@ impl SpendInfo { | |
| /// Returns `None` if the `fvk` does not own the `note`. | ||
| /// | ||
| /// [`Builder::add_spend`]: Builder::add_spend | ||
| pub fn new(fvk: FullViewingKey, note: Note, merkle_path: MerklePath) -> Option<Self> { | ||
| pub fn new( | ||
| fvk: FullViewingKey, | ||
| note: Note, | ||
| merkle_path: MerklePath, | ||
| split_flag: bool, | ||
| ) -> Option<Self> { | ||
| let scope = fvk.scope_for_address(¬e.recipient())?; | ||
| Some(SpendInfo { | ||
| dummy_sk: None, | ||
| fvk, | ||
| scope, | ||
| note, | ||
| merkle_path, | ||
| split_flag: false, | ||
| split_flag, | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -112,10 +117,7 @@ impl SpendInfo { | |
|
|
||
| /// Return a copy of this note with the split flag set to `true`. | ||
| fn create_split_spend(&self) -> Self { | ||
| let mut split_spend = SpendInfo::new(self.fvk.clone(), self.note, self.merkle_path.clone()) | ||
| .expect("The spend info is valid"); | ||
| split_spend.split_flag = true; | ||
| split_spend | ||
| SpendInfo::new(self.fvk.clone(), self.note, self.merkle_path.clone(), true).unwrap() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we prefer unwrap over expect with comment?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only when the |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -224,7 +226,7 @@ impl ActionInfo { | |
|
|
||
| let encrypted_note = TransmittedNoteCiphertext { | ||
| epk_bytes: encryptor.epk().to_bytes().0, | ||
| enc_ciphertext: encryptor.encrypt_note_plaintext(), | ||
| enc_ciphertext: encryptor.encrypt_note_plaintext().0, | ||
| out_ciphertext: encryptor.encrypt_outgoing_plaintext(&cv_net, &cmx, &mut rng), | ||
| }; | ||
|
|
||
|
|
@@ -278,7 +280,7 @@ impl Builder { | |
| /// Returns an error if the given Merkle path does not have the required anchor for | ||
| /// the given note. | ||
| /// | ||
| /// [`OrchardDomain`]: crate::note_encryption::OrchardDomain | ||
| /// [`OrchardDomain`]: crate::note_encryption_v3::OrchardDomainV3 | ||
| /// [`MerkleHashOrchard`]: crate::tree::MerkleHashOrchard | ||
| pub fn add_spend( | ||
| &mut self, | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded constants make me sad, but that's consistent with current style so probably this is more of a general comment rather than a suggestion