Skip to content

Commit 9e51b24

Browse files
committed
Merge branch 'zsa-integration-zsadeps' into zsa-integration-txv6
2 parents 9e5a01c + 25c5486 commit 9e51b24

File tree

7 files changed

+13
-37
lines changed

7 files changed

+13
-37
lines changed

zebra-chain/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ bitflags = "2.5.0"
6868
bitflags-serde-legacy = "0.1.1"
6969
blake2b_simd = "1.0.2"
7070
blake2s_simd = "1.0.2"
71+
# TODO: Revert to "0.6.0" (or appropriate version) when the ZSA orchard fork is updated.
7172
bridgetree = "0.4.0"
7273
bs58 = { version = "0.5.1", features = ["check"] }
7374
byteorder = "1.5.0"
@@ -178,7 +179,3 @@ required-features = ["bench"]
178179
[[bench]]
179180
name = "redpallas"
180181
harness = false
181-
182-
# FIXME: remove this and all zcash_unstable usage in the code after updating librustzcash
183-
[lints.rust]
184-
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nu6"))'] }

zebra-chain/src/orchard/note/ciphertexts.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Encrypted parts of Orchard notes.
22
3-
// FIXME: make it a generic and add support for OrchardZSA (encrypted tote size ofr it is not 580!)
4-
53
use std::{fmt, io};
64

75
use serde_big_array::BigArray;

zebra-chain/src/orchard/shielded_data.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ bitflags! {
231231
const ENABLE_SPENDS = 0b00000001;
232232
/// Enable creating new non-zero valued Orchard notes.
233233
const ENABLE_OUTPUTS = 0b00000010;
234+
/// Enable ZSA transactions.
235+
const ENABLE_ZSA = 0b00000100;
234236
}
235237
}
236238

zebra-chain/src/parameters/network_upgrade.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,9 @@ impl From<zcash_protocol::consensus::NetworkUpgrade> for NetworkUpgrade {
530530
zcash_protocol::consensus::NetworkUpgrade::Heartwood => Self::Heartwood,
531531
zcash_protocol::consensus::NetworkUpgrade::Canopy => Self::Canopy,
532532
zcash_protocol::consensus::NetworkUpgrade::Nu5 => Self::Nu5,
533-
// FIXME: remove cfg
534-
#[cfg(zcash_unstable = "nu6")]
535533
zcash_protocol::consensus::NetworkUpgrade::Nu6 => Self::Nu6,
536-
// FIXME: remove cfg and process Nu7 properly (uses Self::Nu6 for now)
537-
#[cfg(zcash_unstable = "nu6")]
534+
// FIXME: TODO: Use a proper value below.
535+
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
538536
zcash_protocol::consensus::NetworkUpgrade::Nu7 => Self::Nu6,
539537
}
540538
}

zebra-chain/src/primitives/zcash_primitives.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ impl zp_tx::components::orchard::MapAuth<orchard::bundle::Authorized, orchard::b
137137
}
138138
}
139139

140-
// FIXME: is this implemetation correct?
141-
#[cfg(zcash_unstable = "nu6")]
140+
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
142141
impl zp_tx::components::issuance::MapIssueAuth<orchard::issuance::Signed, orchard::issuance::Signed>
143142
for IdentityMap
144143
{
@@ -157,12 +156,10 @@ impl<'a> zp_tx::Authorization for PrecomputedAuth<'a> {
157156
type SaplingAuth = sapling_crypto::bundle::Authorized;
158157
type OrchardAuth = orchard::bundle::Authorized;
159158

160-
// FIXME: is this correct?
161-
#[cfg(zcash_unstable = "nu6")]
159+
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
162160
type OrchardZsaAuth = orchard::bundle::Authorized;
163161

164-
// FIXME: is this correct?
165-
#[cfg(zcash_unstable = "nu6")]
162+
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
166163
type IssueAuth = orchard::issuance::Signed;
167164
}
168165

@@ -294,10 +291,8 @@ impl<'a> PrecomputedTxData<'a> {
294291
all_prev_outputs: all_previous_outputs,
295292
},
296293
};
297-
let tx_data: zp_tx::TransactionData<PrecomputedAuth> = alt_tx
298-
.into_data()
299-
// FIXME: do we need to pass another arg values or orchard_zsa and issue instead of IdentityMap?
300-
.map_authorization(
294+
let tx_data: zp_tx::TransactionData<PrecomputedAuth> =
295+
alt_tx.into_data().map_authorization(
301296
f_transparent,
302297
IdentityMap,
303298
IdentityMap,

zebra-consensus/src/primitives/halo2.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ pub type ItemVerifyingKey = VerifyingKey;
7575

7676
lazy_static::lazy_static! {
7777
/// The halo2 proof verifying key.
78-
// FIXME: support OrchardZSA?
7978
pub static ref VERIFYING_KEY: ItemVerifyingKey = ItemVerifyingKey::build::<OrchardVanilla>();
8079
}
8180

@@ -144,14 +143,8 @@ impl From<&zebra_chain::orchard::ShieldedData> for Item {
144143
.flags
145144
.contains(zebra_chain::orchard::Flags::ENABLE_OUTPUTS);
146145

147-
// FIXME: simplify the flags creation - make `Flags::from_parts` method pub?
148-
// FIXME: support OrchardZSA?
149-
let flags = match (enable_spend, enable_output) {
150-
(false, false) => orchard::builder::BundleType::DISABLED.flags(),
151-
(false, true) => orchard::bundle::Flags::SPENDS_DISABLED_WITHOUT_ZSA,
152-
(true, false) => orchard::bundle::Flags::OUTPUTS_DISABLED,
153-
(true, true) => orchard::bundle::Flags::ENABLED_WITHOUT_ZSA,
154-
};
146+
let flags = orchard::bundle::Flags::from_byte(shielded_data.flags.bits())
147+
.expect("type should not have unexpected bits");
155148

156149
let instances = shielded_data
157150
.actions()

zebra-consensus/src/primitives/halo2/tests.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,7 @@ fn generate_test_vectors() {
8888
rk: <[u8; 32]>::from(a.rk()).into(),
8989
cm_x: pallas::Base::from_repr(a.cmx().into()).unwrap(),
9090
ephemeral_key: a.encrypted_note().epk_bytes.try_into().unwrap(),
91-
// FIXME: support OrchardZSA too, 580 works for OrchardVanilla only!
92-
// FIXME: consider more "type safe" way to do the following conversion
93-
// (now it goes through &[u8])
94-
enc_ciphertext: <[u8; 580]>::try_from(
95-
a.encrypted_note().enc_ciphertext.as_ref(),
96-
)
97-
.unwrap()
98-
.into(),
91+
enc_ciphertext: a.encrypted_note().enc_ciphertext.0.into(),
9992
out_ciphertext: a.encrypted_note().out_ciphertext.into(),
10093
};
10194
zebra_chain::orchard::shielded_data::AuthorizedAction {

0 commit comments

Comments
 (0)