mohab metwally 3 лет назад
Родитель
Сommit
6e02b37646

+ 1 - 1
example/crypsinous.rs

@@ -69,7 +69,7 @@ async fn main()
         ).unwrap();
         ).unwrap();
 
 
         let handle = thread::spawn(move || {
         let handle = thread::spawn(move || {
-            block_on(stakeholder.background(Some(10)));
+            block_on(stakeholder.background(Some(5)));
         });
         });
         handles.push(handle);
         handles.push(handle);
     }
     }

+ 2 - 2
src/blockchain/epoch.rs

@@ -1,4 +1,4 @@
-use halo2_proofs::{arithmetic::Field, dev::MockProver, circuit::Value};
+use halo2_proofs::{arithmetic::Field};
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use halo2_gadgets::{
 use halo2_gadgets::{
     poseidon::{primitives as poseidon},
     poseidon::{primitives as poseidon},
@@ -19,7 +19,7 @@ use crate::{
         constants::MERKLE_DEPTH_ORCHARD,
         constants::MERKLE_DEPTH_ORCHARD,
         leadcoin::LeadCoin,
         leadcoin::LeadCoin,
         lead_proof,
         lead_proof,
-        proof::{Proof, ProvingKey, VerifyingKey},
+        proof::{Proof, ProvingKey},
         merkle_node::MerkleNode,
         merkle_node::MerkleNode,
         util::{mod_r_p, pedersen_commitment_base, pedersen_commitment_u64},
         util::{mod_r_p, pedersen_commitment_base, pedersen_commitment_u64},
         types::DrkValueBlind,
         types::DrkValueBlind,

+ 1 - 4
src/blockchain/mod.rs

@@ -1,11 +1,8 @@
 use log::debug;
 use log::debug;
 
 
-use std::error;
-
 use crate::{
 use crate::{
-    consensus::{Block, BlockInfo, StreamletMetadata},
+    consensus::{Block, BlockInfo},
     util::{
     util::{
-        serial::{Decodable, Encodable, ReadExt, VarInt, WriteExt},
         time::Timestamp,
         time::Timestamp,
     },
     },
     Result,
     Result,

+ 2 - 6
src/consensus/block.rs

@@ -1,15 +1,12 @@
 use std::fmt;
 use std::fmt;
-
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use log::debug;
 use log::debug;
-use rand::rngs::OsRng;
 use pasta_curves::pallas;
 use pasta_curves::pallas;
-use super::{StakeholderMetadata, StreamletMetadata, OuroborosMetadata, BLOCK_INFO_MAGIC_BYTES, BLOCK_MAGIC_BYTES,BLOCK_VERSION, TransactionLeadProof};
+use super::{StakeholderMetadata, StreamletMetadata, OuroborosMetadata, BLOCK_MAGIC_BYTES,BLOCK_VERSION};
 
 
 use crate::{
 use crate::{
     crypto::{
     crypto::{
-        address::Address, constants::MERKLE_DEPTH, keypair::Keypair, merkle_node::MerkleNode,
-        schnorr::SchnorrSecret,
+        constants::MERKLE_DEPTH, merkle_node::MerkleNode,
     },
     },
     net,
     net,
     tx::Transaction,
     tx::Transaction,
@@ -17,7 +14,6 @@ use crate::{
         serial::{serialize, SerialDecodable, SerialEncodable},
         serial::{serialize, SerialDecodable, SerialEncodable},
         time::Timestamp,
         time::Timestamp,
     },
     },
-    Result,
 };
 };
 
 
 /// This struct represents a tuple of the form (version, state, epoch, slot, timestamp, merkle_root).
 /// This struct represents a tuple of the form (version, state, epoch, slot, timestamp, merkle_root).

+ 1 - 6
src/consensus/metadata.rs

@@ -4,7 +4,6 @@ use rand::rngs::OsRng;
 use crate::{
 use crate::{
     util::{
     util::{
         serial::{SerialDecodable, SerialEncodable},
         serial::{SerialDecodable, SerialEncodable},
-        time::Timestamp,
     },
     },
     crypto::{
     crypto::{
         address::Address,
         address::Address,
@@ -19,13 +18,9 @@ use crate::{
         leadcoin::LeadCoin,
         leadcoin::LeadCoin,
         keypair::Keypair,
         keypair::Keypair,
     },
     },
-    Result, VerifyFailed, VerifyResult,
+    VerifyResult,
 };
 };
 
 
-use log::error;
-
-
-
 #[derive(Debug, Clone, PartialEq, SerialEncodable, SerialDecodable)]
 #[derive(Debug, Clone, PartialEq, SerialEncodable, SerialDecodable)]
 pub struct StakeholderMetadata {
 pub struct StakeholderMetadata {
     /// Block owner signature
     /// Block owner signature

+ 1 - 2
src/consensus/state.rs

@@ -13,8 +13,7 @@ use log::{debug, error, info, warn};
 use rand::rngs::OsRng;
 use rand::rngs::OsRng;
 
 
 use super::{
 use super::{
-    Block, BlockInfo, BlockProposal, OuroborosMetadata, Participant, ProposalChain, StreamletMetadata, Vote, TransactionLeadProof, Header,
-};
+    Block, BlockInfo, BlockProposal, OuroborosMetadata, Participant, ProposalChain, StreamletMetadata, Vote, Header};
 use crate::{
 use crate::{
     blockchain::Blockchain,
     blockchain::Blockchain,
     crypto::{
     crypto::{

+ 0 - 6
src/crypto/lead_proof.rs

@@ -1,13 +1,10 @@
 use std::time::Instant;
 use std::time::Instant;
 
 
 
 
-use halo2_proofs::circuit::Value;
 use log::{
 use log::{
-    debug,
     error
     error
 };
 };
 
 
-use pasta_curves::pallas;
 use rand::rngs::OsRng;
 use rand::rngs::OsRng;
 
 
 use crate::{
 use crate::{
@@ -15,13 +12,10 @@ use crate::{
         types::*,
         types::*,
         leadcoin::LeadCoin,
         leadcoin::LeadCoin,
         proof::{Proof, ProvingKey, VerifyingKey},
         proof::{Proof, ProvingKey, VerifyingKey},
-        util::mod_r_p,
     },
     },
-    zk::circuit::lead_contract::LeadContract,
     Result, VerifyResult, VerifyFailed,
     Result, VerifyResult, VerifyFailed,
 };
 };
 
 
-use rand::{thread_rng, Rng};
 
 
 #[allow(clippy::too_many_arguments)]
 #[allow(clippy::too_many_arguments)]
 pub fn create_lead_proof(pk: &ProvingKey, coin: LeadCoin) -> Result<Proof> {
 pub fn create_lead_proof(pk: &ProvingKey, coin: LeadCoin) -> Result<Proof> {

+ 3 - 4
src/stakeholder/stakeholder.rs

@@ -1,5 +1,4 @@
 use async_executor::Executor;
 use async_executor::Executor;
-use async_trait::async_trait;
 use async_std::sync::Arc;
 use async_std::sync::Arc;
 use log::debug;
 use log::debug;
 use std::fmt;
 use std::fmt;
@@ -17,7 +16,7 @@ use crate::{
         clock::{Clock,Ticks},
         clock::{Clock,Ticks},
         expand_path,
         expand_path,
     },
     },
-    system::{Subscriber, SubscriberPtr, Subscription},
+    system::{Subscription},
     crypto::{
     crypto::{
         proof::{Proof, ProvingKey, VerifyingKey,  },
         proof::{Proof, ProvingKey, VerifyingKey,  },
         leadcoin::{LeadCoin},
         leadcoin::{LeadCoin},
@@ -27,9 +26,9 @@ use crate::{
         address::Address,
         address::Address,
     },
     },
     blockchain::{Blockchain,Epoch,EpochConsensus},
     blockchain::{Blockchain,Epoch,EpochConsensus},
-    net::{P2p,Settings, SettingsPtr, Channel, ChannelPtr, Hosts, HostsPtr,MessageSubscription},
+    net::{P2p,Settings, SettingsPtr, ChannelPtr, MessageSubscription},
     tx::{Transaction},
     tx::{Transaction},
-    Result,Error,
+    Result,
 };
 };
 
 
 use url::Url;
 use url::Url;

+ 0 - 6
src/tx/mod.rs

@@ -1,16 +1,10 @@
 use std::io;
 use std::io;
 
 
-use halo2_proofs::{
-    plonk
-};
-
 use log::error;
 use log::error;
 use pasta_curves::group::Group;
 use pasta_curves::group::Group;
 
 
 use crate::{
 use crate::{
     crypto::{
     crypto::{
-        leadcoin::LeadCoin,
-        lead_proof,
         burn_proof::verify_burn_proof,
         burn_proof::verify_burn_proof,
         keypair::PublicKey,
         keypair::PublicKey,
         mint_proof::verify_mint_proof,
         mint_proof::verify_mint_proof,

+ 1 - 0
src/util/.#clock.rs

@@ -0,0 +1 @@
+ertosns@home.449:1663221444

+ 1 - 4
src/util/clock.rs

@@ -2,12 +2,9 @@ use url::Url;
 use log::debug;
 use log::debug;
 use std::time::Duration;
 use std::time::Duration;
 use std::thread;
 use std::thread;
-use async_trait::async_trait;
 use crate::{
 use crate::{
-    util::{time,Timestamp, NanoTimestamp},
-    error,
+    util::{Timestamp},
     Result,
     Result,
-    error::Error
 };
 };
 
 
 pub enum Ticks {
 pub enum Ticks {

+ 3 - 5
src/zk/circuit/lead_contract.rs

@@ -1,7 +1,7 @@
 use halo2_gadgets::{
 use halo2_gadgets::{
     ecc::{
     ecc::{
         chip::{EccChip, EccConfig},
         chip::{EccChip, EccConfig},
-        FixedPoint, FixedPointBaseField, FixedPointShort, ScalarFixed, ScalarFixedShort,
+        FixedPoint, FixedPointBaseField,  ScalarFixed,
     },
     },
     poseidon::{primitives as poseidon, Hash as PoseidonHash, Pow5Chip as PoseidonChip, Pow5Config as PoseidonConfig},
     poseidon::{primitives as poseidon, Hash as PoseidonHash, Pow5Chip as PoseidonChip, Pow5Config as PoseidonConfig},
     sinsemilla::{
     sinsemilla::{
@@ -15,14 +15,14 @@ use halo2_gadgets::{
 };
 };
 use halo2_proofs::{
 use halo2_proofs::{
     circuit::{AssignedCell, Layouter, SimpleFloorPlanner, Value},
     circuit::{AssignedCell, Layouter, SimpleFloorPlanner, Value},
-    plonk::{Advice, Circuit, Column, ConstraintSystem, Error, TableColumn, Instance as InstanceColumn,},
+    plonk::{Advice, Circuit, Column, ConstraintSystem, Error, Instance as InstanceColumn,},
 };
 };
 use pasta_curves::{pallas, Fp};
 use pasta_curves::{pallas, Fp};
 use crate::crypto::{
 use crate::crypto::{
     constants::{
     constants::{
         sinsemilla::{OrchardCommitDomains, OrchardHashDomains},
         sinsemilla::{OrchardCommitDomains, OrchardHashDomains},
         util::gen_const_array,
         util::gen_const_array,
-        OrchardFixedBases, OrchardFixedBasesFull, ValueCommitV, MERKLE_DEPTH_ORCHARD, NullifierK,
+        OrchardFixedBases, OrchardFixedBasesFull, MERKLE_DEPTH_ORCHARD, NullifierK,
     },
     },
     merkle_node::MerkleNode,
     merkle_node::MerkleNode,
 };
 };
@@ -35,9 +35,7 @@ use crate::zk::gadget::{
     native_range_check::{NativeRangeCheckChip},
     native_range_check::{NativeRangeCheckChip},
 };
 };
 
 
-use pasta_curves::group::{ff::PrimeField, GroupEncoding};
 
 
-const WORD_BITS: u32 = 24;
 const WINDOW_SIZE: usize = 3;
 const WINDOW_SIZE: usize = 3;
 const NUM_OF_BITS: usize = 254;
 const NUM_OF_BITS: usize = 254;
 const NUM_OF_WINDOWS: usize = 85;
 const NUM_OF_WINDOWS: usize = 85;