Fix `zfuture` build.

This commit is contained in:
Kris Nuttycombe 2024-12-07 12:43:58 -07:00
parent 09951427bd
commit 867267d062
5 changed files with 43 additions and 4 deletions

View File

@ -113,6 +113,8 @@ impl Creator {
| zcash_primitives::transaction::TxVersion::Overwinter => None,
zcash_primitives::transaction::TxVersion::Sapling => Some(SAPLING_TX_VERSION),
zcash_primitives::transaction::TxVersion::Zip225 => Some(V5_TX_VERSION),
#[cfg(zcash_unstable = "zfuture")]
zcash_primitives::transaction::TxVersion::ZFuture => None,
}?;
// Spends and outputs not modifiable.

View File

@ -307,6 +307,8 @@ impl Authorization for EffectsOnly {
type TransparentAuth = transparent::EffectsOnly;
type SaplingAuth = sapling::bundle::EffectsOnly;
type OrchardAuth = orchard::bundle::EffectsOnly;
#[cfg(zcash_unstable = "zfuture")]
type TzeAuth = std::convert::Infallible;
}
/// Errors that can occur while creating signatures for a PCZT.

View File

@ -126,6 +126,8 @@ impl<'a> TransactionExtractor<'a> {
})
.transpose()
},
#[cfg(zcash_unstable = "zfuture")]
|_| unimplemented!("PCZT support for TZEs is not implemented."),
)?;
let tx = tx_data.freeze().expect("v5 tx can't fail here");
@ -152,6 +154,8 @@ impl Authorization for Unbound {
type TransparentAuth = zcash_primitives::transaction::components::transparent::pczt::Unbound;
type SaplingAuth = ::sapling::pczt::Unbound;
type OrchardAuth = ::orchard::pczt::Unbound;
#[cfg(zcash_unstable = "zfuture")]
type TzeAuth = std::convert::Infallible;
}
/// Errors that can occur while extracting a transaction from a PCZT.

View File

@ -491,6 +491,7 @@ mod tests {
builder::{BuildConfig, Builder},
components::{
amount::{Amount, NonNegativeAmount},
transparent::builder::TransparentSigningSet,
tze::{Authorized, Bundle, OutPoint, TzeIn, TzeOut},
},
fees::{fixed, zip317::MINIMUM_FEE},
@ -798,7 +799,9 @@ mod tests {
// create some inputs to spend
let extsk = ExtendedSpendingKey::master(&[]);
let dfvk = extsk.to_diversifiable_full_viewing_key();
let to = extsk.default_address().1;
let sapling_extsks = &[extsk];
let note1 = to.create_note(
sapling::value::NoteValue::from_raw(110000),
Rseed::BeforeZip212(jubjub::Fr::random(&mut rng)),
@ -812,7 +815,7 @@ mod tests {
let mut builder_a = demo_builder(tx_height, witness1.root().into());
builder_a
.add_sapling_spend::<Infallible>(&extsk, note1, witness1.path().unwrap())
.add_sapling_spend::<Infallible>(dfvk.fvk().clone(), note1, witness1.path().unwrap())
.unwrap();
let value = NonNegativeAmount::const_from_u64(100000);
@ -823,7 +826,15 @@ mod tests {
.unwrap();
let res_a = builder_a
.txn_builder
.build_zfuture(OsRng, &prover, &prover, &fee_rule)
.build_zfuture(
&TransparentSigningSet::new(),
sapling_extsks,
&[],
OsRng,
&prover,
&prover,
&fee_rule,
)
.map_err(|e| format!("build failure: {:?}", e))
.unwrap();
let tze_a = res_a.transaction().tze_bundle().unwrap();
@ -844,7 +855,15 @@ mod tests {
.unwrap();
let res_b = builder_b
.txn_builder
.build_zfuture(OsRng, &prover, &prover, &fee_rule)
.build_zfuture(
&TransparentSigningSet::new(),
sapling_extsks,
&[],
OsRng,
&prover,
&prover,
&fee_rule,
)
.map_err(|e| format!("build failure: {:?}", e))
.unwrap();
let tze_b = res_b.transaction().tze_bundle().unwrap();
@ -872,7 +891,15 @@ mod tests {
let res_c = builder_c
.txn_builder
.build_zfuture(OsRng, &prover, &prover, &fee_rule)
.build_zfuture(
&TransparentSigningSet::new(),
sapling_extsks,
&[],
OsRng,
&prover,
&prover,
&fee_rule,
)
.map_err(|e| format!("build failure: {:?}", e))
.unwrap();
let tze_c = res_c.transaction().tze_bundle().unwrap();

View File

@ -20,6 +20,10 @@ pub trait Authorization: Debug {
type Witness: Debug + Clone + PartialEq;
}
impl Authorization for std::convert::Infallible {
type Witness = std::convert::Infallible;
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Authorized;