Skip to content

Commit

Permalink
Update zcash_primitives to sync with latest sapling-crypto changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmidem committed Aug 19, 2024
1 parent fc38730 commit 2b69ff8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions zcash_primitives/src/transaction/components/sapling.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use ff::PrimeField;
use redjubjub::SpendAuth;
use sapling::note_encryption::Zip212Enforcement;
use sapling::note_encryption::{Zip212Enforcement, ENC_CIPHERTEXT_SIZE};
use zcash_protocol::consensus::{BlockHeight, NetworkUpgrade, Parameters, ZIP212_GRACE_PERIOD};

use std::io::{self, Read, Write};

use zcash_encoding::{Array, CompactSize, Vector};
use zcash_note_encryption::{EphemeralKeyBytes, ENC_CIPHERTEXT_SIZE, OUT_CIPHERTEXT_SIZE};
use zcash_note_encryption::{EphemeralKeyBytes, OUT_CIPHERTEXT_SIZE};

use crate::{
sapling::{
Expand Down Expand Up @@ -270,7 +270,7 @@ pub(crate) fn write_output_v4<W: Write>(
writer.write_all(&output.cv().to_bytes())?;
writer.write_all(output.cmu().to_bytes().as_ref())?;
writer.write_all(output.ephemeral_key().as_ref())?;
writer.write_all(output.enc_ciphertext())?;
writer.write_all(output.enc_ciphertext().as_ref())?;
writer.write_all(output.out_ciphertext())?;
writer.write_all(output.zkproof())
}
Expand All @@ -282,7 +282,7 @@ fn write_output_v5_without_proof<W: Write>(
writer.write_all(&output.cv().to_bytes())?;
writer.write_all(output.cmu().to_bytes().as_ref())?;
writer.write_all(output.ephemeral_key().as_ref())?;
writer.write_all(output.enc_ciphertext())?;
writer.write_all(output.enc_ciphertext().as_ref())?;
writer.write_all(output.out_ciphertext())
}

Expand Down
9 changes: 6 additions & 3 deletions zcash_primitives/src/transaction/txid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,15 @@ pub(crate) fn hash_sapling_outputs<A>(shielded_outputs: &[OutputDescription<A>])
for s_out in shielded_outputs {
ch.write_all(s_out.cmu().to_bytes().as_ref()).unwrap();
ch.write_all(s_out.ephemeral_key().as_ref()).unwrap();
ch.write_all(&s_out.enc_ciphertext()[..52]).unwrap();
ch.write_all(&s_out.enc_ciphertext().as_ref()[..52])
.unwrap();

mh.write_all(&s_out.enc_ciphertext()[52..564]).unwrap();
mh.write_all(&s_out.enc_ciphertext().as_ref()[52..564])
.unwrap();

nh.write_all(&s_out.cv().to_bytes()).unwrap();
nh.write_all(&s_out.enc_ciphertext()[564..]).unwrap();
nh.write_all(&s_out.enc_ciphertext().as_ref()[564..])
.unwrap();
nh.write_all(&s_out.out_ciphertext()[..]).unwrap();
}

Expand Down

0 comments on commit 2b69ff8

Please sign in to comment.