From 1d17ea03202cc83af7fe33595c1da400888b332a Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Wed, 17 Jul 2024 19:16:03 +0530 Subject: [PATCH] moving to zcash_unstable nu7 --- .github/workflows/ci.yml | 3 + components/zcash_protocol/src/consensus.rs | 24 ++-- .../zcash_protocol/src/local_consensus.rs | 20 +-- zcash_client_sqlite/src/testing.rs | 2 +- zcash_client_sqlite/src/wallet.rs | 4 +- zcash_client_sqlite/src/wallet/init.rs | 4 +- zcash_primitives/src/transaction/builder.rs | 50 ++++---- zcash_primitives/src/transaction/mod.rs | 121 +++++++++--------- zcash_primitives/src/transaction/sighash.rs | 4 +- .../src/transaction/sighash_v5.rs | 2 +- zcash_primitives/src/transaction/tests.rs | 14 +- zcash_primitives/src/transaction/txid.rs | 28 ++-- 12 files changed, 139 insertions(+), 137 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a81631326..dd18d5787 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: - NOT_A_PUZZLE - Orchard - NU6 + - NU7 include: - target: Linux @@ -36,6 +37,8 @@ jobs: extra_flags: orchard - state: NU6 rustflags: '--cfg zcash_unstable="nu6"' + - state: NU7 + rustflags: '--cfg zcash_unstable="nu7"' exclude: - target: macOS diff --git a/components/zcash_protocol/src/consensus.rs b/components/zcash_protocol/src/consensus.rs index 8326d385a..9e3eb4b07 100644 --- a/components/zcash_protocol/src/consensus.rs +++ b/components/zcash_protocol/src/consensus.rs @@ -356,7 +356,7 @@ impl Parameters for MainNetwork { NetworkUpgrade::Nu5 => Some(BlockHeight(1_687_104)), #[cfg(zcash_unstable = "nu6")] NetworkUpgrade::Nu6 => Some(BlockHeight(1_687_106)), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ NetworkUpgrade::Nu7 => { + #[cfg(zcash_unstable = "nu7")] NetworkUpgrade::Nu7 => { Some(BlockHeight(1_687_107)) } #[cfg(zcash_unstable = "zfuture")] @@ -389,7 +389,7 @@ impl Parameters for TestNetwork { NetworkUpgrade::Nu5 => Some(BlockHeight(1_842_420)), #[cfg(zcash_unstable = "nu6")] NetworkUpgrade::Nu6 => None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ NetworkUpgrade::Nu7 => { + #[cfg(zcash_unstable = "nu7")] NetworkUpgrade::Nu7 => { Some(BlockHeight(1_842_421)) } #[cfg(zcash_unstable = "zfuture")] @@ -463,7 +463,7 @@ pub enum NetworkUpgrade { /// The [Nu7] network upgrade. /// /// [Nu7]: https://z.cash/upgrade/nu7/ - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] Nu7, /// The ZFUTURE network upgrade. /// @@ -487,7 +487,7 @@ impl fmt::Display for NetworkUpgrade { NetworkUpgrade::Nu5 => write!(f, "Nu5"), #[cfg(zcash_unstable = "nu6")] NetworkUpgrade::Nu6 => write!(f, "Nu6"), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ NetworkUpgrade::Nu7 => write!(f, "Nu7"), + #[cfg(zcash_unstable = "nu7")] NetworkUpgrade::Nu7 => write!(f, "Nu7"), #[cfg(zcash_unstable = "zfuture")] NetworkUpgrade::ZFuture => write!(f, "ZFUTURE"), } @@ -505,7 +505,7 @@ impl NetworkUpgrade { NetworkUpgrade::Nu5 => BranchId::Nu5, #[cfg(zcash_unstable = "nu6")] NetworkUpgrade::Nu6 => BranchId::Nu6, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ NetworkUpgrade::Nu7 => BranchId::Nu7, + #[cfg(zcash_unstable = "nu7")] NetworkUpgrade::Nu7 => BranchId::Nu7, #[cfg(zcash_unstable = "zfuture")] NetworkUpgrade::ZFuture => BranchId::ZFuture, } @@ -525,7 +525,7 @@ const UPGRADES_IN_ORDER: &[NetworkUpgrade] = &[ NetworkUpgrade::Nu5, #[cfg(zcash_unstable = "nu6")] NetworkUpgrade::Nu6, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ NetworkUpgrade::Nu7, + #[cfg(zcash_unstable = "nu7")] NetworkUpgrade::Nu7, ]; /// The "grace period" defined in [ZIP 212]. @@ -566,7 +566,7 @@ pub enum BranchId { #[cfg(zcash_unstable = "nu6")] Nu6, /// The consensus rules deployed by [`NetworkUpgrade::Nu7`]. - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] Nu7, /// Candidates for future consensus rules; this branch will never /// activate on mainnet. @@ -590,7 +590,7 @@ impl TryFrom for BranchId { 0xc2d6_d0b4 => Ok(BranchId::Nu5), #[cfg(zcash_unstable = "nu6")] 0xc8e7_1055 => Ok(BranchId::Nu6), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ 0x7777_7777 => Ok(BranchId::Nu7), + #[cfg(zcash_unstable = "nu7")] 0x7777_7777 => Ok(BranchId::Nu7), #[cfg(zcash_unstable = "zfuture")] 0xffff_ffff => Ok(BranchId::ZFuture), _ => Err("Unknown consensus branch ID"), @@ -610,7 +610,7 @@ impl From for u32 { BranchId::Nu5 => 0xc2d6_d0b4, #[cfg(zcash_unstable = "nu6")] BranchId::Nu6 => 0xc8e7_1055, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ BranchId::Nu7 => 0x7777_7777, + #[cfg(zcash_unstable = "nu7")] BranchId::Nu7 => 0x7777_7777, #[cfg(zcash_unstable = "zfuture")] BranchId::ZFuture => 0xffff_ffff, } @@ -691,7 +691,7 @@ impl BranchId { let upper = None; (lower, upper) }), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ BranchId::Nu7 => { + #[cfg(zcash_unstable = "nu7")] BranchId::Nu7 => { params.activation_height(NetworkUpgrade::Nu7).map(|lower| { #[cfg(zcash_unstable = "zfuture")] let upper = params.activation_height(NetworkUpgrade::ZFuture); @@ -730,7 +730,7 @@ pub mod testing { BranchId::Nu5, #[cfg(zcash_unstable = "nu6")] BranchId::Nu6, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ BranchId::Nu7, + #[cfg(zcash_unstable = "nu7")] BranchId::Nu7, #[cfg(zcash_unstable = "zfuture")] BranchId::ZFuture, ]) @@ -824,7 +824,7 @@ mod tests { BranchId::for_height(&MAIN_NETWORK, BlockHeight(1_687_104)), BranchId::Nu5, ); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] assert_eq!( BranchId::for_height(&MAIN_NETWORK, BlockHeight(1_842_421)), BranchId::Nu7, diff --git a/components/zcash_protocol/src/local_consensus.rs b/components/zcash_protocol/src/local_consensus.rs index 41616add7..0b82bfd2f 100644 --- a/components/zcash_protocol/src/local_consensus.rs +++ b/components/zcash_protocol/src/local_consensus.rs @@ -39,7 +39,7 @@ pub struct LocalNetwork { pub nu5: Option, #[cfg(zcash_unstable = "nu6")] pub nu6: Option, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ pub nu7: Option, + #[cfg(zcash_unstable = "nu7")] pub nu7: Option, #[cfg(zcash_unstable = "zfuture")] pub z_future: Option, } @@ -60,7 +60,7 @@ impl Parameters for LocalNetwork { NetworkUpgrade::Nu5 => self.nu5, #[cfg(zcash_unstable = "nu6")] NetworkUpgrade::Nu6 => self.nu6, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ NetworkUpgrade::Nu7 => self.nu7, + #[cfg(zcash_unstable = "nu7")] NetworkUpgrade::Nu7 => self.nu7, #[cfg(zcash_unstable = "zfuture")] NetworkUpgrade::ZFuture => self.z_future, } @@ -85,7 +85,7 @@ mod tests { let expected_nu5 = BlockHeight::from_u32(6); #[cfg(zcash_unstable = "nu6")] let expected_nu6 = BlockHeight::from_u32(7); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ let expected_nu7 = BlockHeight::from_u32(8); + #[cfg(zcash_unstable = "nu7")] let expected_nu7 = BlockHeight::from_u32(8); #[cfg(zcash_unstable = "zfuture")] let expected_z_future = BlockHeight::from_u32(7); @@ -98,7 +98,7 @@ mod tests { nu5: Some(expected_nu5), #[cfg(zcash_unstable = "nu6")] nu6: Some(expected_nu6), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] nu7: Some(expected_nu7), #[cfg(zcash_unstable = "zfuture")] z_future: Some(expected_z_future), @@ -112,7 +112,7 @@ mod tests { assert!(regtest.is_nu_active(NetworkUpgrade::Nu5, expected_nu5)); #[cfg(zcash_unstable = "nu6")] assert!(regtest.is_nu_active(NetworkUpgrade::Nu6, expected_nu6)); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] assert!(regtest.is_nu_active(NetworkUpgrade::Nu7, expected_nu7)); #[cfg(zcash_unstable = "zfuture")] assert!(!regtest.is_nu_active(NetworkUpgrade::ZFuture, expected_nu5)); @@ -128,7 +128,7 @@ mod tests { let expected_nu5 = BlockHeight::from_u32(6); #[cfg(zcash_unstable = "nu6")] let expected_nu6 = BlockHeight::from_u32(7); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ let expected_nu7 = BlockHeight::from_u32(8); + #[cfg(zcash_unstable = "nu7")] let expected_nu7 = BlockHeight::from_u32(8); #[cfg(zcash_unstable = "zfuture")] let expected_z_future = BlockHeight::from_u32(7); @@ -141,7 +141,7 @@ mod tests { nu5: Some(expected_nu5), #[cfg(zcash_unstable = "nu6")] nu6: Some(expected_nu6), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] nu7: Some(expected_nu7), #[cfg(zcash_unstable = "zfuture")] z_future: Some(expected_z_future), @@ -176,7 +176,7 @@ mod tests { regtest.activation_height(NetworkUpgrade::Nu6), Some(expected_nu6) ); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] assert_eq!( regtest.activation_height(NetworkUpgrade::Nu7), Some(expected_nu7) @@ -198,7 +198,7 @@ mod tests { let expected_nu5 = BlockHeight::from_u32(6); #[cfg(zcash_unstable = "nu6")] let expected_nu6 = BlockHeight::from_u32(7); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ let expected_nu7 = BlockHeight::from_u32(8); + #[cfg(zcash_unstable = "nu7")] let expected_nu7 = BlockHeight::from_u32(8); #[cfg(zcash_unstable = "zfuture")] let expected_z_future = BlockHeight::from_u32(7); @@ -211,7 +211,7 @@ mod tests { nu5: Some(expected_nu5), #[cfg(zcash_unstable = "nu6")] nu6: Some(expected_nu6), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] nu7: Some(expected_nu7), #[cfg(zcash_unstable = "zfuture")] z_future: Some(expected_z_future), diff --git a/zcash_client_sqlite/src/testing.rs b/zcash_client_sqlite/src/testing.rs index 1230a0b05..f643c37c5 100644 --- a/zcash_client_sqlite/src/testing.rs +++ b/zcash_client_sqlite/src/testing.rs @@ -129,7 +129,7 @@ impl TestBuilder<()> { nu5: Some(BlockHeight::from_u32(100_000)), #[cfg(zcash_unstable = "nu6")] nu6: None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] nu7: Some(BlockHeight::from_u32(100_000)), #[cfg(zcash_unstable = "zfuture")] z_future: None, diff --git a/zcash_client_sqlite/src/wallet.rs b/zcash_client_sqlite/src/wallet.rs index 5ec3a0f8b..e72561e0c 100644 --- a/zcash_client_sqlite/src/wallet.rs +++ b/zcash_client_sqlite/src/wallet.rs @@ -1490,9 +1490,9 @@ pub(crate) fn get_transaction( tx_data.sprout_bundle().cloned(), tx_data.sapling_bundle().cloned(), tx_data.orchard_bundle().cloned(), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] tx_data.orchard_zsa_bundle().cloned(), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] tx_data.issue_bundle().cloned(), ) .freeze() diff --git a/zcash_client_sqlite/src/wallet/init.rs b/zcash_client_sqlite/src/wallet/init.rs index eae5080e7..ff9572f89 100644 --- a/zcash_client_sqlite/src/wallet/init.rs +++ b/zcash_client_sqlite/src/wallet/init.rs @@ -1275,9 +1275,9 @@ mod tests { None, None, None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] None, ) .freeze() diff --git a/zcash_primitives/src/transaction/builder.rs b/zcash_primitives/src/transaction/builder.rs index e97c6d22f..82c760560 100644 --- a/zcash_primitives/src/transaction/builder.rs +++ b/zcash_primitives/src/transaction/builder.rs @@ -50,17 +50,17 @@ use crate::{ }, }; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ +#[cfg(zcash_unstable = "nu7")] use crate::transaction::builder::Error::{IssuanceBuilder, IssuanceBundle}; use orchard::note::AssetBase; use orchard::orchard_flavor::OrchardVanilla; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ use orchard::orchard_flavor::OrchardZSA; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ +#[cfg(zcash_unstable = "nu7")] use orchard::orchard_flavor::OrchardZSA; +#[cfg(zcash_unstable = "nu7")] use orchard::{ issuance::{IssueBundle, IssueInfo}, keys::{IssuanceAuthorizingKey, IssuanceValidatingKey}, }; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ use rand_core::OsRng; +#[cfg(zcash_unstable = "nu7")] use rand_core::OsRng; /// Since Blossom activation, the default transaction expiry delta should be 40 blocks. /// @@ -301,9 +301,9 @@ pub struct Builder<'a, P, U: sapling::builder::ProverProgress> { transparent_builder: TransparentBuilder, sapling_builder: Option, orchard_builder: Option, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issuance_builder: Option>, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issuance_key: Option, // TODO: In the future, instead of taking the spending keys as arguments when calling // `add_sapling_spend` or `add_orchard_spend`, we will build an unauthorized, unproven @@ -396,9 +396,9 @@ impl<'a, P: consensus::Parameters> Builder<'a, P, ()> { transparent_builder: TransparentBuilder::empty(), sapling_builder, orchard_builder, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issuance_builder: None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issuance_key: None, sapling_asks: vec![], orchard_saks: Vec::new(), @@ -428,9 +428,9 @@ impl<'a, P: consensus::Parameters> Builder<'a, P, ()> { transparent_builder: self.transparent_builder, sapling_builder: self.sapling_builder, orchard_builder: self.orchard_builder, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issuance_builder: self.issuance_builder, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issuance_key: self.issuance_key, sapling_asks: self.sapling_asks, orchard_saks: self.orchard_saks, @@ -440,7 +440,7 @@ impl<'a, P: consensus::Parameters> Builder<'a, P, ()> { } /// Adds an Issuance action to the transaction. - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] pub fn init_issue_bundle( &mut self, ik: IssuanceAuthorizingKey, @@ -468,7 +468,7 @@ impl<'a, P: consensus::Parameters> Builder<'a, P, ()> { } /// Adds an Issuance action to the transaction. - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] pub fn add_issuance( &mut self, asset_desc: String, @@ -488,7 +488,7 @@ impl<'a, P: consensus::Parameters> Builder<'a, P, ()> { } /// Adds a Burn action to the transaction. - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] pub fn add_burn(&mut self, value: u64, asset: AssetBase) -> Result<(), Error> { self.orchard_builder .as_mut() @@ -503,7 +503,7 @@ impl<'a, P: consensus::Parameters> Builder<'a, P, ()> { /// /// Returns an error if the given Merkle path does not have the required anchor for /// the given note. - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] pub fn add_orchard_zsa_spend( &mut self, sk: &orchard::keys::SpendingKey, @@ -514,7 +514,7 @@ impl<'a, P: consensus::Parameters> Builder<'a, P, ()> { } /// Adds an Orchard ZSA output to the transaction. - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] pub fn add_orchard_zsa_output( &mut self, ovk: Option, @@ -866,7 +866,7 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder< }; let mut unproven_orchard_bundle = None; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ let mut unproven_orchard_zsa_bundle: Option< + #[cfg(zcash_unstable = "nu7")] let mut unproven_orchard_zsa_bundle: Option< orchard::Bundle< orchard::builder::InProgress< orchard::builder::Unproven, @@ -880,7 +880,7 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder< if let Some(builder) = self.orchard_builder { if version.has_zsa() { - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] { let (bundle, meta) = builder .build(&mut rng) @@ -912,9 +912,9 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder< sprout_bundle: None, sapling_bundle, orchard_bundle: unproven_orchard_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle: unproven_orchard_zsa_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issue_bundle: self.issuance_builder, #[cfg(zcash_unstable = "zfuture")] tze_bundle, @@ -978,7 +978,7 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder< .transpose() .map_err(Error::OrchardBuild)?; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ let orchard_zsa_bundle = unauthed_tx + #[cfg(zcash_unstable = "nu7")] let orchard_zsa_bundle = unauthed_tx .orchard_zsa_bundle .map(|b| { b.create_proof( @@ -996,7 +996,7 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder< .transpose() .map_err(Error::OrchardBuild)?; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ let issue_bundle = unauthed_tx + #[cfg(zcash_unstable = "nu7")] let issue_bundle = unauthed_tx .issue_bundle .map(|b| b.prepare(*shielded_sig_commitment.as_ref())) .map(|b| b.sign(self.issuance_key.as_ref().unwrap())) @@ -1011,9 +1011,9 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder< sprout_bundle: unauthed_tx.sprout_bundle, sapling_bundle, orchard_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issue_bundle, #[cfg(zcash_unstable = "zfuture")] tze_bundle, @@ -1176,9 +1176,9 @@ mod tests { tze_builder: std::marker::PhantomData, progress_notifier: (), orchard_builder: None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issuance_builder: None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issuance_key: None, sapling_asks: vec![], orchard_saks: Vec::new(), diff --git a/zcash_primitives/src/transaction/mod.rs b/zcash_primitives/src/transaction/mod.rs index f077d129b..9383411bc 100644 --- a/zcash_primitives/src/transaction/mod.rs +++ b/zcash_primitives/src/transaction/mod.rs @@ -28,8 +28,8 @@ use crate::{ sapling::{self, builder as sapling_builder}, }; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ use crate::transaction::components::issuance; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ +#[cfg(zcash_unstable = "nu7")] use crate::transaction::components::issuance; +#[cfg(zcash_unstable = "nu7")] use orchard::{issuance::IssueBundle, orchard_flavor::OrchardZSA}; use self::{ @@ -55,10 +55,10 @@ const SAPLING_TX_VERSION: u32 = 4; const V5_TX_VERSION: u32 = 5; const V5_VERSION_GROUP_ID: u32 = 0x26A7270A; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ +#[cfg(zcash_unstable = "nu7")] const V7_TX_VERSION: u32 = 7; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ -const V7_VERSION_GROUP_ID: u32 = 0x124A69F8; // TODO ??? +#[cfg(zcash_unstable = "nu7")] +const V7_VERSION_GROUP_ID: u32 = 0x124A69F8; /// These versions are used exclusively for in-development transaction /// serialization, and will never be active under the consensus rules. @@ -142,7 +142,7 @@ pub enum TxVersion { Overwinter, Sapling, Zip225, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ Zsa, + #[cfg(zcash_unstable = "nu7")] Zsa, #[cfg(zcash_unstable = "zfuture")] ZFuture, } @@ -158,7 +158,7 @@ impl TxVersion { (OVERWINTER_TX_VERSION, OVERWINTER_VERSION_GROUP_ID) => Ok(TxVersion::Overwinter), (SAPLING_TX_VERSION, SAPLING_VERSION_GROUP_ID) => Ok(TxVersion::Sapling), (V5_TX_VERSION, V5_VERSION_GROUP_ID) => Ok(TxVersion::Zip225), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ (V7_TX_VERSION, V7_VERSION_GROUP_ID) => { + #[cfg(zcash_unstable = "nu7")] (V7_TX_VERSION, V7_VERSION_GROUP_ID) => { Ok(TxVersion::Zsa) } #[cfg(zcash_unstable = "zfuture")] @@ -191,7 +191,7 @@ impl TxVersion { TxVersion::Overwinter => OVERWINTER_TX_VERSION, TxVersion::Sapling => SAPLING_TX_VERSION, TxVersion::Zip225 => V5_TX_VERSION, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => V7_TX_VERSION, + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => V7_TX_VERSION, #[cfg(zcash_unstable = "zfuture")] TxVersion::ZFuture => ZFUTURE_TX_VERSION, } @@ -203,7 +203,7 @@ impl TxVersion { TxVersion::Overwinter => OVERWINTER_VERSION_GROUP_ID, TxVersion::Sapling => SAPLING_VERSION_GROUP_ID, TxVersion::Zip225 => V5_VERSION_GROUP_ID, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => V7_VERSION_GROUP_ID, + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => V7_VERSION_GROUP_ID, #[cfg(zcash_unstable = "zfuture")] TxVersion::ZFuture => ZFUTURE_VERSION_GROUP_ID, } @@ -223,7 +223,7 @@ impl TxVersion { TxVersion::Sprout(v) => *v >= 2u32, TxVersion::Overwinter | TxVersion::Sapling => true, TxVersion::Zip225 => false, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => false, + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => false, #[cfg(zcash_unstable = "zfuture")] TxVersion::ZFuture => true, } @@ -239,7 +239,7 @@ impl TxVersion { TxVersion::Sprout(_) | TxVersion::Overwinter => false, TxVersion::Sapling => true, TxVersion::Zip225 => true, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => true, + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => true, #[cfg(zcash_unstable = "zfuture")] TxVersion::ZFuture => true, } @@ -250,7 +250,7 @@ impl TxVersion { match self { TxVersion::Sprout(_) | TxVersion::Overwinter | TxVersion::Sapling => false, TxVersion::Zip225 => true, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => false, + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => false, #[cfg(zcash_unstable = "zfuture")] TxVersion::ZFuture => true, } @@ -262,7 +262,7 @@ impl TxVersion { | TxVersion::Overwinter | TxVersion::Sapling | TxVersion::Zip225 => false, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => true, + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => true, #[cfg(zcash_unstable = "zfuture")] TxVersion::ZFuture => false, } @@ -284,7 +284,7 @@ impl TxVersion { BranchId::Nu5 => TxVersion::Zip225, #[cfg(zcash_unstable = "nu6")] BranchId::Nu6 => TxVersion::Zip225, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ BranchId::Nu7 => TxVersion::Zsa, + #[cfg(zcash_unstable = "nu7")] BranchId::Nu7 => TxVersion::Zsa, #[cfg(zcash_unstable = "zfuture")] BranchId::ZFuture => TxVersion::ZFuture, } @@ -297,10 +297,10 @@ pub trait Authorization { type SaplingAuth: sapling::bundle::Authorization; type OrchardAuth: orchard::bundle::Authorization; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type OrchardZsaAuth: orchard::bundle::Authorization; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type IssueAuth: orchard::issuance::IssueAuth; #[cfg(zcash_unstable = "zfuture")] @@ -316,10 +316,10 @@ impl Authorization for Authorized { type SaplingAuth = sapling::bundle::Authorized; type OrchardAuth = orchard::bundle::Authorized; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type OrchardZsaAuth = orchard::bundle::Authorized; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type IssueAuth = orchard::issuance::Signed; #[cfg(zcash_unstable = "zfuture")] @@ -339,11 +339,11 @@ impl Authorization for Unauthorized { type OrchardAuth = orchard::builder::InProgress, orchard::builder::Unauthorized>; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type OrchardZsaAuth = orchard::builder::InProgress, orchard::builder::Unauthorized>; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type IssueAuth = orchard::issuance::Unauthorized; #[cfg(zcash_unstable = "zfuture")] @@ -382,9 +382,9 @@ pub struct TransactionData { sprout_bundle: Option, sapling_bundle: Option>, orchard_bundle: Option>, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle: Option>, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ issue_bundle: Option>, + #[cfg(zcash_unstable = "nu7")] issue_bundle: Option>, #[cfg(zcash_unstable = "zfuture")] tze_bundle: Option>, } @@ -401,10 +401,10 @@ impl TransactionData { sprout_bundle: Option, sapling_bundle: Option>, orchard_bundle: Option>, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ orchard_zsa_bundle: Option< + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle: Option< orchard::Bundle, >, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ issue_bundle: Option< + #[cfg(zcash_unstable = "nu7")] issue_bundle: Option< IssueBundle, >, ) -> Self { @@ -417,9 +417,9 @@ impl TransactionData { sprout_bundle, sapling_bundle, orchard_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issue_bundle, #[cfg(zcash_unstable = "zfuture")] tze_bundle: None, @@ -490,14 +490,14 @@ impl TransactionData { self.orchard_bundle.as_ref() } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] pub fn orchard_zsa_bundle( &self, ) -> Option<&orchard::Bundle> { self.orchard_zsa_bundle.as_ref() } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] pub fn issue_bundle(&self) -> Option<&IssueBundle> { self.issue_bundle.as_ref() } @@ -548,19 +548,19 @@ impl TransactionData { digester.digest_transparent(self.transparent_bundle.as_ref()), digester.digest_sapling(self.sapling_bundle.as_ref()), self.digest_orchard(&digester), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] digester.digest_issue(self.issue_bundle.as_ref()), #[cfg(zcash_unstable = "zfuture")] digester.digest_tze(self.tze_bundle.as_ref()), ) } - #[cfg(not(zcash_unstable = "nu6"))] /* TODO nu7 */ + #[cfg(not(zcash_unstable = "nu7"))] fn digest_orchard>(&self, digester: &D) -> D::OrchardDigest { digester.digest_orchard(self.orchard_bundle.as_ref()) } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn digest_orchard>(&self, digester: &D) -> D::OrchardDigest { if self.version.has_zsa() { digester.digest_orchard_zsa(self.orchard_zsa_bundle.as_ref()) @@ -586,12 +586,12 @@ impl TransactionData { ) -> Option< orchard::bundle::Bundle, >, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ f_zsa_orchard: impl FnOnce( + #[cfg(zcash_unstable = "nu7")] f_zsa_orchard: impl FnOnce( Option>, ) -> Option< orchard::bundle::Bundle, >, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ f_issue: impl FnOnce( + #[cfg(zcash_unstable = "nu7")] f_issue: impl FnOnce( Option>, ) -> Option< orchard::issuance::IssueBundle, @@ -610,9 +610,9 @@ impl TransactionData { sprout_bundle: self.sprout_bundle, sapling_bundle: f_sapling(self.sapling_bundle), orchard_bundle: f_orchard(self.orchard_bundle), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle: f_zsa_orchard(self.orchard_zsa_bundle), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issue_bundle: f_issue(self.issue_bundle), #[cfg(zcash_unstable = "zfuture")] tze_bundle: f_tze(self.tze_bundle), @@ -624,13 +624,12 @@ impl TransactionData { f_transparent: impl transparent::MapAuth, mut f_sapling: impl sapling_serialization::MapAuth, mut f_orchard: impl orchard_serialization::MapAuth, - #[cfg(zcash_unstable = "nu6")] - /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] mut f_orchard_zsa: impl orchard_serialization::MapAuth< A::OrchardZsaAuth, B::OrchardZsaAuth, >, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ f_issue: impl issuance::MapIssueAuth< + #[cfg(zcash_unstable = "nu7")] f_issue: impl issuance::MapIssueAuth< A::IssueAuth, B::IssueAuth, >, @@ -661,7 +660,7 @@ impl TransactionData { |f, a| f.map_authorization(a), ) }), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle: self.orchard_zsa_bundle.map(|b| { b.map_authorization( &mut f_orchard_zsa, @@ -669,7 +668,7 @@ impl TransactionData { |f, a| f.map_authorization(a), ) }), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issue_bundle: self .issue_bundle .map(|b| b.map_authorization(|a| f_issue.map_issue_authorization(a))), @@ -700,7 +699,7 @@ impl Transaction { Self::from_data_v4(data) } TxVersion::Zip225 => Ok(Self::from_data_v5(data)), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => { + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => { Ok(Self::from_data_v7(data)) } #[cfg(zcash_unstable = "zfuture")] @@ -729,7 +728,7 @@ impl Transaction { Transaction { txid, data } } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn from_data_v7(data: TransactionData) -> Self { Self::from_data_v5(data) } @@ -751,7 +750,7 @@ impl Transaction { Self::read_v4(reader, version, consensus_branch_id) } TxVersion::Zip225 => Self::read_v5(reader.into_base_reader(), version), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => { + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => { Self::read_v7(reader.into_base_reader(), version) } #[cfg(zcash_unstable = "zfuture")] @@ -830,9 +829,9 @@ impl Transaction { ) }), orchard_bundle: None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle: None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issue_bundle: None, #[cfg(zcash_unstable = "zfuture")] tze_bundle: None, @@ -892,9 +891,9 @@ impl Transaction { sprout_bundle: None, sapling_bundle, orchard_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] orchard_zsa_bundle: None, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issue_bundle: None, #[cfg(zcash_unstable = "zfuture")] tze_bundle, @@ -924,7 +923,7 @@ impl Transaction { sapling_serialization::read_v5_bundle(reader) } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn read_v7(mut reader: R, version: TxVersion) -> io::Result { let (consensus_branch_id, lock_time, expiry_height) = Self::read_v5_header_fragment(&mut reader)?; @@ -979,7 +978,7 @@ impl Transaction { self.write_v4(writer) } TxVersion::Zip225 => self.write_v5(writer), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => self.write_v7(writer), + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => self.write_v7(writer), #[cfg(zcash_unstable = "zfuture")] TxVersion::ZFuture => self.write_v5(writer), } @@ -1074,12 +1073,12 @@ impl Transaction { sapling_serialization::write_v5_bundle(writer, self.sapling_bundle.as_ref()) } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] pub fn write_v7(&self, mut writer: W) -> io::Result<()> { if self.sprout_bundle.is_some() { return Err(io::Error::new( io::ErrorKind::InvalidInput, - "Sprout components cannot be present when serializing to the V5 transaction format.", + "Sprout components cannot be present when serializing to the V7 transaction format.", )); } self.write_v5_header(&mut writer)?; @@ -1131,7 +1130,7 @@ pub struct TxDigests { pub transparent_digests: Option>, pub sapling_digest: Option, pub orchard_digest: Option, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ pub issue_digest: Option, + #[cfg(zcash_unstable = "nu7")] pub issue_digest: Option, #[cfg(zcash_unstable = "zfuture")] pub tze_digests: Option>, } @@ -1142,7 +1141,7 @@ pub trait TransactionDigest { type SaplingDigest; type OrchardDigest; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type IssueDigest; #[cfg(zcash_unstable = "zfuture")] @@ -1173,13 +1172,13 @@ pub trait TransactionDigest { orchard_bundle: Option<&orchard::Bundle>, ) -> Self::OrchardDigest; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn digest_orchard_zsa( &self, orchard_bundle: Option<&orchard::Bundle>, ) -> Self::OrchardDigest; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn digest_issue(&self, issue_bundle: Option<&IssueBundle>) -> Self::IssueDigest; #[cfg(zcash_unstable = "zfuture")] @@ -1191,7 +1190,7 @@ pub trait TransactionDigest { transparent_digest: Self::TransparentDigest, sapling_digest: Self::SaplingDigest, orchard_digest: Self::OrchardDigest, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ issue_digest: Self::IssueDigest, + #[cfg(zcash_unstable = "nu7")] issue_digest: Self::IssueDigest, #[cfg(zcash_unstable = "zfuture")] tze_digest: Self::TzeDigest, ) -> Self::Digest; } @@ -1233,7 +1232,7 @@ pub mod testing { BranchId::Nu5 => Just(TxVersion::Zip225).boxed(), #[cfg(zcash_unstable = "nu6")] BranchId::Nu6 => Just(TxVersion::Zip225).boxed(), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ BranchId::Nu7 => { + #[cfg(zcash_unstable = "nu7")] BranchId::Nu7 => { Just(TxVersion::Zsa).boxed() } #[cfg(zcash_unstable = "zfuture")] @@ -1264,10 +1263,10 @@ pub mod testing { sprout_bundle: None, sapling_bundle, orchard_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ - orchard_zsa_bundle: _orchard_zsa_bundle, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ - issue_bundle: _issue_bundle, + #[cfg(zcash_unstable = "nu7")] + orchard_zsa_bundle, + #[cfg(zcash_unstable = "nu7")] + issue_bundle, } } } diff --git a/zcash_primitives/src/transaction/sighash.rs b/zcash_primitives/src/transaction/sighash.rs index b2b02f562..edb3f3ca2 100644 --- a/zcash_primitives/src/transaction/sighash.rs +++ b/zcash_primitives/src/transaction/sighash.rs @@ -11,7 +11,7 @@ use crate::{ sapling::{self, bundle::GrothProofBytes}, }; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ +#[cfg(zcash_unstable = "nu7")] use crate::transaction::sighash_v7::v7_signature_hash; #[cfg(zcash_unstable = "zfuture")] use {super::components::Amount, crate::extensions::transparent::Precondition}; @@ -93,7 +93,7 @@ pub fn signature_hash< TxVersion::Zip225 => v5_signature_hash(tx, signable_input, txid_parts), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ TxVersion::Zsa => { + #[cfg(zcash_unstable = "nu7")] TxVersion::Zsa => { v7_signature_hash(tx, signable_input, txid_parts) } diff --git a/zcash_primitives/src/transaction/sighash_v5.rs b/zcash_primitives/src/transaction/sighash_v5.rs index 62a6827bc..991fa2440 100644 --- a/zcash_primitives/src/transaction/sighash_v5.rs +++ b/zcash_primitives/src/transaction/sighash_v5.rs @@ -197,7 +197,7 @@ pub fn v5_signature_hash< ), txid_parts.sapling_digest, txid_parts.orchard_digest, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ txid_parts.issue_digest, + #[cfg(zcash_unstable = "nu7")] txid_parts.issue_digest, #[cfg(zcash_unstable = "zfuture")] tx.tze_bundle .as_ref() diff --git a/zcash_primitives/src/transaction/tests.rs b/zcash_primitives/src/transaction/tests.rs index fabe6b8b2..f5257cb84 100644 --- a/zcash_primitives/src/transaction/tests.rs +++ b/zcash_primitives/src/transaction/tests.rs @@ -56,12 +56,12 @@ fn check_roundtrip(tx: Transaction) -> Result<(), TestCaseError> { tx.orchard_bundle.as_ref().map(|v| *v.value_balance()), txo.orchard_bundle.as_ref().map(|v| *v.value_balance()) ); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] prop_assert_eq!( tx.orchard_zsa_bundle.as_ref().map(|v| *v.value_balance()), txo.orchard_zsa_bundle.as_ref().map(|v| *v.value_balance()) ); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] if tx.issue_bundle.is_some() { prop_assert_eq!(tx.issue_bundle.as_ref(), txo.issue_bundle.as_ref()); } @@ -130,7 +130,7 @@ proptest! { } } -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ +#[cfg(zcash_unstable = "nu7")] proptest! { #![proptest_config(ProptestConfig::with_cases(10))] #[test] @@ -221,10 +221,10 @@ impl Authorization for TestUnauthorized { type SaplingAuth = sapling::bundle::Authorized; type OrchardAuth = orchard::bundle::Authorized; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type OrchardZsaAuth = orchard::bundle::Authorized; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type IssueAuth = orchard::issuance::Signed; #[cfg(zcash_unstable = "zfuture")] @@ -294,8 +294,8 @@ fn zip_0244() { txdata.sprout_bundle().cloned(), txdata.sapling_bundle().cloned(), txdata.orchard_bundle().cloned(), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ txdata.orchard_zsa_bundle().cloned(), - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ txdata.issue_bundle().cloned(), + #[cfg(zcash_unstable = "nu7")] txdata.orchard_zsa_bundle().cloned(), + #[cfg(zcash_unstable = "nu7")] txdata.issue_bundle().cloned(), ); #[cfg(zcash_unstable = "zfuture")] let tdata = TransactionData::from_parts_zfuture( diff --git a/zcash_primitives/src/transaction/txid.rs b/zcash_primitives/src/transaction/txid.rs index 670e36d97..a3524a3ae 100644 --- a/zcash_primitives/src/transaction/txid.rs +++ b/zcash_primitives/src/transaction/txid.rs @@ -7,7 +7,7 @@ use byteorder::{LittleEndian, WriteBytesExt}; use ff::PrimeField; use orchard::bundle; use orchard::orchard_flavor::OrchardVanilla; -#[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ +#[cfg(zcash_unstable = "nu7")] use orchard::{ issuance::{IssueBundle, Signed}, orchard_flavor::OrchardZSA, @@ -309,7 +309,7 @@ impl TransactionDigest for TxIdDigester { type TransparentDigest = Option>; type SaplingDigest = Option; type OrchardDigest = Option; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type IssueDigest = Option; #[cfg(zcash_unstable = "zfuture")] @@ -348,7 +348,7 @@ impl TransactionDigest for TxIdDigester { orchard_bundle.map(|b| b.commitment().0) } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn digest_orchard_zsa( &self, orchard_bundle: Option<&bundle::Bundle>, @@ -356,7 +356,7 @@ impl TransactionDigest for TxIdDigester { orchard_bundle.map(|b| b.commitment().0) } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn digest_issue(&self, issue_bundle: Option<&IssueBundle>) -> Self::IssueDigest { issue_bundle.map(|b| b.commitment().0) } @@ -372,7 +372,7 @@ impl TransactionDigest for TxIdDigester { transparent_digests: Self::TransparentDigest, sapling_digest: Self::SaplingDigest, orchard_digest: Self::OrchardDigest, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ issue_digest: Self::IssueDigest, + #[cfg(zcash_unstable = "nu7")] issue_digest: Self::IssueDigest, #[cfg(zcash_unstable = "zfuture")] tze_digests: Self::TzeDigest, ) -> Self::Digest { TxDigests { @@ -380,7 +380,7 @@ impl TransactionDigest for TxIdDigester { transparent_digests, sapling_digest, orchard_digest, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] issue_digest, #[cfg(zcash_unstable = "zfuture")] tze_digests, @@ -396,7 +396,7 @@ pub(crate) fn to_hash( transparent_digest: Blake2bHash, sapling_digest: Option, orchard_digest: Option, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ issue_digest: Option, + #[cfg(zcash_unstable = "nu7")] issue_digest: Option, #[cfg(zcash_unstable = "zfuture")] tze_digests: Option<&TzeDigests>, ) -> Blake2bHash { let mut personal = [0; 16]; @@ -421,7 +421,7 @@ pub(crate) fn to_hash( ) .unwrap(); - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] if _txversion.has_zsa() { h.write_all( issue_digest @@ -452,7 +452,7 @@ pub fn to_txid( hash_transparent_txid_data(digests.transparent_digests.as_ref()), digests.sapling_digest, digests.orchard_digest, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ digests.issue_digest, + #[cfg(zcash_unstable = "nu7")] digests.issue_digest, #[cfg(zcash_unstable = "zfuture")] digests.tze_digests.as_ref(), ); @@ -474,7 +474,7 @@ impl TransactionDigest for BlockTxCommitmentDigester { type SaplingDigest = Blake2bHash; type OrchardDigest = Blake2bHash; - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] type IssueDigest = Blake2bHash; #[cfg(zcash_unstable = "zfuture")] @@ -539,7 +539,7 @@ impl TransactionDigest for BlockTxCommitmentDigester { }) } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn digest_orchard_zsa( &self, orchard_bundle: Option<&bundle::Bundle>, @@ -549,7 +549,7 @@ impl TransactionDigest for BlockTxCommitmentDigester { }) } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] fn digest_issue(&self, issue_bundle: Option<&IssueBundle>) -> Self::IssueDigest { issue_bundle.map_or_else(bundle::commitments::hash_issue_bundle_auth_empty, |b| { b.authorizing_commitment().0 @@ -573,7 +573,7 @@ impl TransactionDigest for BlockTxCommitmentDigester { transparent_digest: Self::TransparentDigest, sapling_digest: Self::SaplingDigest, orchard_digest: Self::OrchardDigest, - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ issue_digest: Self::IssueDigest, + #[cfg(zcash_unstable = "nu7")] issue_digest: Self::IssueDigest, #[cfg(zcash_unstable = "zfuture")] tze_digest: Self::TzeDigest, ) -> Self::Digest { let digests = [transparent_digest, sapling_digest, orchard_digest]; @@ -589,7 +589,7 @@ impl TransactionDigest for BlockTxCommitmentDigester { h.write_all(digest.as_bytes()).unwrap(); } - #[cfg(zcash_unstable = "nu6")] /* TODO nu7 */ + #[cfg(zcash_unstable = "nu7")] if TxVersion::suggested_for_branch(consensus_branch_id).has_zsa() { h.write_all(issue_digest.as_bytes()).unwrap(); }