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

drk: 'fix' make clippy error (just a temp patch)

zero 2 лет назад
Родитель
Сommit
732b9ae38a
2 измененных файлов с 12 добавлено и 15 удалено
  1. 9 0
      bin/drk/src/dao.rs
  2. 3 15
      src/contract/test-harness/src/dao_propose.rs

+ 9 - 0
bin/drk/src/dao.rs

@@ -41,6 +41,7 @@ use darkfi_sdk::{
     bridgetree,
     bridgetree,
     crypto::{
     crypto::{
         poseidon_hash,
         poseidon_hash,
+        smt::{MemoryStorageFp, PoseidonFp, SmtMemoryFp, EMPTY_NODES_FP},
         util::{fp_mod_fv, fp_to_u64},
         util::{fp_mod_fv, fp_to_u64},
         BaseBlind, Blind, FuncId, FuncRef, Keypair, MerkleNode, MerkleTree, PublicKey, ScalarBlind,
         BaseBlind, Blind, FuncId, FuncRef, Keypair, MerkleNode, MerkleTree, PublicKey, ScalarBlind,
         SecretKey, DAO_CONTRACT_ID, MONEY_CONTRACT_ID,
         SecretKey, DAO_CONTRACT_ID, MONEY_CONTRACT_ID,
@@ -1491,11 +1492,19 @@ impl Drk {
         // Fetch the daos Merkle tree
         // Fetch the daos Merkle tree
         let (daos_tree, _) = self.get_dao_trees().await?;
         let (daos_tree, _) = self.get_dao_trees().await?;
 
 
+        // This is complete wrong and needs to be fixed later
+        // Non-trivial to fix, so we just make a workaround for now
+
+        let hasher = PoseidonFp::new();
+        let store = MemoryStorageFp::new();
+        let money_null_smt = SmtMemoryFp::new(store, hasher.clone(), &EMPTY_NODES_FP);
+
         let input = DaoProposeStakeInput {
         let input = DaoProposeStakeInput {
             secret: gov_coin.secret, // <-- TODO: Is this correct?
             secret: gov_coin.secret, // <-- TODO: Is this correct?
             note: gov_coin.note.clone(),
             note: gov_coin.note.clone(),
             leaf_position: gov_coin.leaf_position,
             leaf_position: gov_coin.leaf_position,
             merkle_path: gov_coin_merkle_path,
             merkle_path: gov_coin_merkle_path,
+            money_null_smt: &money_null_smt,
             signature_secret,
             signature_secret,
         };
         };
 
 

+ 3 - 15
src/contract/test-harness/src/dao_propose.rs

@@ -73,8 +73,8 @@ impl TestHarness {
 
 
         let signature_secret = SecretKey::random(&mut OsRng);
         let signature_secret = SecretKey::random(&mut OsRng);
 
 
-        debug!("ABOUT TO SHOW DB INTERNALZZZ!!!!!");
-        {
+        // Useful code snippet to dump a sled contract DB
+        /*{
             let blockchain = &wallet.validator.blockchain;
             let blockchain = &wallet.validator.blockchain;
             let contracts = &blockchain.contracts;
             let contracts = &blockchain.contracts;
             let tree = contracts
             let tree = contracts
@@ -85,19 +85,7 @@ impl TestHarness {
                 debug!("STATE {:?}", key);
                 debug!("STATE {:?}", key);
                 debug!("  => {:?}", value);
                 debug!("  => {:?}", value);
             }
             }
-        }
-        debug!("[REDUX] ABOUT TO SHOW DB INTERNALZZZ!!!!!");
-        {
-            let blockchain = &wallet.validator.blockchain;
-            let contracts = &blockchain.contracts;
-            let tree =
-                contracts.lookup(&blockchain.sled_db, &MONEY_CONTRACT_ID, "coin_roots").unwrap();
-            for kv in tree.iter() {
-                let (key, value) = kv.unwrap();
-                debug!("STATE {:?}", key);
-                debug!("  => {:?}", value);
-            }
-        }
+        }*/
 
 
         let input = DaoProposeStakeInput {
         let input = DaoProposeStakeInput {
             secret: wallet.keypair.secret,
             secret: wallet.keypair.secret,