Luther Blissett 3 лет назад
Родитель
Сommit
2ca5866c43

+ 3 - 0
Cargo.lock

@@ -1242,8 +1242,10 @@ dependencies = [
  "bs58",
  "darkfi-serial",
  "halo2_gadgets",
+ "halo2_proofs",
  "incrementalmerkletree",
  "pasta_curves",
+ "rand",
  "thiserror",
 ]
 
@@ -1482,6 +1484,7 @@ dependencies = [
  "async-std",
  "async-trait",
  "darkfi",
+ "darkfi-serial",
  "easy-parallel",
  "log",
  "num_cpus",

+ 2 - 4
bin/darkwiki/darkwikid/src/patch.rs

@@ -470,10 +470,8 @@ impl Decodable for OpMethods {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use darkfi::{
-        serial::{deserialize, serialize},
-        util::gen_id,
-    };
+    use darkfi::util::gen_id;
+    use darkfi_serial::{deserialize, serialize};
 
     #[test]
     fn test_to_string() {

+ 1 - 0
example/dchat/Cargo.toml

@@ -6,6 +6,7 @@ description = "Demo chat to document darkfi net code"
 
 [dependencies]
 darkfi = {path = "../../", features = ["net", "rpc"]}
+darkfi-serial = {path = "../../src/serial"}
 
 # Async
 async-std = "1.12.0"

+ 2 - 4
example/dchat/src/dchatmsg.rs

@@ -1,9 +1,7 @@
 use async_std::sync::{Arc, Mutex};
 
-use darkfi::{
-    net,
-    serial::{SerialDecodable, SerialEncodable},
-};
+use darkfi::net;
+use darkfi_serial::{SerialDecodable, SerialEncodable};
 
 pub type DchatMsgsBuffer = Arc<Mutex<Vec<DchatMsg>>>;
 

+ 1 - 1
src/crypto/proof.rs

@@ -101,10 +101,10 @@ mod tests {
                 DrkCoinBlind, DrkSerial, DrkSpendHook, DrkTokenId, DrkUserData, DrkValueBlind,
             },
         },
-        serial::{Decodable, Encodable},
         zk::circuit::MintContract,
         Result,
     };
+    use darkfi_serial::{Decodable, Encodable};
     use group::ff::Field;
     use rand::rngs::OsRng;
 

+ 1 - 1
src/crypto/schnorr.rs

@@ -54,7 +54,7 @@ impl SchnorrPublic for PublicKey {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::serial::{deserialize, serialize};
+    use darkfi_serial::{deserialize, serialize};
 
     #[test]
     fn test_schnorr() {

+ 1 - 1
src/net/message_subscriber.rs

@@ -239,7 +239,7 @@ impl Default for MessageSubsystem {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::serial::{Decodable, Encodable};
+    use darkfi_serial::{Decodable, Encodable};
     use std::io;
 
     #[async_std::test]

+ 4 - 0
src/sdk/Cargo.toml

@@ -26,3 +26,7 @@ bs58 = "0.4.0"
 pasta_curves = "0.4.0"
 incrementalmerkletree = "0.3.0"
 halo2_gadgets = "0.2.0"
+
+[dev-dependencies]
+halo2_proofs = "0.2.0"
+rand = "0.8.5"

+ 1 - 2
src/sdk/src/crypto/constants/fixed_bases/commit_ivk_r.rs

@@ -2931,12 +2931,11 @@ mod tests {
         super::{COMMIT_IVK_PERSONALIZATION, NUM_WINDOWS},
         *,
     };
-    use group::Curve;
     use halo2_gadgets::{
         ecc::chip::constants::{test_lagrange_coeffs, test_zs_and_us},
         sinsemilla::primitives::CommitDomain,
     };
-    use pasta_curves::{arithmetic::CurveAffine, pallas};
+    use pasta_curves::{arithmetic::CurveAffine, group::Curve, pallas};
 
     #[test]
     fn generator() {

+ 1 - 2
src/sdk/src/crypto/constants/fixed_bases/note_commit_r.rs

@@ -2936,8 +2936,7 @@ mod tests {
         sinsemilla::primitives::CommitDomain,
     };
 
-    use group::Curve;
-    use pasta_curves::{arithmetic::CurveAffine, pallas};
+    use pasta_curves::{arithmetic::CurveAffine, group::Curve, pallas};
 
     #[test]
     fn generator() {

+ 1 - 2
src/sdk/src/crypto/constants/fixed_bases/nullifier_k.rs

@@ -2930,9 +2930,8 @@ mod tests {
         super::{NUM_WINDOWS, ORCHARD_PERSONALIZATION},
         *,
     };
-    use group::Curve;
     use halo2_gadgets::ecc::chip::constants::{test_lagrange_coeffs, test_zs_and_us};
-    use pasta_curves::{arithmetic::CurveExt, pallas};
+    use pasta_curves::{arithmetic::CurveExt, group::Curve, pallas};
 
     #[test]
     fn generator() {

+ 1 - 1
src/sdk/src/crypto/constants/fixed_bases/spend_auth_g.rs

@@ -2932,10 +2932,10 @@ mod tests {
         super::{NUM_WINDOWS, ORCHARD_PERSONALIZATION},
         *,
     };
-    use group::Curve;
     use halo2_gadgets::ecc::chip::constants::{test_lagrange_coeffs, test_zs_and_us};
     use pasta_curves::{
         arithmetic::{CurveAffine, CurveExt},
+        group::Curve,
         pallas,
     };
 

+ 1 - 1
src/sdk/src/crypto/constants/fixed_bases/value_commit_r.rs

@@ -2932,10 +2932,10 @@ mod tests {
         super::{NUM_WINDOWS, VALUE_COMMITMENT_PERSONALIZATION},
         *,
     };
-    use group::Curve;
     use halo2_gadgets::ecc::chip::constants::{test_lagrange_coeffs, test_zs_and_us};
     use pasta_curves::{
         arithmetic::{CurveAffine, CurveExt},
+        group::Curve,
         pallas,
     };
 

+ 1 - 1
src/sdk/src/crypto/constants/fixed_bases/value_commit_v.rs

@@ -785,10 +785,10 @@ mod tests {
         super::{NUM_WINDOWS_SHORT, VALUE_COMMITMENT_PERSONALIZATION},
         *,
     };
-    use group::Curve;
     use halo2_gadgets::ecc::chip::constants::{test_lagrange_coeffs, test_zs_and_us};
     use pasta_curves::{
         arithmetic::{CurveAffine, CurveExt},
+        group::Curve,
         pallas,
     };
 

+ 1 - 1
src/sdk/src/crypto/constants/sinsemilla.rs

@@ -131,9 +131,9 @@ mod tests {
         fixed_bases::{COMMIT_IVK_PERSONALIZATION, NOTE_COMMITMENT_PERSONALIZATION},
         sinsemilla::MERKLE_CRH_PERSONALIZATION,
     };
-    use group::{ff::PrimeField, Curve};
     use halo2_gadgets::sinsemilla::primitives::{CommitDomain, HashDomain};
     use halo2_proofs::{arithmetic::CurveAffine, pasta::pallas};
+    use pasta_curves::group::{ff::PrimeField, Curve};
     use rand::{self, rngs::OsRng, Rng};
 
     #[test]