Parcourir la source

resolve conflicts

mohab metwally il y a 3 ans
Parent
commit
f132a15358
3 fichiers modifiés avec 21 ajouts et 21 suppressions
  1. 1 1
      Cargo.lock
  2. 0 1
      src/stakeholder/epoch.rs
  3. 20 19
      src/stakeholder/mod.rs

+ 1 - 1
Cargo.lock

@@ -1436,7 +1436,7 @@ name = "dashu-int"
 version = "0.2.0"
 source = "git+https://github.com/ertosns/dashu#744c8c546947a1988e6c0710433cd5e58d3af86f"
 dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
  "dashu-base",
  "num-traits",
  "rand",

+ 0 - 1
src/stakeholder/epoch.rs

@@ -22,7 +22,6 @@ use crate::crypto::{
     proof::{Proof, ProvingKey},
     types::DrkValueBlind,
     util::{mod_r_p, pedersen_commitment_base, pedersen_commitment_u64},
-    keypair::{Keypair,SecretKey},
 
 };
 use crate::stakeholder::utils::{fbig2ibig, base2ibig};

+ 20 - 19
src/stakeholder/mod.rs

@@ -1,13 +1,14 @@
-use std::{fmt, thread, time::Duration};
-
+use smol::Executor;
 use async_std::sync::Arc;
 use halo2_proofs::arithmetic::Field;
-use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use log::{debug, error, info};
-use pasta_curves::{group::ff::PrimeField, pallas};
+use std::fmt;
+
 use rand::rngs::OsRng;
-use smol::Executor;
-use url::Url;
+use std::{thread, time::Duration};
+
+use crate::zk::circuit::{BurnContract, LeadContract, MintContract};
+use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 
 pub mod types;
 pub mod consts;
@@ -17,20 +18,21 @@ use crate::{
     blockchain::{Blockchain},
     consensus::{
         clock::{Clock, Ticks},
-        Block, BlockInfo, Header, LeadProof, Metadata,
+        Block, BlockInfo, Header, Metadata,
+        LeadProof,
     },
     crypto::{
         address::Address,
         coin::OwnCoin,
         constants::MERKLE_DEPTH,
         keypair::{PublicKey, SecretKey},
+        util::poseidon_hash,
         leadcoin::LeadCoin,
         merkle_node::MerkleNode,
         note::{EncryptedNote, Note},
         nullifier::Nullifier,
         proof::{Proof, ProvingKey, VerifyingKey},
-        schnorr::SchnorrSecret,
-        util::poseidon_hash,
+        schnorr::{SchnorrSecret},
     },
     net::{MessageSubscription, P2p, Settings, SettingsPtr},
     node::state::{state_transition, ProgramState, StateUpdate},
@@ -41,7 +43,6 @@ use crate::{
         Transaction,
     },
     util::{path::expand_path, time::Timestamp},
-
     stakeholder::types::{Float10},
     stakeholder::consts::{RADIX_BITS, LOG_T, TREE_LEN, P},
     stakeholder::utils::{fbig2base},
@@ -62,6 +63,7 @@ use dashu_macros::fbig;
 pub mod epoch;
 pub use epoch::{Epoch, EpochConsensus};
 
+
 #[derive(Debug)]
 pub struct SlotWorkspace {
     pub st: blake3::Hash,      // hash of the previous block
@@ -205,8 +207,14 @@ impl StakeholderState {
             // If it's our own coin, witness it and append to the vector.
             if let Some((note, secret)) = self.try_decrypt_note(enc_note) {
                 let leaf_position = self.tree.witness().unwrap();
-                let nullifier = Nullifier::from(poseidon_hash::<2>([secret.inner(), note.serial]));
-                let own_coin = OwnCoin { coin, note, secret, nullifier, leaf_position };
+                let nullifier = poseidon_hash::<2>([secret.inner(), note.serial]);
+                let own_coin = OwnCoin {
+                    coin: coin,
+                    note: note,
+                    secret: secret,
+                    nullifier: Nullifier::from(nullifier),
+                    leaf_position: leaf_position
+                };
                 self.own_coins.push(own_coin);
             }
         }
@@ -357,13 +365,6 @@ impl Stakeholder {
         settings.peers.clone()
     }
 
-    /*
-    fn  new_block(&self) {
-        //TODO initialize blocks in the epoch, and add coin commitment in genesis
-        let block_info = BlockInfo::new(st, e, sl, txs, metadata, sm);
-        self.block = block_info;
-    }
-    */
 
     async fn init_network(&self) -> Result<()> {
         info!(target: LOG_T, "init_network()");