This commit is contained in:
Paul 2022-05-22 11:28:56 +03:00
parent f8cb1332d5
commit d337f82916
5 changed files with 14 additions and 12 deletions

View File

@ -126,6 +126,7 @@ pub(crate) mod testing {
use proptest::prelude::*;
use crate::note::NoteType;
use crate::{
note::{
commitment::ExtractedNoteCommitment, nullifier::testing::arb_nullifier,
@ -137,7 +138,6 @@ pub(crate) mod testing {
},
value::{NoteValue, ValueCommitTrapdoor, ValueCommitment},
};
use crate::note::NoteType;
use super::Action;

View File

@ -8,6 +8,7 @@ use nonempty::NonEmpty;
use pasta_curves::pallas;
use rand::{prelude::SliceRandom, CryptoRng, RngCore};
use crate::note::NoteType;
use crate::{
action::Action,
address::Address,
@ -23,7 +24,6 @@ use crate::{
tree::{Anchor, MerklePath},
value::{self, NoteValue, OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum},
};
use crate::note::NoteType;
const MIN_ACTIONS: usize = 2;
@ -369,7 +369,11 @@ impl Builder {
// Verify that bsk and bvk are consistent.
let bvk = (actions.iter().map(|a| a.cv_net()).sum::<ValueCommitment>()
- ValueCommitment::derive(value_balance, ValueCommitTrapdoor::zero(), NoteType::native()))
- ValueCommitment::derive(
value_balance,
ValueCommitTrapdoor::zero(),
NoteType::native(),
))
.into_bvk();
assert_eq!(redpallas::VerificationKey::from(&bsk), bvk);

View File

@ -9,6 +9,7 @@ use memuse::DynamicUsage;
use nonempty::NonEmpty;
use zcash_note_encryption::{try_note_decryption, try_output_recovery_with_ovk};
use crate::note::NoteType;
use crate::{
action::Action,
address::Address,
@ -21,7 +22,6 @@ use crate::{
tree::Anchor,
value::{ValueCommitTrapdoor, ValueCommitment, ValueSum},
};
use crate::note::NoteType;
impl<T> Action<T> {
/// Prepares the public instance for this action, for creating and verifying the
@ -375,10 +375,10 @@ impl<T: Authorization, V: Copy + Into<i64>> Bundle<T, V> {
.map(|a| a.cv_net())
.sum::<ValueCommitment>()
- ValueCommitment::derive(
ValueSum::from_raw(self.value_balance.into()),
ValueCommitTrapdoor::zero(),
NoteType::native(),
))
ValueSum::from_raw(self.value_balance.into()),
ValueCommitTrapdoor::zero(),
NoteType::native(),
))
.into_bvk()
}
}

View File

@ -882,13 +882,13 @@ mod tests {
use rand::{rngs::OsRng, RngCore};
use super::{Circuit, Instance, Proof, ProvingKey, VerifyingKey, K};
use crate::note::NoteType;
use crate::{
keys::SpendValidatingKey,
note::Note,
tree::MerklePath,
value::{ValueCommitTrapdoor, ValueCommitment},
};
use crate::note::NoteType;
fn generate_circuit_instance<R: RngCore>(mut rng: R) -> (Circuit, Instance) {
let (_, fvk, spent_note) = Note::dummy(&mut rng, None);

View File

@ -52,9 +52,7 @@ use subtle::CtOption;
use crate::note::NoteType;
use crate::{
constants::fixed_bases::{
VALUE_COMMITMENT_PERSONALIZATION, VALUE_COMMITMENT_R_BYTES,
},
constants::fixed_bases::{VALUE_COMMITMENT_PERSONALIZATION, VALUE_COMMITMENT_R_BYTES},
primitives::redpallas::{self, Binding},
};