From cf526f59e2505ac05c1725d6680bc7f4c6d2ac97 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Fri, 10 Mar 2023 14:23:06 -0700 Subject: [PATCH 1/2] Fix clippy beta lints that are applicable given an MSRV of 1.60 --- src/builder.rs | 2 +- src/circuit/commit_ivk.rs | 2 +- src/value.rs | 4 ++-- tests/builder.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/builder.rs b/src/builder.rs index 0f95fb3b..5ee484ca 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -931,7 +931,7 @@ mod tests { .unwrap() .create_proof(&pk, &mut rng) .unwrap() - .prepare(&mut rng, [0; 32]) + .prepare(rng, [0; 32]) .finalize() .unwrap(); assert_eq!(bundle.value_balance(), &(-5000)) diff --git a/src/circuit/commit_ivk.rs b/src/circuit/commit_ivk.rs index d96876af..33692a4a 100644 --- a/src/circuit/commit_ivk.rs +++ b/src/circuit/commit_ivk.rs @@ -119,7 +119,7 @@ impl CommitIvkChip { // Check that nk = b_2 (5 bits) || c (240 bits) || d_0 (9 bits) || d_1 (1 bit) 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() + c.clone() * two_pow_5 diff --git a/src/value.rs b/src/value.rs index b20d8709..2f86c723 100644 --- a/src/value.rs +++ b/src/value.rs @@ -380,14 +380,14 @@ pub mod testing { prop_compose! { /// Generate an arbitrary [`ValueSum`] in the range of valid Zcash values. pub fn arb_value_sum()(value in VALUE_SUM_RANGE) -> ValueSum { - ValueSum(value as i128) + ValueSum(value) } } prop_compose! { /// 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 { - ValueSum(value as i128) + ValueSum(value) } } diff --git a/tests/builder.rs b/tests/builder.rs index f9b0f271..7590e108 100644 --- a/tests/builder.rs +++ b/tests/builder.rs @@ -49,7 +49,7 @@ fn bundle_chain() { let unauthorized = builder.build(&mut rng).unwrap(); let sighash = unauthorized.commitment().into(); 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. @@ -92,7 +92,7 @@ fn bundle_chain() { let sighash = unauthorized.commitment().into(); let proven = unauthorized.create_proof(&pk, &mut rng).unwrap(); proven - .apply_signatures(&mut rng, sighash, &[SpendAuthorizingKey::from(&sk)]) + .apply_signatures(rng, sighash, &[SpendAuthorizingKey::from(&sk)]) .unwrap() }; From e9a2de7d979ffc1f64b3a33fec755fbffe5b0a62 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Fri, 10 Mar 2023 14:26:07 -0700 Subject: [PATCH 2/2] Fix `cargo doc` complaints. --- src/circuit/note_commit.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/circuit/note_commit.rs b/src/circuit/note_commit.rs index 3675b4fa..9daa685f 100644 --- a/src/circuit/note_commit.rs +++ b/src/circuit/note_commit.rs @@ -61,7 +61,7 @@ type CanonicityBounds = ( /// | b | b_0 | b_1 | 1 | /// | | b_2 | b_3 | 0 | /// -/// https://p.z.cash/orchard-0.1:note-commit-decomposition-b?partial +/// #[derive(Clone, Debug)] struct DecomposeB { q_notecommit_b: Selector, @@ -206,7 +206,7 @@ impl DecomposeB { /// | d | d_0 | d_1 | 1 | /// | | d_2 | d_3 | 0 | /// -/// https://p.z.cash/orchard-0.1:note-commit-decomposition-d?partial +/// #[derive(Clone, Debug)] struct DecomposeD { q_notecommit_d: Selector, @@ -342,7 +342,7 @@ impl DecomposeD { /// ------------------------------------ /// | e | e_0 | e_1 | 1 | /// -/// https://p.z.cash/orchard-0.1:note-commit-decomposition-e?partial +/// #[derive(Clone, Debug)] struct DecomposeE { q_notecommit_e: Selector, @@ -461,7 +461,7 @@ impl DecomposeE { /// | g | g_0 | 1 | /// | g_1 | g_2 | 0 | /// -/// https://p.z.cash/orchard-0.1:note-commit-decomposition-g?partial +/// #[derive(Clone, Debug)] struct DecomposeG { q_notecommit_g: Selector, @@ -583,7 +583,7 @@ impl DecomposeG { /// ------------------------------------ /// | h | h_0 | h_1 | 1 | /// -/// https://p.z.cash/orchard-0.1:note-commit-decomposition-h?partial +/// #[derive(Clone, Debug)] struct DecomposeH { q_notecommit_h: Selector, @@ -700,7 +700,7 @@ impl DecomposeH { /// | x(g_d) | b_0 | a | z13_a | 1 | /// | | b_1 | a_prime | z13_a_prime | 0 | /// -/// https://p.z.cash/orchard-0.1:note-commit-canonicity-g_d?partial +/// #[derive(Clone, Debug)] struct GdCanonicity { q_notecommit_g_d: Selector, @@ -817,7 +817,7 @@ impl GdCanonicity { /// | x(pk_d) | b_3 | c | z13_c | 1 | /// | | d_0 | b3_c_prime | z14_b3_c_prime | 0 | /// -/// https://p.z.cash/orchard-0.1:note-commit-canonicity-pk_d?partial +/// #[derive(Clone, Debug)] struct PkdCanonicity { q_notecommit_pk_d: Selector, @@ -933,7 +933,7 @@ impl PkdCanonicity { /// ------------------------------------------------ /// | value | d_2 | d_3 | e_0 | 1 | /// -/// https://p.z.cash/orchard-0.1:note-commit-canonicity-v?partial +/// #[derive(Clone, Debug)] struct ValueCanonicity { q_notecommit_value: Selector, @@ -1011,7 +1011,7 @@ impl ValueCanonicity { /// | rho | e_1 | f | z13_f | 1 | /// | | g_0 | e1_f_prime | z14_e1_f_prime | 0 | /// -/// https://p.z.cash/orchard-0.1:note-commit-canonicity-rho?partial +/// #[derive(Clone, Debug)] struct RhoCanonicity { q_notecommit_rho: Selector, @@ -1126,7 +1126,7 @@ impl RhoCanonicity { /// | psi | g_1 | g_2 | z13_g | 1 | /// | h_0 | h_1 | g1_g2_prime | z13_g1_g2_prime | 0 | /// -/// https://p.z.cash/orchard-0.1:note-commit-canonicity-psi?partial +/// #[derive(Clone, Debug)] struct PsiCanonicity { q_notecommit_psi: Selector,