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,
|
note::testing::arb_note,
|
||||||
tree::{Anchor, MerklePath},
|
tree::{Anchor, MerklePath},
|
||||||
value::{
|
value::{testing::arb_positive_note_value, NoteValue, MAX_NOTE_VALUE},
|
||||||
testing::{arb_positive_note_value, MAX_NOTE_VALUE},
|
|
||||||
NoteValue,
|
|
||||||
},
|
|
||||||
Address, Note,
|
Address, Note,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -375,8 +375,8 @@ pub mod testing {
|
||||||
Signature,
|
Signature,
|
||||||
},
|
},
|
||||||
value::{
|
value::{
|
||||||
testing::{arb_nonnegative_note_value, MAX_NOTE_VALUE},
|
testing::arb_nonnegative_note_value, NoteValue, ValueCommitTrapdoor, ValueCommitment,
|
||||||
NoteValue, ValueCommitTrapdoor, ValueCommitment, ValueSum,
|
ValueSum, MAX_NOTE_VALUE,
|
||||||
},
|
},
|
||||||
Anchor,
|
Anchor,
|
||||||
};
|
};
|
||||||
|
|
15
src/value.rs
15
src/value.rs
|
@ -33,12 +33,16 @@ use crate::primitives::redpallas::{self, Binding};
|
||||||
|
|
||||||
use std::ops::RangeInclusive;
|
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.
|
/// 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].
|
/// Defined in a note in [Zcash Protocol Spec § 4.17.4: Action Statement (Orchard)][actionstatement].
|
||||||
///
|
///
|
||||||
/// [actionstatement]: https://zips.z.cash/protocol/nu5.pdf#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.
|
/// A value operation overflowed.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -254,10 +258,7 @@ pub mod testing {
|
||||||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
|
|
||||||
use super::{NoteValue, ValueCommitTrapdoor, ValueSum, VALUE_SUM_RANGE};
|
use super::{NoteValue, ValueCommitTrapdoor, ValueSum, MAX_NOTE_VALUE, VALUE_SUM_RANGE};
|
||||||
|
|
||||||
/// Maximum note value.
|
|
||||||
pub const MAX_NOTE_VALUE: u64 = u64::MAX - 1;
|
|
||||||
|
|
||||||
prop_compose! {
|
prop_compose! {
|
||||||
/// Generate an arbitrary Pallas scalar.
|
/// Generate an arbitrary Pallas scalar.
|
||||||
|
@ -319,8 +320,8 @@ mod tests {
|
||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
testing::{arb_trapdoor, arb_value_sum_bounded, arb_nonnegative_note_value, MAX_NOTE_VALUE},
|
testing::{arb_nonnegative_note_value, arb_trapdoor, arb_value_sum_bounded},
|
||||||
OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum
|
OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum, MAX_NOTE_VALUE,
|
||||||
};
|
};
|
||||||
use crate::primitives::redpallas;
|
use crate::primitives::redpallas;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue