Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [

[patch.crates-io]
sapling = { package = "sapling-crypto", git = "https://github.com/QED-it/sapling-crypto", rev = "9393f93fe547d1b3738c9f4618c0f8a2fffed29f" }
orchard = { git = "https://github.com/QED-it/orchard", rev = "d8caa76a5c49300db35f7a4d80077dfaeb7295ca" }
orchard = { git = "https://github.com/QED-it/orchard", rev = "a80b5faf590add72ddf2feb40e045937f9cb1d40" }
sinsemilla = { git = "https://github.com/zcash/sinsemilla", rev = "aabb707e862bc3d7b803c77d14e5a771bcee3e8c" }
zcash_note_encryption = { git = "https://github.com/zcash/zcash_note_encryption", rev = "9f7e93d42cef839d02b9d75918117941d453f8cb" }
halo2_proofs = { git = "https://github.com/zcash/halo2", rev = "2308caf68c48c02468b66cfc452dad54e355e32f" }
Expand Down
14 changes: 8 additions & 6 deletions zcash_primitives/src/sighash_versioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//!
//! [ZIP-246]: https://zips.z.cash/zip-0246

use alloc::vec::Vec;

use orchard::sighash_kind::OrchardSighashKind;

#[cfg(zcash_unstable = "nu7")]
Expand All @@ -13,9 +15,9 @@ const ORCHARD_SIGHASH_INFO_V0: [u8; 1] = [0];

/// Returns the Orchard sighash info encoding corresponding to the given
/// [`OrchardSighashKind`].
pub(crate) fn orchard_sighash_kind_to_info(kind: &OrchardSighashKind) -> &'static [u8] {
pub(crate) fn orchard_sighash_kind_to_info(kind: &OrchardSighashKind) -> Vec<u8> {
match kind {
OrchardSighashKind::AllEffecting => &ORCHARD_SIGHASH_INFO_V0,
OrchardSighashKind::AllEffecting => ORCHARD_SIGHASH_INFO_V0.to_vec(),
}
}

Expand All @@ -38,9 +40,9 @@ const ISSUE_SIGHASH_INFO_V0: [u8; 1] = [0];
/// Returns the Issuance sighash info encoding corresponding to the given
/// [`IssueSighashKind`].
#[cfg(zcash_unstable = "nu7")]
pub(crate) fn issue_sighash_kind_to_info(kind: &IssueSighashKind) -> &'static [u8] {
pub(crate) fn issue_sighash_kind_to_info(kind: &IssueSighashKind) -> Vec<u8> {
match kind {
IssueSighashKind::AllEffecting => &ISSUE_SIGHASH_INFO_V0,
IssueSighashKind::AllEffecting => ISSUE_SIGHASH_INFO_V0.to_vec(),
}
}

Expand All @@ -66,7 +68,7 @@ mod tests {
for kind in kinds {
// kind -> info -> kind
let info = orchard_sighash_kind_to_info(&kind);
let parsed = orchard_sighash_kind_from_info(info)
let parsed = orchard_sighash_kind_from_info(&info)
.expect("SighashInfo produced by orchard_sighash_kind_to_info must be parsable.");
assert_eq!(parsed, kind);
}
Expand All @@ -85,7 +87,7 @@ mod tests {
for kind in kinds {
// kind -> info -> kind
let info = issue_sighash_kind_to_info(&kind);
let parsed = issue_sighash_kind_from_info(info)
let parsed = issue_sighash_kind_from_info(&info)
.expect("SighashInfo produced by issue_sighash_kind_to_info must be parsable.");
assert_eq!(parsed, kind);
}
Expand Down
2 changes: 1 addition & 1 deletion zcash_primitives/src/transaction/components/issuance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub fn write_bundle<W: Write>(
Vector::write_nonempty(&mut writer, bundle.actions(), write_action)?;
let sighash_info_bytes =
issue_sighash_kind_to_info(bundle.authorization().signature().sighash_kind());
Vector::write(&mut writer, sighash_info_bytes, |w, b| w.write_u8(*b))?;
Vector::write(&mut writer, &sighash_info_bytes, |w, b| w.write_u8(*b))?;

Vector::write(
&mut writer,
Expand Down
2 changes: 1 addition & 1 deletion zcash_primitives/src/transaction/components/orchard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub fn write_versioned_signature<W: Write, T: SigType>(
versioned_sig: &OrchardSig<T>,
) -> io::Result<()> {
let sighash_info_bytes = orchard_sighash_kind_to_info(versioned_sig.sighash_kind());
Vector::write(&mut writer, sighash_info_bytes, |w, b| w.write_u8(*b))?;
Vector::write(&mut writer, &sighash_info_bytes, |w, b| w.write_u8(*b))?;
writer.write_all(&<[u8; 64]>::from(versioned_sig.sig()))
}

Expand Down
Loading