Skip to content

Commit e87f997

Browse files
committed
Merge branch 'zsa-integration-proptest' into zsa-integration-issuance-commitments
2 parents 9ad18a4 + 10d19d4 commit e87f997

File tree

6 files changed

+13
-38
lines changed

6 files changed

+13
-38
lines changed

zebra-chain/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ bitflags = "2.5.0"
7575
bitflags-serde-legacy = "0.1.1"
7676
blake2b_simd = "1.0.2"
7777
blake2s_simd = "1.0.2"
78+
# TODO: Revert to "0.6.0" (or appropriate version) when the ZSA orchard fork is updated.
7879
bridgetree = "0.4.0"
7980
bs58 = { version = "0.5.1", features = ["check"] }
8081
byteorder = "1.5.0"
@@ -190,7 +191,3 @@ required-features = ["bench"]
190191
[[bench]]
191192
name = "redpallas"
192193
harness = false
193-
194-
# FIXME: remove this and all zcash_unstable usage in the code after updating librustzcash
195-
#[lints.rust]
196-
#unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nu6"))'] }

zebra-chain/src/orchard/shielded_data.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ bitflags! {
313313
const ENABLE_SPENDS = 0b00000001;
314314
/// Enable creating new non-zero valued Orchard notes.
315315
const ENABLE_OUTPUTS = 0b00000010;
316+
/// Enable ZSA transactions.
317+
const ENABLE_ZSA = 0b00000100;
316318
}
317319
}
318320

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 this cfg
534-
//#[cfg(zcash_unstable = "nu6")]
535533
zcash_protocol::consensus::NetworkUpgrade::Nu6 => Self::Nu6,
536-
// FIXME: remove this 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 & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ impl zp_tx::components::orchard::MapAuth<orchard::bundle::Authorized, orchard::b
137137
}
138138
}
139139

140-
// FIXME: is this implemetation correct?
141-
// FIXME: remove this cfg
142-
//#[cfg(zcash_unstable = "nu6")]
140+
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
143141
impl zp_tx::components::issuance::MapIssueAuth<orchard::issuance::Signed, orchard::issuance::Signed>
144142
for IdentityMap
145143
{
@@ -158,14 +156,10 @@ impl<'a> zp_tx::Authorization for PrecomputedAuth<'a> {
158156
type SaplingAuth = sapling_crypto::bundle::Authorized;
159157
type OrchardAuth = orchard::bundle::Authorized;
160158

161-
// FIXME: is this correct?
162-
// FIXME: remove this cfg
163-
//#[cfg(zcash_unstable = "nu6")]
159+
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
164160
type OrchardZsaAuth = orchard::bundle::Authorized;
165161

166-
// FIXME: is this correct?
167-
// FIXME: remove this cfg
168-
//#[cfg(zcash_unstable = "nu6")]
162+
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
169163
type IssueAuth = orchard::issuance::Signed;
170164
}
171165

@@ -294,10 +288,8 @@ impl<'a> PrecomputedTxData<'a> {
294288
all_prev_outputs: all_previous_outputs,
295289
},
296290
};
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(
291+
let tx_data: zp_tx::TransactionData<PrecomputedAuth> =
292+
alt_tx.into_data().map_authorization(
301293
f_transparent,
302294
IdentityMap,
303295
IdentityMap,

zebra-consensus/src/primitives/halo2.rs

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

7878
lazy_static::lazy_static! {
7979
/// The halo2 proof verifying key.
80-
// FIXME: support OrchardZSA?
8180
pub static ref VERIFYING_KEY: ItemVerifyingKey = ItemVerifyingKey::build::<<OrchardVanilla as OrchardFlavorExt>::Flavor>();
8281
}
8382

@@ -146,14 +145,8 @@ impl From<&zebra_chain::orchard::ShieldedData<OrchardVanilla>> for Item {
146145
.flags
147146
.contains(zebra_chain::orchard::Flags::ENABLE_OUTPUTS);
148147

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

158151
let instances = shielded_data
159152
.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; OrchardVanilla::ENCRYPTED_NOTE_SIZE]>::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)