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

+ 0 - 1
Cargo.lock

@@ -1164,7 +1164,6 @@ dependencies = [
  "darkfi-derive-internal",
  "darkfi-sdk",
  "dashu",
- "dashu-macros",
  "dirs",
  "ed25519-compact",
  "env_logger",

+ 0 - 1
Cargo.toml

@@ -131,7 +131,6 @@ sled = {version = "0.34.7", optional = true}
 
 # big float
 dashu = { version = "0.2.0", git = "https://github.com/ertosns/dashu" } 
-dashu-macros = { version = "0.2.0",  git = "https://github.com/ertosns/dashu" }
 
 # env logger
 env_logger = "0.9.1"

+ 0 - 4
src/stakeholder/epoch.rs

@@ -25,10 +25,6 @@ use crate::crypto::{
 
 };
 use crate::stakeholder::utils::{fbig2ibig, base2ibig};
-
-use dashu::float::{DBig, FBig, round::{mode::{HalfAway, Zero}, Rounding::*}};
-use dashu::integer::{IBig,UBig,Sign};
-
 use crate::stakeholder::Float10;
 use crate::stakeholder::consts::{RADIX_BITS};
 

+ 5 - 14
src/stakeholder/mod.rs

@@ -55,11 +55,6 @@ use pasta_curves::pallas;
 
 use group::ff::PrimeField;
 
-
-use dashu::float::{DBig, FBig, round::{mode::{HalfAway, Zero}, Rounding::*}};
-use dashu::integer::{IBig};
-use dashu_macros::fbig;
-
 pub mod epoch;
 pub use epoch::{Epoch, EpochConsensus};
 
@@ -524,14 +519,10 @@ impl Stakeholder {
         let eta = self.get_eta();
         let mut epoch = Epoch::new(self.epoch_consensus, eta);
         // total stake
-        let num_slots = self.workspace.sl;
-        let epochs = self.workspace.e;
-        let epoch_len = self.epoch_consensus.get_epoch_len();
-        // TODO sigma scalar for tunning target function
-        // it's value is dependent on the tekonomics,
-        // set to one untill then.
-        let reward = pallas::Base::one();
-        let num_slots = num_slots + epochs * epoch_len;
+        // let rel_sl = self.workspace.sl;
+        // let epochs = self.workspace.e;
+        // let epoch_len = self.epoch_consensus.get_epoch_len();
+        // let abs_sl = rel_sl + epochs * epoch_len;
         //
         let f = self.get_f();
         let total_stake = self.epoch.consensus.total_stake(e, sl);
@@ -550,7 +541,7 @@ impl Stakeholder {
             .with_precision(RADIX_BITS)
         .value();
         */
-        let mut field_p = Float10::from_str_native(P)
+        let field_p = Float10::from_str_native(P)
             .unwrap()
             .with_precision(RADIX_BITS)
             .value();

+ 1 - 2
src/stakeholder/types.rs

@@ -1,4 +1,3 @@
-use dashu::float::{DBig, FBig, round::{mode::{HalfAway, Zero}, Rounding::*}};
-use dashu::integer::{IBig};
+use dashu::float::{FBig, round::{mode::{Zero}, }};
 
 pub(crate) type Float10 = FBig<Zero,10>;

+ 0 - 3
src/stakeholder/utils.rs

@@ -1,9 +1,7 @@
 use pasta_curves::pallas;
 use group::ff::PrimeField;
-use dashu::float::{DBig, FBig, round::{mode::{HalfAway, Zero}, Rounding::*}};
 use dashu::integer::{IBig, Sign, UBig};
 use crate::stakeholder::Float10;
-use crate::stakeholder::consts::{RADIX_BITS};
 use log::{info};
 
 pub(crate) fn fbig2ibig(f: Float10) -> IBig {
@@ -57,7 +55,6 @@ mod tests {
     use crate::stakeholder::utils::{base2ibig, fbig2base, fbig2ibig};
     use crate::stakeholder::consts::{RADIX_BITS};
     use pasta_curves::pallas;
-    use dashu::float::{DBig, FBig, round::{mode::{HalfAway, Zero}, Rounding::*}};
     use dashu::integer::{IBig};
     use crate::stakeholder::Float10;
     #[test]

+ 0 - 8
src/zk/circuit/lead_contract.rs

@@ -285,13 +285,6 @@ impl Circuit<pallas::Base> for LeadContract {
         // load witnesses
         // ===============
 
-        // constant identity value 1
-        let one = self.load_private(
-            layouter.namespace(|| "one"),
-            config.advices[0],
-            Value::known(pallas::Base::one()),
-        )?;
-
         // prefix to the pseudo-random-function that prefix input
         // to the nullifier poseidon hash
         let prf_nullifier_prefix_base = self.load_private(
@@ -609,7 +602,6 @@ impl Circuit<pallas::Base> for LeadContract {
         let term2 = ar_chip.mul(layouter.namespace(|| "calculate term2"), &term2_1, &coin_value.clone())?;
 
         let target = ar_chip.add(layouter.namespace(|| "calculate target"), &term1, &term2)?;
-        let target = ar_chip.mul(layouter.namespace(|| ""), &one, &coin_value.clone())?;
         let target: Value<pallas::Base> = target.value().cloned();
 
         let y: Value<pallas::Base> = y_commit_base.value().cloned();