Просмотр исходного кода

rand version update to 0.8.5, fixed broken tests imports, added Clone and PartialEq macros at crypto::schnorr::Signature

aggstam 4 лет назад
Родитель
Сommit
6045eb1449

+ 1 - 1
Cargo.toml

@@ -70,7 +70,7 @@ async-tungstenite = {version = "0.16.1", optional = true}
 
 # Crypto
 bitvec = {version = "1.0.0", optional = true}
-rand = {version = "0.8.4", optional = true}
+rand = {version = "0.8.5", optional = true}
 sha2 = {version = "0.10.1", optional = true}
 group = {version = "0.11.0", optional = true}
 arrayvec = {version = "0.7.2", optional = true}

+ 3 - 2
example/tree.rs

@@ -1,6 +1,7 @@
 use incrementalmerkletree::{bridgetree::BridgeTree, Frontier, Tree};
-use pasta_curves::{arithmetic::Field, pallas};
+use pasta_curves::pallas;
 use rand::rngs::OsRng;
+use group::ff::Field;
 
 use darkfi::{crypto::merkle_node::MerkleNode, Result};
 
@@ -23,4 +24,4 @@ fn main() -> Result<()> {
     assert_eq!(root1, root2);
 
     Ok(())
-}
+}

+ 2 - 2
src/crypto/constants/sinsemilla.rs

@@ -130,7 +130,7 @@ impl CommitDomains<pallas::Affine, OrchardFixedBases, OrchardHashDomains> for Or
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::constants::{
+    use crate::crypto::constants::{
         fixed_bases::{COMMIT_IVK_PERSONALIZATION, NOTE_COMMITMENT_PERSONALIZATION},
         sinsemilla::MERKLE_CRH_PERSONALIZATION,
     };
@@ -212,4 +212,4 @@ mod tests {
 
         assert_eq!(two_pow_k * inv_two_pow_k, pallas::Base::one());
     }
-}
+}

+ 2 - 2
src/crypto/note.rs

@@ -121,7 +121,7 @@ impl EncryptedNote {
 mod tests {
     use super::*;
     use crate::crypto::keypair::Keypair;
-    use pasta_curves::arithmetic::Field;
+    use group::ff::Field;
 
     #[test]
     fn test_note_encdec() {
@@ -140,4 +140,4 @@ mod tests {
         assert_eq!(note.value, note2.value);
         assert_eq!(note.token_id, note2.token_id);
     }
-}
+}

+ 2 - 2
src/crypto/proof.rs

@@ -112,8 +112,8 @@ mod tests {
         crypto::{keypair::PublicKey, mint_proof::create_mint_proof},
         zk::circuit::MintContract,
     };
-    use halo2::arithmetic::Field;
     use rand::rngs::OsRng;
+    use group::ff::Field;
 
     #[test]
     fn test_proof_serialization() -> Result<()> {
@@ -144,4 +144,4 @@ mod tests {
 
         Ok(())
     }
-}
+}

+ 2 - 2
src/crypto/schnorr.rs

@@ -17,7 +17,7 @@ use crate::{
     Result,
 };
 
-#[derive(Debug)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct Signature {
     commit: pallas::Point,
     response: pallas::Scalar,
@@ -79,4 +79,4 @@ mod tests {
         let public = PublicKey::from_secret(secret);
         assert!(public.verify(&message[..], &signature));
     }
-}
+}

+ 2 - 2
src/node/wallet/cashierdb.rs

@@ -480,8 +480,8 @@ impl CashierDb {
 mod tests {
     use super::*;
     use crate::util::serial::serialize;
-    use pasta_curves::arithmetic::Field;
     use rand::rngs::OsRng;
+    use group::ff::Field;
 
     const WPASS: &str = "darkfi";
 
@@ -573,4 +573,4 @@ mod tests {
 
         Ok(())
     }
-}
+}

+ 3 - 2
src/node/wallet/walletdb.rs

@@ -382,8 +382,9 @@ mod tests {
         types::{DrkCoinBlind, DrkSerial, DrkValueBlind},
     };
     use incrementalmerkletree::{Frontier, Tree};
-    use pasta_curves::{arithmetic::Field, pallas};
+    use pasta_curves::pallas;
     use rand::rngs::OsRng;
+    use group::ff::Field;
 
     const WPASS: &str = "darkfi";
 
@@ -499,4 +500,4 @@ mod tests {
 
         Ok(())
     }
-}
+}