Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💚 fix clippy warnings in tests #8

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/channel_commit/bitcoin_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
24 changes: 12 additions & 12 deletions src/channel_extract/bitcoin_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/circle_secure/bitcoin_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 8 additions & 13 deletions src/fri/bitcoin_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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) = {
Expand Down Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/math/bitcoin_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
Loading