Tidy keys::sapling, add commented out Arbitrary impl for now
This commit is contained in:
parent
7402a54379
commit
451e592b28
|
|
@ -15,9 +15,7 @@ use jubjub;
|
||||||
use rand_core::{CryptoRng, RngCore};
|
use rand_core::{CryptoRng, RngCore};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use proptest::prelude::*;
|
use proptest::{arbitrary::Arbitrary, array, prelude::*};
|
||||||
#[cfg(test)]
|
|
||||||
use proptest_derive::Arbitrary;
|
|
||||||
|
|
||||||
// TODO: replace with reference to redjubjub or jubjub when merged and
|
// TODO: replace with reference to redjubjub or jubjub when merged and
|
||||||
// exported.
|
// exported.
|
||||||
|
|
@ -69,11 +67,11 @@ impl From<SpendingKey> for SpendAuthorizationKey {
|
||||||
/// https://zips.z.cash/protocol/protocol.pdf#concreteprfs
|
/// https://zips.z.cash/protocol/protocol.pdf#concreteprfs
|
||||||
fn from(spending_key: SpendingKey) -> SpendAuthorizationKey {
|
fn from(spending_key: SpendingKey) -> SpendAuthorizationKey {
|
||||||
let hash = blake2b_simd::Params::new()
|
let hash = blake2b_simd::Params::new()
|
||||||
.hash_length(64) // Blake2b-512
|
.hash_length(64)
|
||||||
.personal(b"Zcash_ExpandSeed")
|
.personal(b"Zcash_ExpandSeed")
|
||||||
.to_state()
|
.to_state()
|
||||||
.update(&spending_key.0[..])
|
.update(&spending_key.0[..])
|
||||||
.update(&[0]) // t=0
|
.update(&[0])
|
||||||
.finalize();
|
.finalize();
|
||||||
|
|
||||||
Self(Scalar::from_bytes_wide(hash.as_array()))
|
Self(Scalar::from_bytes_wide(hash.as_array()))
|
||||||
|
|
@ -91,13 +89,13 @@ impl Deref for ProofAuthorizingKey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl fmt::Debug for ProofAuthorizingKey {
|
impl fmt::Debug for ProofAuthorizingKey {
|
||||||
// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
// f.debug_tuple("ProofAuthorizingKey")
|
f.debug_tuple("ProofAuthorizingKey")
|
||||||
// .field(&hex::encode(&self.0))
|
.field(&hex::encode(&self.to_bytes()))
|
||||||
// .finish()
|
.finish()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
impl From<SpendingKey> for ProofAuthorizingKey {
|
impl From<SpendingKey> for ProofAuthorizingKey {
|
||||||
/// For this invocation of Blake2b-512 as PRF^expand, t=1.
|
/// For this invocation of Blake2b-512 as PRF^expand, t=1.
|
||||||
|
|
@ -232,6 +230,21 @@ impl fmt::Debug for Diversifier {
|
||||||
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#concretediversifyhash
|
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#concretediversifyhash
|
||||||
pub type TransmissionKey = jubjub::AffinePoint;
|
pub type TransmissionKey = jubjub::AffinePoint;
|
||||||
|
|
||||||
|
// #[cfg(test)]
|
||||||
|
// impl Arbitrary for TransmissionKey {
|
||||||
|
// type Parameters = ();
|
||||||
|
|
||||||
|
// fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
|
||||||
|
// (array::uniform32(any::<u8>()))
|
||||||
|
// .prop_map(|transmission_key_bytes| {
|
||||||
|
// return Self::from_bytes(transmission_key_bytes).unwrap();
|
||||||
|
// })
|
||||||
|
// .boxed()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// type Strategy = BoxedStrategy<Self>;
|
||||||
|
// }
|
||||||
|
|
||||||
/// Full Viewing Keys
|
/// Full Viewing Keys
|
||||||
///
|
///
|
||||||
/// Allows recognizing both incoming and outgoing notes without having
|
/// Allows recognizing both incoming and outgoing notes without having
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue