mirror of https://github.com/zcash/orchard.git
Upgrade orchard to v0.5 and integrate corresponding librustzcash upgrade (new) (#75)
This pull request focuses on upgrading the `orchard` repository to integrate it with a version of `librustzcash` repository compatible with `orchard` v0.5. The necessary changes have been made in the `upgrade_librustzcash_for_orchard_v05` branch, and merge conflicts have been resolved. `upgrade_librustzcash_for_orchard_v05` branch was created from `librustzcash_980736806` branch that contains previous attempt of upgading.
This commit is contained in:
commit
1a00c4af9a
|
@ -41,7 +41,7 @@ reddsa = "0.5"
|
|||
nonempty = "0.7"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
subtle = "2.3"
|
||||
zcash_note_encryption = "0.2"
|
||||
zcash_note_encryption = "0.4"
|
||||
incrementalmerkletree = "0.4"
|
||||
|
||||
# Logging
|
||||
|
@ -57,7 +57,7 @@ criterion = "0.3"
|
|||
halo2_gadgets = { git = "https://github.com/QED-it/halo2", branch = "zsa1", features = ["test-dependencies"] }
|
||||
hex = "0.4"
|
||||
proptest = "1.0.0"
|
||||
zcash_note_encryption = { version = "0.2", features = ["pre-zip-212"] }
|
||||
zcash_note_encryption = { version = "0.4", features = ["pre-zip-212"] }
|
||||
incrementalmerkletree = { version = "0.4", features = ["test-dependencies"] }
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
|
@ -92,4 +92,4 @@ debug = true
|
|||
debug = true
|
||||
|
||||
[patch.crates-io]
|
||||
zcash_note_encryption = { git = "https://github.com/QED-it/librustzcash.git", rev = "07c377ddedf71ab7c7a266d284b054a2dafc2ed4" }
|
||||
zcash_note_encryption = { version = "0.4", git = "https://github.com/QED-it/librustzcash.git", tag = "orchard_zsa_0.5.0_compatible" }
|
||||
|
|
|
@ -281,7 +281,6 @@ impl ActionInfo {
|
|||
let encryptor = OrchardNoteEncryption::new(
|
||||
self.output.ovk,
|
||||
note,
|
||||
self.output.recipient,
|
||||
self.output.memo.unwrap_or_else(|| {
|
||||
let mut memo = [0; 512];
|
||||
memo[0] = 0xf6;
|
||||
|
|
|
@ -16,7 +16,6 @@ use crate::{
|
|||
OutgoingViewingKey, PreparedEphemeralPublicKey, PreparedIncomingViewingKey, SharedSecret,
|
||||
},
|
||||
note::{ExtractedNoteCommitment, Nullifier, RandomSeed},
|
||||
spec::diversify_hash,
|
||||
value::{NoteValue, ValueCommitment},
|
||||
Address, Note,
|
||||
};
|
||||
|
@ -253,11 +252,7 @@ impl Domain for OrchardDomainV3 {
|
|||
secret.kdf_orchard(ephemeral_key)
|
||||
}
|
||||
|
||||
fn note_plaintext_bytes(
|
||||
note: &Self::Note,
|
||||
_: &Self::Recipient,
|
||||
memo: &Self::Memo,
|
||||
) -> NotePlaintextBytes {
|
||||
fn note_plaintext_bytes(note: &Self::Note, memo: &Self::Memo) -> NotePlaintextBytes {
|
||||
let mut np = [0u8; NOTE_PLAINTEXT_SIZE_V3];
|
||||
np[0] = 0x03;
|
||||
np[1..12].copy_from_slice(note.recipient().diversifier().as_array());
|
||||
|
@ -312,22 +307,9 @@ impl Domain for OrchardDomainV3 {
|
|||
fn parse_note_plaintext_without_memo_ovk(
|
||||
&self,
|
||||
pk_d: &Self::DiversifiedTransmissionKey,
|
||||
esk: &Self::EphemeralSecretKey,
|
||||
ephemeral_key: &EphemeralKeyBytes,
|
||||
plaintext: &CompactNotePlaintextBytes,
|
||||
) -> Option<(Self::Note, Self::Recipient)> {
|
||||
orchard_parse_note_plaintext_without_memo(self, plaintext, |diversifier| {
|
||||
if esk
|
||||
.derive_public(diversify_hash(diversifier.as_array()))
|
||||
.to_bytes()
|
||||
.0
|
||||
== ephemeral_key.0
|
||||
{
|
||||
Some(*pk_d)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
orchard_parse_note_plaintext_without_memo(self, plaintext, |_| Some(*pk_d))
|
||||
}
|
||||
|
||||
fn extract_memo(
|
||||
|
@ -499,7 +481,7 @@ mod tests {
|
|||
let memo = &crate::test_vectors::note_encryption::test_vectors()[0].memo;
|
||||
|
||||
// Encode.
|
||||
let mut plaintext = OrchardDomainV3::note_plaintext_bytes(¬e, ¬e.recipient(), memo);
|
||||
let mut plaintext = OrchardDomainV3::note_plaintext_bytes(¬e, memo);
|
||||
|
||||
// Decode.
|
||||
let domain = OrchardDomainV3 { rho: note.rho() };
|
||||
|
@ -622,7 +604,7 @@ mod tests {
|
|||
// Test encryption
|
||||
//
|
||||
|
||||
let ne = OrchardNoteEncryption::new_with_esk(esk, Some(ovk), note, recipient, tv.memo);
|
||||
let ne = OrchardNoteEncryption::new_with_esk(esk, Some(ovk), note, tv.memo);
|
||||
|
||||
assert_eq!(ne.encrypt_note_plaintext().as_ref(), &tv.c_enc[..]);
|
||||
assert_eq!(
|
||||
|
|
Loading…
Reference in New Issue