Skip to content

Commit 1e07c07

Browse files
committed
applied clippy.
1 parent 2a992df commit 1e07c07

File tree

4 files changed

+14
-27
lines changed

4 files changed

+14
-27
lines changed

mithril-stm/src/schnorr_signatures/helper.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use ff::Field;
66
use sha2::{Digest, Sha256};
77
use subtle::{Choice, ConstantTimeEq};
88

9-
use std::slice;
109

1110
pub fn get_coordinates(point: JubjubSubgroup) -> (JubjubBase, JubjubBase) {
1211
let extended: JubjubExtended = point.into(); // Convert to JubjubExtended

mithril-stm/src/schnorr_signatures/signature.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub use midnight_curves::{Fq as JubjubBase, Fr as JubjubScalar, JubjubSubgroup};
44

55
use group::Group;
66

7-
use crate::schnorr_signatures::helper::{get_coordinates, is_on_curve, jubjub_base_to_scalar};
7+
use crate::schnorr_signatures::helper::{get_coordinates, jubjub_base_to_scalar};
88
use crate::schnorr_signatures::verification_key::*;
99
use crate::schnorr_signatures::{DST_SIGNATURE, JubjubHashToCurve, PoseidonHash, SignatureError};
1010

@@ -30,8 +30,8 @@ impl SchnorrSignature {
3030
let (hx, hy) = get_coordinates(hash);
3131
let (vk_x, vk_y) = get_coordinates(vk.0);
3232
let (sigma_x, sigma_y) = get_coordinates(self.sigma);
33-
let cap_r_1_prime = &hash * &self.s + &self.sigma * &c_scalar;
34-
let cap_r_2_prime = &g * &self.s + &vk.0 * &c_scalar;
33+
let cap_r_1_prime = hash * self.s + self.sigma * c_scalar;
34+
let cap_r_2_prime = g * self.s + vk.0 * c_scalar;
3535
let (cap_r_1_x_prime, cap_r_1_y_prime) = get_coordinates(cap_r_1_prime);
3636
let (cap_r_2_x_prime, cap_r_2_y_prime) = get_coordinates(cap_r_2_prime);
3737
let c_prime = PoseidonHash::hash(&[

mithril-stm/src/schnorr_signatures/signing_key.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
use midnight_circuits::instructions::{HashToCurveCPU, hash::HashCPU};
22
pub use midnight_curves::{
3-
Fq as JubjubBase, Fr as JubjubScalar, JubjubExtended as Jubjub, JubjubExtended, JubjubSubgroup,
3+
Fq as JubjubBase, Fr as JubjubScalar, JubjubSubgroup,
44
};
55

66
use ff::Field;
77
use group::Group;
88
use rand_core::{CryptoRng, RngCore};
9-
use subtle::CtOption;
10-
use thiserror::Error;
119

1210
use crate::schnorr_signatures::signature::*;
1311
use crate::schnorr_signatures::verification_key::*;
1412
use crate::{
1513
error::MultiSignatureError,
16-
schnorr_signatures::helper::{get_coordinates, is_on_curve, jubjub_base_to_scalar},
14+
schnorr_signatures::helper::{get_coordinates, jubjub_base_to_scalar},
1715
};
1816

19-
use crate::schnorr_signatures::{DST_SIGNATURE, JubjubHashToCurve, PoseidonHash, SignatureError};
17+
use crate::schnorr_signatures::{DST_SIGNATURE, JubjubHashToCurve, PoseidonHash};
2018

2119
/// The signing key is a scalar from the Jubjub scalar field
2220
#[derive(Debug, Clone)]
@@ -34,13 +32,13 @@ impl SchnorrSigningKey {
3432
/// and the secret key as it is used for the lottery process
3533
pub fn sign(&self, msg: JubjubBase, rng: &mut (impl RngCore + CryptoRng)) -> SchnorrSignature {
3634
let g = JubjubSubgroup::generator();
37-
let vk = &g * &self.0;
35+
let vk = g * self.0;
3836

3937
let hash = JubjubHashToCurve::hash_to_curve(&[msg]);
40-
let sigma = &hash * &self.0;
38+
let sigma = hash * self.0;
4139
let r = JubjubScalar::random(rng);
42-
let cap_r_1 = &hash * &r;
43-
let cap_r_2 = &g * &r;
40+
let cap_r_1 = hash * r;
41+
let cap_r_2 = g * r;
4442

4543
let (hx, hy) = get_coordinates(hash);
4644
let (vk_x, vk_y) = get_coordinates(vk);
@@ -100,7 +98,7 @@ impl SchnorrSigningKey {
10098
impl From<&SchnorrSigningKey> for SchnorrVerificationKey {
10199
fn from(sk: &SchnorrSigningKey) -> Self {
102100
let g = JubjubSubgroup::generator();
103-
let vk = &g * &sk.0;
101+
let vk = g * sk.0;
104102
SchnorrVerificationKey(vk)
105103
}
106104
}

mithril-stm/src/schnorr_signatures/verification_key.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
use midnight_circuits::{
2-
ecc::{hash_to_curve::HashToCurveGadget, native::EccChip},
3-
hash::poseidon::PoseidonChip,
4-
instructions::{HashToCurveCPU, hash::HashCPU},
5-
types::AssignedNative,
6-
};
71

82
pub use midnight_curves::{
9-
Fq as JubjubBase, Fr as JubjubScalar, JubjubExtended as Jubjub, JubjubExtended, JubjubSubgroup,
3+
Fq as JubjubBase, JubjubExtended, JubjubSubgroup,
104
};
115

12-
use ff::Field;
13-
use group::Group;
14-
use rand_core::{CryptoRng, RngCore};
15-
use thiserror::Error;
166

17-
use crate::schnorr_signatures::helper::{get_coordinates, is_on_curve, jubjub_base_to_scalar};
18-
use crate::schnorr_signatures::{DST_SIGNATURE, JubjubHashToCurve, PoseidonHash, SignatureError};
7+
use crate::schnorr_signatures::helper::{get_coordinates, is_on_curve};
8+
use crate::schnorr_signatures::SignatureError;
199

2010
#[derive(Debug, Clone, Copy, Default)]
2111
pub struct SchnorrVerificationKey(pub JubjubSubgroup);

0 commit comments

Comments
 (0)