mirror of https://github.com/zcash/halo2.git
Publicly expose `MAX_NOTE_VALUE`
This commit is contained in:
parent
6373d3d422
commit
3170096134
|
@ -477,10 +477,7 @@ pub mod testing {
|
|||
},
|
||||
note::testing::arb_note,
|
||||
tree::{Anchor, MerklePath},
|
||||
value::{
|
||||
testing::{arb_positive_note_value, MAX_NOTE_VALUE},
|
||||
NoteValue,
|
||||
},
|
||||
value::{testing::arb_positive_note_value, NoteValue, MAX_NOTE_VALUE},
|
||||
Address, Note,
|
||||
};
|
||||
|
||||
|
|
|
@ -375,8 +375,8 @@ pub mod testing {
|
|||
Signature,
|
||||
},
|
||||
value::{
|
||||
testing::{arb_nonnegative_note_value, MAX_NOTE_VALUE},
|
||||
NoteValue, ValueCommitTrapdoor, ValueCommitment, ValueSum,
|
||||
testing::arb_nonnegative_note_value, NoteValue, ValueCommitTrapdoor, ValueCommitment,
|
||||
ValueSum, MAX_NOTE_VALUE,
|
||||
},
|
||||
Anchor,
|
||||
};
|
||||
|
|
15
src/value.rs
15
src/value.rs
|
@ -33,12 +33,16 @@ use crate::primitives::redpallas::{self, Binding};
|
|||
|
||||
use std::ops::RangeInclusive;
|
||||
|
||||
/// Maximum note value.
|
||||
pub const MAX_NOTE_VALUE: u64 = u64::MAX;
|
||||
|
||||
/// The valid range of the scalar multiplication used in ValueCommit^Orchard.
|
||||
///
|
||||
/// Defined in a note in [Zcash Protocol Spec § 4.17.4: Action Statement (Orchard)][actionstatement].
|
||||
///
|
||||
/// [actionstatement]: https://zips.z.cash/protocol/nu5.pdf#actionstatement
|
||||
pub const VALUE_SUM_RANGE: RangeInclusive<i128> = -(u64::MAX as i128)..=u64::MAX as i128;
|
||||
pub const VALUE_SUM_RANGE: RangeInclusive<i128> =
|
||||
-(MAX_NOTE_VALUE as i128)..=MAX_NOTE_VALUE as i128;
|
||||
|
||||
/// A value operation overflowed.
|
||||
#[derive(Debug)]
|
||||
|
@ -254,10 +258,7 @@ pub mod testing {
|
|||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||
use proptest::prelude::*;
|
||||
|
||||
use super::{NoteValue, ValueCommitTrapdoor, ValueSum, VALUE_SUM_RANGE};
|
||||
|
||||
/// Maximum note value.
|
||||
pub const MAX_NOTE_VALUE: u64 = u64::MAX - 1;
|
||||
use super::{NoteValue, ValueCommitTrapdoor, ValueSum, MAX_NOTE_VALUE, VALUE_SUM_RANGE};
|
||||
|
||||
prop_compose! {
|
||||
/// Generate an arbitrary Pallas scalar.
|
||||
|
@ -319,8 +320,8 @@ mod tests {
|
|||
use proptest::prelude::*;
|
||||
|
||||
use super::{
|
||||
testing::{arb_trapdoor, arb_value_sum_bounded, arb_nonnegative_note_value, MAX_NOTE_VALUE},
|
||||
OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum
|
||||
testing::{arb_nonnegative_note_value, arb_trapdoor, arb_value_sum_bounded},
|
||||
OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum, MAX_NOTE_VALUE,
|
||||
};
|
||||
use crate::primitives::redpallas;
|
||||
|
||||
|
|
Loading…
Reference in New Issue