Merge pull request #784 from zcash/temporary-zcashd-bundle-from-parts
Temporarily re-expose ability to construct invalid Sapling bundles
This commit is contained in:
commit
e934316db9
|
@ -7,6 +7,16 @@ and this library adheres to Rust's notion of
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.10.1] - 2023-03-08
|
||||
### Added
|
||||
- Sapling bundle component constructors, behind the `temporary-zcashd` feature
|
||||
flag. These temporarily re-expose the ability to construct invalid Sapling
|
||||
bundles (that was removed in 0.10.0), and will be removed in a future release:
|
||||
- `zcash_primitives::transaction::components::sapling`:
|
||||
- `Bundle::temporary_zcashd_from_parts`
|
||||
- `SpendDescription::temporary_zcashd_from_parts`
|
||||
- `OutputDescription::temporary_zcashd_from_parts`
|
||||
|
||||
## [0.10.0] - 2023-02-01
|
||||
### Added
|
||||
- `zcash_primitives::sapling`:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "zcash_primitives"
|
||||
description = "Rust implementations of the Zcash primitives"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
authors = [
|
||||
"Jack Grigg <jack@z.cash>",
|
||||
"Kris Nuttycombe <kris@electriccoin.co>"
|
||||
|
@ -98,6 +98,7 @@ inferno = ">=0.11, <0.11.5" # MSRV 1.59
|
|||
|
||||
[features]
|
||||
transparent-inputs = ["hdwallet", "ripemd", "secp256k1"]
|
||||
temporary-zcashd = []
|
||||
test-dependencies = ["proptest", "orchard/test-dependencies"]
|
||||
zfuture = []
|
||||
|
||||
|
|
|
@ -105,6 +105,22 @@ pub struct Bundle<A: Authorization> {
|
|||
}
|
||||
|
||||
impl<A: Authorization> Bundle<A> {
|
||||
/// Constructs a `Bundle` from its constituent parts.
|
||||
#[cfg(feature = "temporary-zcashd")]
|
||||
pub fn temporary_zcashd_from_parts(
|
||||
shielded_spends: Vec<SpendDescription<A>>,
|
||||
shielded_outputs: Vec<OutputDescription<A::OutputProof>>,
|
||||
value_balance: Amount,
|
||||
authorization: A,
|
||||
) -> Self {
|
||||
Self::from_parts(
|
||||
shielded_spends,
|
||||
shielded_outputs,
|
||||
value_balance,
|
||||
authorization,
|
||||
)
|
||||
}
|
||||
|
||||
/// Constructs a `Bundle` from its constituent parts.
|
||||
pub(crate) fn from_parts(
|
||||
shielded_spends: Vec<SpendDescription<A>>,
|
||||
|
@ -197,6 +213,25 @@ impl<A: Authorization> std::fmt::Debug for SpendDescription<A> {
|
|||
}
|
||||
|
||||
impl<A: Authorization> SpendDescription<A> {
|
||||
#[cfg(feature = "temporary-zcashd")]
|
||||
pub fn temporary_zcashd_from_parts(
|
||||
cv: ValueCommitment,
|
||||
anchor: bls12_381::Scalar,
|
||||
nullifier: Nullifier,
|
||||
rk: PublicKey,
|
||||
zkproof: A::SpendProof,
|
||||
spend_auth_sig: A::AuthSig,
|
||||
) -> Self {
|
||||
Self {
|
||||
cv,
|
||||
anchor,
|
||||
nullifier,
|
||||
rk,
|
||||
zkproof,
|
||||
spend_auth_sig,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the commitment to the value consumed by this spend.
|
||||
pub fn cv(&self) -> &ValueCommitment {
|
||||
&self.cv
|
||||
|
@ -410,10 +445,27 @@ impl<Proof> OutputDescription<Proof> {
|
|||
pub fn zkproof(&self) -> &Proof {
|
||||
&self.zkproof
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl<Proof> OutputDescription<Proof> {
|
||||
#[cfg(feature = "temporary-zcashd")]
|
||||
pub fn temporary_zcashd_from_parts(
|
||||
cv: ValueCommitment,
|
||||
cmu: ExtractedNoteCommitment,
|
||||
ephemeral_key: EphemeralKeyBytes,
|
||||
enc_ciphertext: [u8; 580],
|
||||
out_ciphertext: [u8; 80],
|
||||
zkproof: Proof,
|
||||
) -> Self {
|
||||
Self::from_parts(
|
||||
cv,
|
||||
cmu,
|
||||
ephemeral_key,
|
||||
enc_ciphertext,
|
||||
out_ciphertext,
|
||||
zkproof,
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "temporary-zcashd"))]
|
||||
pub(crate) fn from_parts(
|
||||
cv: ValueCommitment,
|
||||
cmu: ExtractedNoteCommitment,
|
||||
|
@ -431,6 +483,10 @@ impl<Proof> OutputDescription<Proof> {
|
|||
zkproof,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl<Proof> OutputDescription<Proof> {
|
||||
pub(crate) fn cv_mut(&mut self) -> &mut ValueCommitment {
|
||||
&mut self.cv
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue