mirror of https://github.com/zcash/orchard.git
Merge pull request #380 from nuttycom/cleanup/fix_lints
Fix clippy beta lints that are applicable given an MSRV of 1.60
This commit is contained in:
commit
61a67f018f
|
@ -931,7 +931,7 @@ mod tests {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.create_proof(&pk, &mut rng)
|
.create_proof(&pk, &mut rng)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.prepare(&mut rng, [0; 32])
|
.prepare(rng, [0; 32])
|
||||||
.finalize()
|
.finalize()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(bundle.value_balance(), &(-5000))
|
assert_eq!(bundle.value_balance(), &(-5000))
|
||||||
|
|
|
@ -119,7 +119,7 @@ impl CommitIvkChip {
|
||||||
|
|
||||||
// Check that nk = b_2 (5 bits) || c (240 bits) || d_0 (9 bits) || d_1 (1 bit)
|
// Check that nk = b_2 (5 bits) || c (240 bits) || d_0 (9 bits) || d_1 (1 bit)
|
||||||
let nk_decomposition_check = {
|
let nk_decomposition_check = {
|
||||||
let two_pow_245 = pallas::Base::from(1 << 49).pow(&[5, 0, 0, 0]);
|
let two_pow_245 = pallas::Base::from(1 << 49).pow([5, 0, 0, 0]);
|
||||||
|
|
||||||
b_2.clone()
|
b_2.clone()
|
||||||
+ c.clone() * two_pow_5
|
+ c.clone() * two_pow_5
|
||||||
|
|
|
@ -61,7 +61,7 @@ type CanonicityBounds = (
|
||||||
/// | b | b_0 | b_1 | 1 |
|
/// | b | b_0 | b_1 | 1 |
|
||||||
/// | | b_2 | b_3 | 0 |
|
/// | | b_2 | b_3 | 0 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-decomposition-b?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-decomposition-b?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct DecomposeB {
|
struct DecomposeB {
|
||||||
q_notecommit_b: Selector,
|
q_notecommit_b: Selector,
|
||||||
|
@ -206,7 +206,7 @@ impl DecomposeB {
|
||||||
/// | d | d_0 | d_1 | 1 |
|
/// | d | d_0 | d_1 | 1 |
|
||||||
/// | | d_2 | d_3 | 0 |
|
/// | | d_2 | d_3 | 0 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-decomposition-d?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-decomposition-d?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct DecomposeD {
|
struct DecomposeD {
|
||||||
q_notecommit_d: Selector,
|
q_notecommit_d: Selector,
|
||||||
|
@ -342,7 +342,7 @@ impl DecomposeD {
|
||||||
/// ------------------------------------
|
/// ------------------------------------
|
||||||
/// | e | e_0 | e_1 | 1 |
|
/// | e | e_0 | e_1 | 1 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-decomposition-e?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-decomposition-e?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct DecomposeE {
|
struct DecomposeE {
|
||||||
q_notecommit_e: Selector,
|
q_notecommit_e: Selector,
|
||||||
|
@ -461,7 +461,7 @@ impl DecomposeE {
|
||||||
/// | g | g_0 | 1 |
|
/// | g | g_0 | 1 |
|
||||||
/// | g_1 | g_2 | 0 |
|
/// | g_1 | g_2 | 0 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-decomposition-g?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-decomposition-g?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct DecomposeG {
|
struct DecomposeG {
|
||||||
q_notecommit_g: Selector,
|
q_notecommit_g: Selector,
|
||||||
|
@ -583,7 +583,7 @@ impl DecomposeG {
|
||||||
/// ------------------------------------
|
/// ------------------------------------
|
||||||
/// | h | h_0 | h_1 | 1 |
|
/// | h | h_0 | h_1 | 1 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-decomposition-h?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-decomposition-h?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct DecomposeH {
|
struct DecomposeH {
|
||||||
q_notecommit_h: Selector,
|
q_notecommit_h: Selector,
|
||||||
|
@ -700,7 +700,7 @@ impl DecomposeH {
|
||||||
/// | x(g_d) | b_0 | a | z13_a | 1 |
|
/// | x(g_d) | b_0 | a | z13_a | 1 |
|
||||||
/// | | b_1 | a_prime | z13_a_prime | 0 |
|
/// | | b_1 | a_prime | z13_a_prime | 0 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-canonicity-g_d?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-canonicity-g_d?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct GdCanonicity {
|
struct GdCanonicity {
|
||||||
q_notecommit_g_d: Selector,
|
q_notecommit_g_d: Selector,
|
||||||
|
@ -817,7 +817,7 @@ impl GdCanonicity {
|
||||||
/// | x(pk_d) | b_3 | c | z13_c | 1 |
|
/// | x(pk_d) | b_3 | c | z13_c | 1 |
|
||||||
/// | | d_0 | b3_c_prime | z14_b3_c_prime | 0 |
|
/// | | d_0 | b3_c_prime | z14_b3_c_prime | 0 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-canonicity-pk_d?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-canonicity-pk_d?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct PkdCanonicity {
|
struct PkdCanonicity {
|
||||||
q_notecommit_pk_d: Selector,
|
q_notecommit_pk_d: Selector,
|
||||||
|
@ -933,7 +933,7 @@ impl PkdCanonicity {
|
||||||
/// ------------------------------------------------
|
/// ------------------------------------------------
|
||||||
/// | value | d_2 | d_3 | e_0 | 1 |
|
/// | value | d_2 | d_3 | e_0 | 1 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-canonicity-v?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-canonicity-v?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct ValueCanonicity {
|
struct ValueCanonicity {
|
||||||
q_notecommit_value: Selector,
|
q_notecommit_value: Selector,
|
||||||
|
@ -1011,7 +1011,7 @@ impl ValueCanonicity {
|
||||||
/// | rho | e_1 | f | z13_f | 1 |
|
/// | rho | e_1 | f | z13_f | 1 |
|
||||||
/// | | g_0 | e1_f_prime | z14_e1_f_prime | 0 |
|
/// | | g_0 | e1_f_prime | z14_e1_f_prime | 0 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-canonicity-rho?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-canonicity-rho?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct RhoCanonicity {
|
struct RhoCanonicity {
|
||||||
q_notecommit_rho: Selector,
|
q_notecommit_rho: Selector,
|
||||||
|
@ -1126,7 +1126,7 @@ impl RhoCanonicity {
|
||||||
/// | psi | g_1 | g_2 | z13_g | 1 |
|
/// | psi | g_1 | g_2 | z13_g | 1 |
|
||||||
/// | h_0 | h_1 | g1_g2_prime | z13_g1_g2_prime | 0 |
|
/// | h_0 | h_1 | g1_g2_prime | z13_g1_g2_prime | 0 |
|
||||||
///
|
///
|
||||||
/// https://p.z.cash/orchard-0.1:note-commit-canonicity-psi?partial
|
/// <https://p.z.cash/orchard-0.1:note-commit-canonicity-psi?partial>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct PsiCanonicity {
|
struct PsiCanonicity {
|
||||||
q_notecommit_psi: Selector,
|
q_notecommit_psi: Selector,
|
||||||
|
|
|
@ -380,14 +380,14 @@ pub mod testing {
|
||||||
prop_compose! {
|
prop_compose! {
|
||||||
/// Generate an arbitrary [`ValueSum`] in the range of valid Zcash values.
|
/// Generate an arbitrary [`ValueSum`] in the range of valid Zcash values.
|
||||||
pub fn arb_value_sum()(value in VALUE_SUM_RANGE) -> ValueSum {
|
pub fn arb_value_sum()(value in VALUE_SUM_RANGE) -> ValueSum {
|
||||||
ValueSum(value as i128)
|
ValueSum(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prop_compose! {
|
prop_compose! {
|
||||||
/// Generate an arbitrary [`ValueSum`] in the range of valid Zcash values.
|
/// Generate an arbitrary [`ValueSum`] in the range of valid Zcash values.
|
||||||
pub fn arb_value_sum_bounded(bound: NoteValue)(value in -(bound.0 as i128)..=(bound.0 as i128)) -> ValueSum {
|
pub fn arb_value_sum_bounded(bound: NoteValue)(value in -(bound.0 as i128)..=(bound.0 as i128)) -> ValueSum {
|
||||||
ValueSum(value as i128)
|
ValueSum(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ fn bundle_chain() {
|
||||||
let unauthorized = builder.build(&mut rng).unwrap();
|
let unauthorized = builder.build(&mut rng).unwrap();
|
||||||
let sighash = unauthorized.commitment().into();
|
let sighash = unauthorized.commitment().into();
|
||||||
let proven = unauthorized.create_proof(&pk, &mut rng).unwrap();
|
let proven = unauthorized.create_proof(&pk, &mut rng).unwrap();
|
||||||
proven.apply_signatures(&mut rng, sighash, &[]).unwrap()
|
proven.apply_signatures(rng, sighash, &[]).unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Verify the shielding bundle.
|
// Verify the shielding bundle.
|
||||||
|
@ -92,7 +92,7 @@ fn bundle_chain() {
|
||||||
let sighash = unauthorized.commitment().into();
|
let sighash = unauthorized.commitment().into();
|
||||||
let proven = unauthorized.create_proof(&pk, &mut rng).unwrap();
|
let proven = unauthorized.create_proof(&pk, &mut rng).unwrap();
|
||||||
proven
|
proven
|
||||||
.apply_signatures(&mut rng, sighash, &[SpendAuthorizingKey::from(&sk)])
|
.apply_signatures(rng, sighash, &[SpendAuthorizingKey::from(&sk)])
|
||||||
.unwrap()
|
.unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue