Use tx-v6 feature across all crates
This commit is contained in:
parent
e2e160cc60
commit
763cded7ed
|
@ -63,7 +63,7 @@ bench = ["zebra-test"]
|
|||
|
||||
# Support for transaction version 6
|
||||
tx-v6 = [
|
||||
"nonempty"
|
||||
"nonempty"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -17,4 +17,5 @@ pub const TX_V5_VERSION_GROUP_ID: u32 = 0x26A7_270A;
|
|||
/// Orchard transactions must use transaction version 5 and this version
|
||||
/// group ID.
|
||||
// FIXME: use a proper value!
|
||||
#[cfg(feature = "tx-v6")]
|
||||
pub const TX_V6_VERSION_GROUP_ID: u32 = 0x26A7_270B;
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::{
|
|||
amount::{Amount, NonNegative},
|
||||
parameters::{ConsensusBranchId, Network},
|
||||
serialization::ZcashSerialize,
|
||||
transaction::{AuthDigest, HashType, SigHash, Transaction},
|
||||
transaction::{tx_v5_and_v6, AuthDigest, HashType, SigHash, Transaction},
|
||||
transparent::{self, Script},
|
||||
};
|
||||
|
||||
|
@ -183,10 +183,7 @@ impl TryFrom<&Transaction> for zp_tx::Transaction {
|
|||
#[allow(clippy::unwrap_in_result)]
|
||||
fn try_from(trans: &Transaction) -> Result<Self, Self::Error> {
|
||||
let network_upgrade = match trans {
|
||||
Transaction::V5 {
|
||||
network_upgrade, ..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
network_upgrade, ..
|
||||
} => network_upgrade,
|
||||
Transaction::V1 { .. }
|
||||
|
|
|
@ -105,18 +105,21 @@ macro_rules! orchard_shielded_data_field {
|
|||
|
||||
// FIXME:
|
||||
// Define the macro for including the V6 pattern
|
||||
//#[cfg(feature = "tx-v6")]
|
||||
macro_rules! with_v6 {
|
||||
() => {
|
||||
| Transaction::V6 { expiry_height, .. }
|
||||
#[cfg(feature = "tx-v6")]
|
||||
macro_rules! tx_v5_and_v6 {
|
||||
{ $($fields:tt)* } => {
|
||||
Transaction::V5 { $($fields)* } | Transaction::V6 { $($fields)* }
|
||||
};
|
||||
}
|
||||
|
||||
// FIXME:
|
||||
//#[cfg(not(feature = "tx-v6"))]
|
||||
//macro_rules! with_v6 {
|
||||
// () => {};
|
||||
//}
|
||||
#[cfg(not(feature = "tx-v6"))]
|
||||
macro_rules! tx_v5_and_v6 {
|
||||
{ $($fields:tt)* } => {
|
||||
Transaction::V5 { $($fields)* }
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) use tx_v5_and_v6;
|
||||
|
||||
/// A Zcash transaction.
|
||||
///
|
||||
|
@ -339,9 +342,7 @@ impl Transaction {
|
|||
| Transaction::V2 { .. }
|
||||
| Transaction::V3 { .. }
|
||||
| Transaction::V4 { .. } => None,
|
||||
Transaction::V5 { .. } => Some(AuthDigest::from(self)),
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 { .. } => Some(AuthDigest::from(self)),
|
||||
tx_v5_and_v6! { .. } => Some(AuthDigest::from(self)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,9 +415,7 @@ impl Transaction {
|
|||
pub fn is_overwintered(&self) -> bool {
|
||||
match self {
|
||||
Transaction::V1 { .. } | Transaction::V2 { .. } => false,
|
||||
Transaction::V3 { .. } | Transaction::V4 { .. } | Transaction::V5 { .. } => true,
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 { .. } => true,
|
||||
Transaction::V3 { .. } | Transaction::V4 { .. } | tx_v5_and_v6! { .. } => true,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,9 +439,7 @@ impl Transaction {
|
|||
| Transaction::V2 { lock_time, .. }
|
||||
| Transaction::V3 { lock_time, .. }
|
||||
| Transaction::V4 { lock_time, .. }
|
||||
| Transaction::V5 { lock_time, .. } => *lock_time,
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 { lock_time, .. } => *lock_time,
|
||||
| tx_v5_and_v6! { lock_time, .. } => *lock_time,
|
||||
};
|
||||
|
||||
// `zcashd` checks that the block height is greater than the lock height.
|
||||
|
@ -489,9 +486,7 @@ impl Transaction {
|
|||
| Transaction::V2 { lock_time, .. }
|
||||
| Transaction::V3 { lock_time, .. }
|
||||
| Transaction::V4 { lock_time, .. }
|
||||
| Transaction::V5 { lock_time, .. } => *lock_time,
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 { lock_time, .. } => *lock_time,
|
||||
| tx_v5_and_v6! { lock_time, .. } => *lock_time,
|
||||
};
|
||||
let mut lock_time_bytes = Vec::new();
|
||||
lock_time
|
||||
|
@ -521,8 +516,7 @@ impl Transaction {
|
|||
Transaction::V1 { .. } | Transaction::V2 { .. } => None,
|
||||
Transaction::V3 { expiry_height, .. }
|
||||
| Transaction::V4 { expiry_height, .. }
|
||||
| Transaction::V5 { expiry_height, .. }
|
||||
| Transaction::V6 { expiry_height, .. } => match expiry_height {
|
||||
| tx_v5_and_v6! { expiry_height, .. } => match expiry_height {
|
||||
// Consensus rule:
|
||||
// > No limit: To set no limit on transactions (so that they do not expire), nExpiryHeight should be set to 0.
|
||||
// https://zips.z.cash/zip-0203#specification
|
||||
|
@ -551,11 +545,7 @@ impl Transaction {
|
|||
ref mut expiry_height,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 {
|
||||
ref mut expiry_height,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
| tx_v5_and_v6! {
|
||||
ref mut expiry_height,
|
||||
..
|
||||
} => expiry_height,
|
||||
|
@ -572,10 +562,7 @@ impl Transaction {
|
|||
| Transaction::V2 { .. }
|
||||
| Transaction::V3 { .. }
|
||||
| Transaction::V4 { .. } => None,
|
||||
Transaction::V5 {
|
||||
network_upgrade, ..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
network_upgrade, ..
|
||||
} => Some(*network_upgrade),
|
||||
}
|
||||
|
@ -590,8 +577,7 @@ impl Transaction {
|
|||
Transaction::V2 { ref inputs, .. } => inputs,
|
||||
Transaction::V3 { ref inputs, .. } => inputs,
|
||||
Transaction::V4 { ref inputs, .. } => inputs,
|
||||
Transaction::V5 { ref inputs, .. } => inputs,
|
||||
Transaction::V6 { ref inputs, .. } => inputs,
|
||||
tx_v5_and_v6! { ref inputs, .. } => inputs,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -603,8 +589,7 @@ impl Transaction {
|
|||
Transaction::V2 { ref mut inputs, .. } => inputs,
|
||||
Transaction::V3 { ref mut inputs, .. } => inputs,
|
||||
Transaction::V4 { ref mut inputs, .. } => inputs,
|
||||
Transaction::V5 { ref mut inputs, .. } => inputs,
|
||||
Transaction::V6 { ref mut inputs, .. } => inputs,
|
||||
tx_v5_and_v6! { ref mut inputs, .. } => inputs,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,8 +607,7 @@ impl Transaction {
|
|||
Transaction::V2 { ref outputs, .. } => outputs,
|
||||
Transaction::V3 { ref outputs, .. } => outputs,
|
||||
Transaction::V4 { ref outputs, .. } => outputs,
|
||||
Transaction::V5 { ref outputs, .. } => outputs,
|
||||
Transaction::V6 { ref outputs, .. } => outputs,
|
||||
tx_v5_and_v6! { ref outputs, .. } => outputs,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,10 +627,7 @@ impl Transaction {
|
|||
Transaction::V4 {
|
||||
ref mut outputs, ..
|
||||
} => outputs,
|
||||
Transaction::V5 {
|
||||
ref mut outputs, ..
|
||||
} => outputs,
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
ref mut outputs, ..
|
||||
} => outputs,
|
||||
}
|
||||
|
@ -696,8 +677,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => Box::new(std::iter::empty()),
|
||||
| tx_v5_and_v6! { .. } => Box::new(std::iter::empty()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -732,8 +712,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => 0,
|
||||
| tx_v5_and_v6! { .. } => 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -772,8 +751,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => Box::new(std::iter::empty()),
|
||||
| tx_v5_and_v6! { .. } => Box::new(std::iter::empty()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -809,8 +787,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => None,
|
||||
| tx_v5_and_v6! { .. } => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -818,7 +795,7 @@ impl Transaction {
|
|||
pub fn has_sprout_joinsplit_data(&self) -> bool {
|
||||
match self {
|
||||
// No JoinSplits
|
||||
Transaction::V1 { .. } | Transaction::V5 { .. } | Transaction::V6 { .. } => false,
|
||||
Transaction::V1 { .. } | tx_v5_and_v6! { .. } => false,
|
||||
|
||||
// JoinSplits-on-BCTV14
|
||||
Transaction::V2 { joinsplit_data, .. } | Transaction::V3 { joinsplit_data, .. } => {
|
||||
|
@ -865,8 +842,7 @@ impl Transaction {
|
|||
..
|
||||
}
|
||||
| Transaction::V1 { .. }
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => Box::new(std::iter::empty()),
|
||||
| tx_v5_and_v6! { .. } => Box::new(std::iter::empty()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -883,12 +859,7 @@ impl Transaction {
|
|||
..
|
||||
} => Box::new(sapling_shielded_data.anchors()),
|
||||
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.anchors()),
|
||||
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.anchors()),
|
||||
|
@ -901,11 +872,7 @@ impl Transaction {
|
|||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
| tx_v5_and_v6! {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
} => Box::new(std::iter::empty()),
|
||||
|
@ -930,11 +897,7 @@ impl Transaction {
|
|||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.spends_per_anchor()),
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.spends_per_anchor()),
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.spends_per_anchor()),
|
||||
|
@ -947,11 +910,7 @@ impl Transaction {
|
|||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
| tx_v5_and_v6! {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
} => Box::new(std::iter::empty()),
|
||||
|
@ -966,11 +925,7 @@ impl Transaction {
|
|||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.outputs()),
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.outputs()),
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.outputs()),
|
||||
|
@ -983,11 +938,7 @@ impl Transaction {
|
|||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
| tx_v5_and_v6! {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
} => Box::new(std::iter::empty()),
|
||||
|
@ -1004,11 +955,7 @@ impl Transaction {
|
|||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.nullifiers()),
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.nullifiers()),
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.nullifiers()),
|
||||
|
@ -1021,11 +968,7 @@ impl Transaction {
|
|||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
| tx_v5_and_v6! {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
} => Box::new(std::iter::empty()),
|
||||
|
@ -1042,11 +985,7 @@ impl Transaction {
|
|||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.note_commitments()),
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.note_commitments()),
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Box::new(sapling_shielded_data.note_commitments()),
|
||||
|
@ -1059,11 +998,7 @@ impl Transaction {
|
|||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
| tx_v5_and_v6! {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
} => Box::new(std::iter::empty()),
|
||||
|
@ -1078,11 +1013,7 @@ impl Transaction {
|
|||
sapling_shielded_data,
|
||||
..
|
||||
} => sapling_shielded_data.is_some(),
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data,
|
||||
..
|
||||
} => sapling_shielded_data.is_some(),
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data,
|
||||
..
|
||||
} => sapling_shielded_data.is_some(),
|
||||
|
@ -1212,8 +1143,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => Box::new(std::iter::empty()),
|
||||
| tx_v5_and_v6! { .. } => Box::new(std::iter::empty()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1262,8 +1192,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => Box::new(std::iter::empty()),
|
||||
| tx_v5_and_v6! { .. } => Box::new(std::iter::empty()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1310,8 +1239,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => Box::new(std::iter::empty()),
|
||||
| tx_v5_and_v6! { .. } => Box::new(std::iter::empty()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1360,8 +1288,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => Box::new(std::iter::empty()),
|
||||
| tx_v5_and_v6! { .. } => Box::new(std::iter::empty()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1402,8 +1329,7 @@ impl Transaction {
|
|||
joinsplit_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 { .. }
|
||||
| Transaction::V6 { .. } => Box::new(iter::empty()),
|
||||
| tx_v5_and_v6! { .. } => Box::new(iter::empty()),
|
||||
};
|
||||
|
||||
joinsplit_value_balances.map(ValueBalance::from_sprout_amount)
|
||||
|
@ -1441,11 +1367,7 @@ impl Transaction {
|
|||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => sapling_shielded_data.value_balance,
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => sapling_shielded_data.value_balance,
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => sapling_shielded_data.value_balance,
|
||||
|
@ -1457,11 +1379,7 @@ impl Transaction {
|
|||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
| tx_v5_and_v6! {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
} => Amount::zero(),
|
||||
|
@ -1481,11 +1399,7 @@ impl Transaction {
|
|||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Some(&mut sapling_shielded_data.value_balance),
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Some(&mut sapling_shielded_data.value_balance),
|
||||
Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data: Some(sapling_shielded_data),
|
||||
..
|
||||
} => Some(&mut sapling_shielded_data.value_balance),
|
||||
|
@ -1496,11 +1410,7 @@ impl Transaction {
|
|||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V5 {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
| tx_v5_and_v6! {
|
||||
sapling_shielded_data: None,
|
||||
..
|
||||
} => None,
|
||||
|
@ -1537,6 +1447,7 @@ impl Transaction {
|
|||
..
|
||||
} => Some(&mut orchard_shielded_data.value_balance),
|
||||
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 {
|
||||
orchard_shielded_data: Some(orchard_shielded_data),
|
||||
..
|
||||
|
@ -1549,8 +1460,10 @@ impl Transaction {
|
|||
| Transaction::V5 {
|
||||
orchard_shielded_data: None,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
} => None,
|
||||
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 {
|
||||
orchard_shielded_data: None,
|
||||
..
|
||||
} => None,
|
||||
|
|
|
@ -722,6 +722,7 @@ impl Arbitrary for orchard::ShieldedData<orchard::OrchardVanilla> {
|
|||
.try_into()
|
||||
.expect("arbitrary vector size range produces at least one action"),
|
||||
binding_sig: binding_sig.0,
|
||||
#[cfg(feature = "tx-v6")]
|
||||
burn: Default::default(),
|
||||
},
|
||||
)
|
||||
|
@ -919,6 +920,7 @@ pub fn transaction_to_fake_v5(
|
|||
orchard_shielded_data: None,
|
||||
},
|
||||
v5 @ V5 { .. } => v5.clone(),
|
||||
#[cfg(feature = "tx-v6")]
|
||||
V6 {
|
||||
inputs,
|
||||
outputs,
|
||||
|
@ -1077,6 +1079,7 @@ pub fn insert_fake_orchard_shielded_data(
|
|||
proof: Halo2Proof(vec![]),
|
||||
actions: at_least_one![dummy_authorized_action],
|
||||
binding_sig: Signature::from([0u8; 64]),
|
||||
#[cfg(feature = "tx-v6")]
|
||||
burn: Default::default(),
|
||||
};
|
||||
|
||||
|
|
|
@ -12,10 +12,7 @@ use crate::{
|
|||
amount,
|
||||
block::MAX_BLOCK_BYTES,
|
||||
orchard::OrchardFlavorExt,
|
||||
parameters::{
|
||||
OVERWINTER_VERSION_GROUP_ID, SAPLING_VERSION_GROUP_ID, TX_V5_VERSION_GROUP_ID,
|
||||
TX_V6_VERSION_GROUP_ID,
|
||||
},
|
||||
parameters::{OVERWINTER_VERSION_GROUP_ID, SAPLING_VERSION_GROUP_ID, TX_V5_VERSION_GROUP_ID},
|
||||
primitives::{Halo2Proof, ZkSnarkProof},
|
||||
serialization::{
|
||||
zcash_deserialize_external_count, zcash_serialize_empty_list,
|
||||
|
@ -24,6 +21,9 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
#[cfg(feature = "tx-v6")]
|
||||
use crate::parameters::TX_V6_VERSION_GROUP_ID;
|
||||
|
||||
use super::*;
|
||||
use crate::sapling;
|
||||
|
||||
|
@ -689,6 +689,7 @@ impl ZcashSerialize for Transaction {
|
|||
orchard_shielded_data.zcash_serialize(&mut writer)?;
|
||||
}
|
||||
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 {
|
||||
network_upgrade,
|
||||
lock_time,
|
||||
|
@ -997,6 +998,7 @@ impl ZcashDeserialize for Transaction {
|
|||
})
|
||||
}
|
||||
// FIXME: implement a proper deserialization for V6
|
||||
#[cfg(feature = "tx-v6")]
|
||||
(6, true) => {
|
||||
// FIXME: fix spec or use another link as the current version of the PDF
|
||||
// doesn't contain V6 description.
|
||||
|
|
|
@ -988,11 +988,7 @@ fn binding_signatures_for_network(network: Network) {
|
|||
.expect("must pass verification");
|
||||
}
|
||||
}
|
||||
Transaction::V5 {
|
||||
sapling_shielded_data,
|
||||
..
|
||||
}
|
||||
| Transaction::V6 {
|
||||
tx_v5_and_v6! {
|
||||
sapling_shielded_data,
|
||||
..
|
||||
} => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//! from the transaction.
|
||||
use std::io;
|
||||
|
||||
use super::{Hash, Transaction};
|
||||
use super::{tx_v5_and_v6, Hash, Transaction};
|
||||
use crate::serialization::{sha256d, ZcashSerialize};
|
||||
|
||||
/// A Transaction ID builder. It computes the transaction ID by hashing
|
||||
|
@ -28,7 +28,7 @@ impl<'a> TxIdBuilder<'a> {
|
|||
| Transaction::V2 { .. }
|
||||
| Transaction::V3 { .. }
|
||||
| Transaction::V4 { .. } => self.txid_v1_to_v4(),
|
||||
Transaction::V5 { .. } | Transaction::V6 { .. } => self.txid_v5_v6(),
|
||||
tx_v5_and_v6! { .. } => self.txid_v5_v6(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ use crate::{
|
|||
amount::{Amount, NonNegative},
|
||||
serialization::ZcashSerialize,
|
||||
transaction::{
|
||||
AuthDigest, Hash,
|
||||
tx_v5_and_v6, AuthDigest, Hash,
|
||||
Transaction::{self, *},
|
||||
WtxId,
|
||||
},
|
||||
|
@ -140,7 +140,7 @@ impl From<&Transaction> for UnminedTxId {
|
|||
fn from(transaction: &Transaction) -> Self {
|
||||
match transaction {
|
||||
V1 { .. } | V2 { .. } | V3 { .. } | V4 { .. } => Legacy(transaction.into()),
|
||||
V5 { .. } | V6 { .. } => Witnessed(transaction.into()),
|
||||
tx_v5_and_v6! { .. } => Witnessed(transaction.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ categories = ["asynchronous", "cryptography::cryptocurrencies"]
|
|||
|
||||
[features]
|
||||
default = []
|
||||
#default = ["tx-v6"]
|
||||
|
||||
# Production features that activate extra dependencies, or extra features in dependencies
|
||||
|
||||
|
@ -34,6 +35,12 @@ getblocktemplate-rpcs = [
|
|||
# Test-only features
|
||||
proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl", "zebra-state/proptest-impl"]
|
||||
|
||||
# Support for transaction version 6
|
||||
tx-v6 = [
|
||||
"zebra-state/tx-v6",
|
||||
"zebra-chain/tx-v6"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
blake2b_simd = "1.0.2"
|
||||
bellman = "0.14.0"
|
||||
|
|
|
@ -108,6 +108,7 @@ fn generate_test_vectors() {
|
|||
.unwrap(),
|
||||
binding_sig: <[u8; 64]>::from(bundle.authorization().binding_signature()).into(),
|
||||
// FIXME: use a proper value when implementing V6
|
||||
#[cfg(feature = "tx-v6")]
|
||||
burn: Default::default(),
|
||||
}
|
||||
})
|
||||
|
|
|
@ -415,7 +415,8 @@ where
|
|||
orchard_shielded_data,
|
||||
)?,
|
||||
// FIXME: implement proper V6 verification
|
||||
| Transaction::V6 {
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 {
|
||||
..
|
||||
} => {
|
||||
tracing::debug!(?tx, "V6 transaction verification is not supported for now");
|
||||
|
|
|
@ -15,6 +15,8 @@ keywords = ["zebra", "zcash"]
|
|||
categories = ["asynchronous", "caching", "cryptography::cryptocurrencies"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
#default = ["tx-v6"]
|
||||
|
||||
# Production features that activate extra dependencies, or extra features in dependencies
|
||||
|
||||
|
@ -45,6 +47,11 @@ elasticsearch = [
|
|||
"zebra-chain/elasticsearch",
|
||||
]
|
||||
|
||||
# Support for transaction version 6
|
||||
tx-v6 = [
|
||||
"zebra-chain/tx-v6"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
bincode = "1.3.3"
|
||||
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std"] }
|
||||
|
|
|
@ -1521,6 +1521,7 @@ impl Chain {
|
|||
sapling_shielded_data,
|
||||
orchard_shielded_data,
|
||||
),
|
||||
#[cfg(feature ="tx-v6")]
|
||||
V6 {
|
||||
inputs,
|
||||
outputs,
|
||||
|
@ -1697,6 +1698,7 @@ impl UpdateWith<ContextuallyVerifiedBlock> for Chain {
|
|||
sapling_shielded_data,
|
||||
orchard_shielded_data,
|
||||
),
|
||||
#[cfg(feature = "tx-v6")]
|
||||
V6 {
|
||||
inputs,
|
||||
outputs,
|
||||
|
|
|
@ -34,6 +34,7 @@ impl FakeChainHelper for Arc<Block> {
|
|||
Transaction::V3 { inputs, .. } => &mut inputs[0],
|
||||
Transaction::V4 { inputs, .. } => &mut inputs[0],
|
||||
Transaction::V5 { inputs, .. } => &mut inputs[0],
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 { inputs, .. } => &mut inputs[0],
|
||||
};
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ features = [
|
|||
|
||||
[features]
|
||||
# In release builds, don't compile debug logging code, to improve performance.
|
||||
default = ["release_max_level_info", "progress-bar", "getblocktemplate-rpcs"]
|
||||
#default = ["release_max_level_info", "progress-bar", "getblocktemplate-rpcs"]
|
||||
default = ["release_max_level_info", "progress-bar", "getblocktemplate-rpcs", "tx-v6"]
|
||||
|
||||
# Default features for official ZF binary release builds
|
||||
default-release-binaries = ["default", "sentry"]
|
||||
|
@ -156,6 +157,13 @@ test_sync_to_mandatory_checkpoint_testnet = []
|
|||
test_sync_past_mandatory_checkpoint_mainnet = []
|
||||
test_sync_past_mandatory_checkpoint_testnet = []
|
||||
|
||||
# Support for transaction version 6
|
||||
tx-v6 = [
|
||||
"zebra-consensus/tx-v6",
|
||||
"zebra-state/tx-v6",
|
||||
"zebra-chain/tx-v6"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.39" }
|
||||
zebra-consensus = { path = "../zebra-consensus", version = "1.0.0-beta.39" }
|
||||
|
|
|
@ -568,7 +568,11 @@ impl SpendConflictTestInput {
|
|||
}
|
||||
|
||||
// No JoinSplits
|
||||
Transaction::V1 { .. } | Transaction::V5 { .. } | Transaction::V6 { .. } => {}
|
||||
Transaction::V1 { .. } | Transaction::V5 { .. } => {}
|
||||
|
||||
// No JoinSplits
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 { .. } => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -635,8 +639,12 @@ impl SpendConflictTestInput {
|
|||
Transaction::V5 {
|
||||
sapling_shielded_data,
|
||||
..
|
||||
} => {
|
||||
Self::remove_sapling_transfers_with_conflicts(sapling_shielded_data, &conflicts)
|
||||
}
|
||||
| Transaction::V6 {
|
||||
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 {
|
||||
sapling_shielded_data,
|
||||
..
|
||||
} => {
|
||||
|
@ -715,6 +723,7 @@ impl SpendConflictTestInput {
|
|||
} => Self::remove_orchard_actions_with_conflicts(orchard_shielded_data, &conflicts),
|
||||
|
||||
// FIXME: implement for V6
|
||||
#[cfg(feature = "tx-v6")]
|
||||
Transaction::V6 {
|
||||
orchard_shielded_data: _,
|
||||
..
|
||||
|
|
Loading…
Reference in New Issue