diff --git a/src/channel_commit/bitcoin_script.rs b/src/channel_commit/bitcoin_script.rs index 02c3701..a7ad5b5 100644 --- a/src/channel_commit/bitcoin_script.rs +++ b/src/channel_commit/bitcoin_script.rs @@ -57,7 +57,7 @@ mod test { let b = Commitment::commit_m31(a); let script = script! { - { a.clone() } + { a } { commit_script.clone() } { b.clone() } OP_EQUAL @@ -79,7 +79,7 @@ mod test { let b = Commitment::commit_cm31(a); let script = script! { - { a.clone() } + { a } { commit_script.clone() } { b.clone() } OP_EQUAL @@ -104,7 +104,7 @@ mod test { let b = Commitment::commit_qm31(a); let script = script! { - { a.clone() } + { a } { commit_script.clone() } { b.clone() } OP_EQUAL diff --git a/src/channel_extract/bitcoin_script.rs b/src/channel_extract/bitcoin_script.rs index e06abf5..a613d6f 100644 --- a/src/channel_extract/bitcoin_script.rs +++ b/src/channel_extract/bitcoin_script.rs @@ -210,8 +210,8 @@ mod test { let mut prng = ChaCha20Rng::seed_from_u64(0); let mut hash = [0u8; 32]; - for i in 4..32 { - hash[i] = prng.gen(); + for h in hash.iter_mut().skip(4) { + *h = prng.gen(); } hash[3] = 0x80; @@ -239,8 +239,8 @@ mod test { println!("M31.from_hash() = {} bytes", unpack_script.len()); let mut hash = [0u8; 32]; - for i in 0..32 { - hash[i] = prng.gen(); + for h in &mut hash { + *h = prng.gen(); } hash[3] |= 0x80; @@ -312,8 +312,8 @@ mod test { assert!(exec_result.success); let mut hash = [0u8; 32]; - for i in 0..32 { - hash[i] = prng.gen(); + for h in &mut hash { + *h = prng.gen(); } hash[3] |= 0x80; hash[2] = 0; @@ -376,8 +376,8 @@ mod test { for _ in 0..300 { let mut hash = [0u8; 32]; - for i in 0..32 { - hash[i] = prng.gen(); + for h in &mut hash { + *h = prng.gen(); } let (elem, e) = Extractor::extract_cm31(&hash); @@ -404,8 +404,8 @@ mod test { for _ in 0..300 { let mut hash = [0u8; 32]; - for i in 0..32 { - hash[i] = prng.gen(); + for h in &mut hash { + *h = prng.gen(); } let (elem, e) = Extractor::extract_qm31(&hash); @@ -434,8 +434,8 @@ mod test { for _ in 0..300 { let mut hash = [0u8; 32]; - for i in 0..32 { - hash[i] = prng.gen(); + for h in &mut hash { + *h = prng.gen(); } let (elem, e) = Extractor::extract_5m31(&hash); diff --git a/src/circle_secure/bitcoin_script.rs b/src/circle_secure/bitcoin_script.rs index abf1153..491b451 100644 --- a/src/circle_secure/bitcoin_script.rs +++ b/src/circle_secure/bitcoin_script.rs @@ -180,7 +180,7 @@ mod test { let script = script! { { ExtractorGadget::push_hint_qm31(&hint_t) } - { CirclePointSecureGadget::push_random_point_hint(t.clone()) } + { CirclePointSecureGadget::push_random_point_hint(t) } { a.to_vec() } { get_random_point_script.clone() } { y } // check y diff --git a/src/fri/bitcoin_script.rs b/src/fri/bitcoin_script.rs index 14ebfff..158606c 100644 --- a/src/fri/bitcoin_script.rs +++ b/src/fri/bitcoin_script.rs @@ -251,7 +251,7 @@ mod test { channel_init_state }; - let mut channel = Channel::new(channel_init_state.clone()); + let mut channel = Channel::new(channel_init_state); let logn = 19; let proof = { @@ -267,8 +267,7 @@ mod test { .collect(); let evaluation = permute_eval(evaluation); - let proof = fri::fri_prove(&mut Channel::new(channel_init_state), evaluation); - proof + fri::fri_prove(&mut Channel::new(channel_init_state), evaluation) }; let expected = { @@ -333,8 +332,7 @@ mod test { .collect(); let evaluation = permute_eval(evaluation); - let proof = fri::fri_prove(&mut Channel::new(channel_init_state), evaluation); - proof + fri::fri_prove(&mut Channel::new(channel_init_state), evaluation) }; let queries = { @@ -397,8 +395,7 @@ mod test { .collect(); let evaluation = permute_eval(evaluation); - let proof = fri::fri_prove(&mut Channel::new(channel_init_state), evaluation); - proof + fri::fri_prove(&mut Channel::new(channel_init_state), evaluation) }; let queries = { @@ -458,8 +455,7 @@ mod test { .collect(); let evaluation = permute_eval(evaluation); - let proof = fri::fri_prove(&mut Channel::new(channel_init_state), evaluation); - proof + fri::fri_prove(&mut Channel::new(channel_init_state), evaluation) }; let (alphas, queries) = { @@ -527,7 +523,7 @@ mod test { channel_init_state }; - let mut channel = Channel::new(channel_init_state.clone()); + let mut channel = Channel::new(channel_init_state); let logn = 19; let proof = { @@ -543,8 +539,7 @@ mod test { .collect(); let evaluation = permute_eval(evaluation); - let proof = fri::fri_prove(&mut Channel::new(channel_init_state), evaluation); - proof + fri::fri_prove(&mut Channel::new(channel_init_state), evaluation) }; let expected_fiat_shamir = { @@ -657,7 +652,7 @@ mod test { } // alphas for _ in 0..(logn - 1) * 4 { - { (logn - 1) * 1 + 5 * (logn - 1) + (logn - 1) * 4 - 1 } OP_PICK + { (logn - 1) + 5 * (logn - 1) + (logn - 1) * 4 - 1 } OP_PICK } // siblings for _ in 0..(logn - 1) * 4 { diff --git a/src/math/bitcoin_script.rs b/src/math/bitcoin_script.rs index 75f8862..9812f83 100644 --- a/src/math/bitcoin_script.rs +++ b/src/math/bitcoin_script.rs @@ -65,8 +65,8 @@ mod test { let itwid = M31::reduce(prng.next_u64()); - let mut v0 = a.clone(); - let mut v1 = b.clone(); + let mut v0 = a; + let mut v1 = b; ibutterfly(&mut v0, &mut v1, itwid.into());