Pass rseed to Prover

This commit is contained in:
therealyingtong 2020-08-04 11:23:03 +08:00
parent b34e8b903c
commit 0a47a9dbea
No known key found for this signature in database
GPG Key ID: 179F32A1503D607E
5 changed files with 12 additions and 12 deletions

View File

@ -223,7 +223,7 @@ impl<E: JubjubEngine> PaymentAddress<E> {
}
}
#[derive(Clone, Debug)]
#[derive(Copy, Clone, Debug)]
pub enum Rseed<Fs> {
BeforeZip212(Fs),
AfterZip212([u8; 32]),

View File

@ -2,7 +2,7 @@
use crate::{
jubjub::{edwards, fs::Fs, Unknown},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey, Rseed},
};
use pairing::bls12_381::{Bls12, Fr};
@ -31,7 +31,7 @@ pub trait TxProver {
ctx: &mut Self::SaplingProvingContext,
proof_generation_key: ProofGenerationKey<Bls12>,
diversifier: Diversifier,
rcm: Fs,
rseed: Rseed<Fs>,
ar: Fs,
value: u64,
anchor: Fr,
@ -78,7 +78,7 @@ pub(crate) mod mock {
use crate::{
jubjub::{edwards, fs::Fs, FixedGenerators, Unknown},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey, ValueCommitment},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey, Rseed, ValueCommitment},
};
use crate::{
@ -104,7 +104,7 @@ pub(crate) mod mock {
_ctx: &mut Self::SaplingProvingContext,
proof_generation_key: ProofGenerationKey<Bls12>,
_diversifier: Diversifier,
_rcm: Fs,
_rcm: Rseed<Fs>,
ar: Fs,
value: u64,
_anchor: Fr,

View File

@ -574,7 +574,7 @@ impl<R: RngCore + CryptoRng> Builder<R> {
&mut ctx,
proof_generation_key,
spend.diversifier,
spend.note.rcm(),
spend.note.rseed,
spend.alpha,
spend.note.value,
anchor,

View File

@ -5,7 +5,7 @@ use pairing::bls12_381::{Bls12, Fr};
use std::path::Path;
use zcash_primitives::{
jubjub::{edwards, fs::Fs, Unknown},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey},
primitives::{Diversifier, PaymentAddress, ProofGenerationKey, Rseed},
};
use zcash_primitives::{
merkle_tree::MerklePath,
@ -109,7 +109,7 @@ impl TxProver for LocalTxProver {
ctx: &mut Self::SaplingProvingContext,
proof_generation_key: ProofGenerationKey<Bls12>,
diversifier: Diversifier,
rcm: Fs,
rseed: Rseed<Fs>,
ar: Fs,
value: u64,
anchor: Fr,
@ -125,7 +125,7 @@ impl TxProver for LocalTxProver {
let (proof, cv, rk) = ctx.spend_proof(
proof_generation_key,
diversifier,
rcm,
rseed,
ar,
value,
anchor,

View File

@ -43,7 +43,7 @@ impl SaplingProvingContext {
&mut self,
proof_generation_key: ProofGenerationKey<Bls12>,
diversifier: Diversifier,
rcm: Fs,
rseed: Rseed<Fs>,
ar: Fs,
value: u64,
anchor: Fr,
@ -102,7 +102,7 @@ impl SaplingProvingContext {
.g_d::<Bls12>(params)
.expect("was a valid diversifier before"),
pk_d: payment_address.pk_d().clone(),
rseed: Rseed::BeforeZip212(rcm),
rseed,
};
let nullifier = note.nf(&viewing_key, merkle_path.position, params);
@ -113,7 +113,7 @@ impl SaplingProvingContext {
value_commitment: Some(value_commitment.clone()),
proof_generation_key: Some(proof_generation_key),
payment_address: Some(payment_address),
commitment_randomness: Some(rcm),
commitment_randomness: Some(note.rcm()),
ar: Some(ar),
auth_path: merkle_path
.auth_path