diff --git a/src/bundle.rs b/src/bundle.rs index 4292e0e8..91c799ca 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -375,7 +375,7 @@ pub mod testing { Signature, }, value::{ - testing::arb_nonnegative_note_value, NoteValue, ValueCommitTrapdoor, ValueCommitment, + testing::arb_note_value_bounded, NoteValue, ValueCommitTrapdoor, ValueCommitment, ValueSum, MAX_NOTE_VALUE, }, Anchor, @@ -425,9 +425,9 @@ pub mod testing { n_actions: usize, flags: Flags, ) -> impl Strategy)> { - arb_nonnegative_note_value(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( + arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( move |spend_value| { - arb_nonnegative_note_value(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( + arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( move |output_value| { let spend_value = if flags.spends_enabled { spend_value @@ -487,9 +487,9 @@ pub mod testing { n_actions: usize, flags: Flags, ) -> impl Strategy>)> { - arb_nonnegative_note_value(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( + arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( move |spend_value| { - arb_nonnegative_note_value(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( + arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( move |output_value| { let spend_value = if flags.spends_enabled { spend_value diff --git a/src/value.rs b/src/value.rs index 1a1ef4fb..379bb599 100644 --- a/src/value.rs +++ b/src/value.rs @@ -301,7 +301,7 @@ pub mod testing { prop_compose! { /// Generate an arbitrary value in the range of valid positive Zcash amounts /// less than a specified value. - pub fn arb_nonnegative_note_value(max: u64)(value in 0u64..max) -> NoteValue { + pub fn arb_note_value_bounded(max: u64)(value in 0u64..max) -> NoteValue { NoteValue(value) } } @@ -320,7 +320,7 @@ mod tests { use proptest::prelude::*; use super::{ - testing::{arb_nonnegative_note_value, arb_trapdoor, arb_value_sum_bounded}, + testing::{arb_note_value_bounded, arb_trapdoor, arb_value_sum_bounded}, OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum, MAX_NOTE_VALUE, }; use crate::primitives::redpallas; @@ -329,7 +329,7 @@ mod tests { #[test] fn bsk_consistent_with_bvk( values in (1usize..10).prop_flat_map(|n_values| - arb_nonnegative_note_value(MAX_NOTE_VALUE / n_values as u64).prop_flat_map(move |bound| + arb_note_value_bounded(MAX_NOTE_VALUE / n_values as u64).prop_flat_map(move |bound| prop::collection::vec((arb_value_sum_bounded(bound), arb_trapdoor()), n_values) ) )