Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeykoren committed Nov 18, 2024
1 parent 9bcecdc commit 1da25a0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
34 changes: 18 additions & 16 deletions zcash_primitives/src/transaction/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,15 +877,15 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder<
.map_err(Error::OrchardBuild)?
.unwrap();

unproven_orchard_bundle = Some(OrchardBundle::OrchardZSA(bundle));
unproven_orchard_bundle = Some(OrchardBundle::OrchardZSA(Box::new(bundle)));
orchard_meta = meta;
}
} else {
let (bundle, meta) = builder
.build(&mut rng)
.map_err(Error::OrchardBuild)?
.unwrap();
unproven_orchard_bundle = Some(OrchardBundle::OrchardVanilla(bundle));
unproven_orchard_bundle = Some(OrchardBundle::OrchardVanilla(Box::new(bundle)));
orchard_meta = meta;
}
};
Expand Down Expand Up @@ -949,24 +949,26 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder<
.map_err(Error::SaplingBuild)?;

let orchard_bundle: Option<OrchardBundle<_, _>> = match unauthed_tx.orchard_bundle {
Some(OrchardBundle::OrchardVanilla(b)) => Some(OrchardBundle::OrchardVanilla(
b.create_proof(
&orchard::circuit::ProvingKey::build::<OrchardVanilla>(),
&mut rng,
)
.and_then(|b| {
b.apply_signatures(
Some(OrchardBundle::OrchardVanilla(b)) => {
Some(OrchardBundle::OrchardVanilla(Box::new(
b.create_proof(
&orchard::circuit::ProvingKey::build::<OrchardVanilla>(),
&mut rng,
*shielded_sig_commitment.as_ref(),
&self.orchard_saks,
)
})
.unwrap(),
)),
.and_then(|b| {
b.apply_signatures(
&mut rng,
*shielded_sig_commitment.as_ref(),
&self.orchard_saks,
)
})
.unwrap(),
)))
}

#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
Some(OrchardBundle::OrchardZSA(b)) => Some(OrchardBundle::OrchardZSA(
b.create_proof(
Box::new(b.create_proof(
&orchard::circuit::ProvingKey::build::<OrchardZSA>(),
&mut rng,
)
Expand All @@ -978,7 +980,7 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder<
)
})
.unwrap(),
)),
))),

None => None,
Some(_) => unreachable!(),
Expand Down
12 changes: 6 additions & 6 deletions zcash_primitives/src/transaction/components/orchard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ impl<A: Authorization> BuildBundle<A, OrchardVanilla> for OrchardVanilla {
anchor: Anchor,
authorization: A,
) -> OrchardBundle<A, A> {
OrchardBundle::OrchardVanilla(Bundle::from_parts(
OrchardBundle::OrchardVanilla(Box::new(Bundle::from_parts(
actions,
flags,
value_balance,
burn,
anchor,
authorization,
))
)))
}
}

Expand All @@ -90,14 +90,14 @@ impl<A: Authorization> BuildBundle<A, OrchardZSA> for OrchardZSA {
anchor: Anchor,
authorization: A,
) -> OrchardBundle<A, A> {
OrchardBundle::OrchardZSA(orchard::Bundle::from_parts(
OrchardBundle::OrchardZSA(Box::new(orchard::Bundle::from_parts(
actions,
flags,
value_balance,
burn,
anchor,
authorization,
))
)))
}
}

Expand Down Expand Up @@ -424,7 +424,7 @@ pub mod testing {
) -> OrchardBundle<Authorized, Authorized> {
// overwrite the value balance, as we can't guarantee that the
// value doesn't exceed the MAX_MONEY bounds.
OrchardBundle::OrchardVanilla(bundle.try_map_value_balance::<_, (), _>(|_| Ok(orchard_value_balance)).unwrap())
OrchardBundle::OrchardVanilla(Box::new(bundle.try_map_value_balance::<_, (), _>(|_| Ok(orchard_value_balance)).unwrap()))
}
}

Expand All @@ -438,7 +438,7 @@ pub mod testing {
// value doesn't exceed the MAX_MONEY bounds.
let _bundle: Bundle<_, _, OrchardZSA> = bundle.try_map_value_balance::<_, (), _>(|_| Ok(orchard_value_balance)).unwrap();
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
return OrchardBundle::OrchardZSA(_bundle);
return OrchardBundle::OrchardZSA(Box::new(_bundle));
panic!("ZSA is not supported in this version");
}
}
Expand Down
18 changes: 9 additions & 9 deletions zcash_primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ impl PartialEq for Transaction {

#[derive(Debug, Clone)]
pub enum OrchardBundle<V: orchard::bundle::Authorization, Z: orchard::bundle::Authorization> {
OrchardVanilla(Bundle<V, Amount, OrchardVanilla>),
OrchardVanilla(Box<Bundle<V, Amount, OrchardVanilla>>),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
OrchardZSA(Bundle<Z, Amount, OrchardZSA>),
OrchardZSA(Box<Bundle<Z, Amount, OrchardZSA>>),
#[doc(hidden)]
_Phantom(PhantomData<Z>),
}
Expand Down Expand Up @@ -418,15 +418,15 @@ impl<V: orchard::bundle::Authorization, Z: orchard::bundle::Authorization> Orcha
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )] step_zsa: impl FnOnce(&mut R2, Z) -> NZ,
) -> OrchardBundle<NV, NZ> {
match self {
OrchardBundle::OrchardVanilla(b) => {
OrchardBundle::OrchardVanilla(b.map_authorization(context, spend_auth, step))
}
OrchardBundle::OrchardVanilla(b) => OrchardBundle::OrchardVanilla(Box::new(
b.map_authorization(context, spend_auth, step),
)),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
OrchardBundle::OrchardZSA(b) => OrchardBundle::OrchardZSA(b.map_authorization(
OrchardBundle::OrchardZSA(b) => OrchardBundle::OrchardZSA(Box::new(b.map_authorization(
context_zsa,
spend_auth_zsa,
step_zsa,
)),
))),
_ => unreachable!(),
}
}
Expand Down Expand Up @@ -906,7 +906,7 @@ impl Transaction {
transparent_bundle,
sprout_bundle: None,
sapling_bundle,
orchard_bundle: orchard_bundle.map(OrchardBundle::OrchardVanilla),
orchard_bundle: orchard_bundle.map(|b| OrchardBundle::OrchardVanilla(Box::new(b))),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
issue_bundle: None,
#[cfg(zcash_unstable = "zfuture")]
Expand Down Expand Up @@ -962,7 +962,7 @@ impl Transaction {
transparent_bundle,
sprout_bundle: None,
sapling_bundle,
orchard_bundle: orchard_bundle.map(OrchardBundle::OrchardZSA),
orchard_bundle: orchard_bundle.map(|b| OrchardBundle::OrchardZSA(Box::new(b))),
issue_bundle,
#[cfg(zcash_unstable = "zfuture")]
tze_bundle,
Expand Down
4 changes: 1 addition & 3 deletions zcash_primitives/src/transaction/txid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ use super::{
};

#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
use orchard::{
issuance::{IssueBundle, Signed},
};
use orchard::issuance::{IssueBundle, Signed};

#[cfg(zcash_unstable = "zfuture")]
use super::{
Expand Down

0 comments on commit 1da25a0

Please sign in to comment.