Prechádzať zdrojové kódy

replace greater_than with less_than

mohab metwally 4 rokov pred
rodič
commit
615edd886a
2 zmenil súbory, kde vykonal 11 pridanie a 11 odobranie
  1. 9 9
      src/zk/circuit/lead_contract.rs
  2. 2 2
      src/zk/gadget/mod.rs

+ 9 - 9
src/zk/circuit/lead_contract.rs

@@ -19,7 +19,7 @@ use halo2_proofs::{
 };
 };
 
 
 use pasta_curves::{pallas, Fp};
 use pasta_curves::{pallas, Fp};
-use crate::zk::gadget::greater_than::GreaterThanInstruction;
+use crate::zk::gadget::less_than::LessThanInstruction;
 
 
 use crate::crypto::{
 use crate::crypto::{
     constants::{
     constants::{
@@ -33,7 +33,7 @@ use crate::crypto::{
 use crate::zk::gadget::{
 use crate::zk::gadget::{
     arithmetic::{ArithChip, ArithConfig, ArithInstruction},
     arithmetic::{ArithChip, ArithConfig, ArithInstruction},
     even_bits::{EvenBitsChip, EvenBitsConfig, EvenBitsLookup},
     even_bits::{EvenBitsChip, EvenBitsConfig, EvenBitsLookup},
-    greater_than::{ GreaterThanConfig, GreaterThanChip},
+    less_than::{ LessThanConfig, LessThanChip},
 };
 };
 
 
 use pasta_curves::group::{ff::PrimeField, GroupEncoding};
 use pasta_curves::group::{ff::PrimeField, GroupEncoding};
@@ -52,7 +52,7 @@ pub struct LeadConfig {
         SinsemillaConfig<OrchardHashDomains, OrchardCommitDomains, OrchardFixedBases>,
         SinsemillaConfig<OrchardHashDomains, OrchardCommitDomains, OrchardFixedBases>,
     _sinsemilla_config_2:
     _sinsemilla_config_2:
         SinsemillaConfig<OrchardHashDomains, OrchardCommitDomains, OrchardFixedBases>,
         SinsemillaConfig<OrchardHashDomains, OrchardCommitDomains, OrchardFixedBases>,
-    greaterthan_config: GreaterThanConfig,
+    lessthan_config: LessThanConfig,
     evenbits_config: EvenBitsConfig,
     evenbits_config: EvenBitsConfig,
     arith_config: ArithConfig,
     arith_config: ArithConfig,
 }
 }
@@ -78,8 +78,8 @@ impl LeadConfig {
         MerkleChip::construct(self.merkle_config_2.clone())
         MerkleChip::construct(self.merkle_config_2.clone())
     }
     }
 
 
-    fn greaterthan_chip(&self) -> GreaterThanChip<pallas::Base, WORD_BITS> {
-        GreaterThanChip::construct(self.greaterthan_config.clone())
+    fn lessthan_chip(&self) -> LessThanChip<pallas::Base, WORD_BITS> {
+        LessThanChip::construct(self.lessthan_config.clone())
     }
     }
 
 
     fn evenbits_chip(&self) -> EvenBitsChip<pallas::Base, WORD_BITS> {
     fn evenbits_chip(&self) -> EvenBitsChip<pallas::Base, WORD_BITS> {
@@ -228,7 +228,7 @@ impl Circuit<pallas::Base> for LeadContract {
             (sinsemilla_config_2, merkle_config_2)
             (sinsemilla_config_2, merkle_config_2)
         };
         };
 
 
-         let greaterthan_config = GreaterThanChip::<pallas::Base, WORD_BITS>::configure(
+         let lessthan_config = LessThanChip::<pallas::Base, WORD_BITS>::configure(
              meta,
              meta,
              advices[10..12].try_into().unwrap(),
              advices[10..12].try_into().unwrap(),
              primary,
              primary,
@@ -245,7 +245,7 @@ impl Circuit<pallas::Base> for LeadContract {
             merkle_config_2,
             merkle_config_2,
             sinsemilla_config_1,
             sinsemilla_config_1,
             _sinsemilla_config_2: sinsemilla_config_2,
             _sinsemilla_config_2: sinsemilla_config_2,
-            greaterthan_config,
+            lessthan_config,
             evenbits_config,
             evenbits_config,
             arith_config,
             arith_config,
         }
         }
@@ -261,7 +261,7 @@ impl Circuit<pallas::Base> for LeadContract {
         let ar_chip = config.arith_chip();
         let ar_chip = config.arith_chip();
         let _ps_chip = config.poseidon_chip();
         let _ps_chip = config.poseidon_chip();
         let eb_chip = config.evenbits_chip();
         let eb_chip = config.evenbits_chip();
-        let greater_than_chip = config.greaterthan_chip();
+        let less_than_chip = config.lessthan_chip();
 
 
         eb_chip.alloc_table(&mut layouter.namespace(|| "alloc table"))?;
         eb_chip.alloc_table(&mut layouter.namespace(|| "alloc table"))?;
 
 
@@ -599,7 +599,7 @@ impl Circuit<pallas::Base> for LeadContract {
         eb_chip.decompose(layouter.namespace(|| "target range check"), target.clone())?;
         eb_chip.decompose(layouter.namespace(|| "target range check"), target.clone())?;
         eb_chip.decompose(layouter.namespace(|| "y_commit  range check"), y_commit_base.clone())?;
         eb_chip.decompose(layouter.namespace(|| "y_commit  range check"), y_commit_base.clone())?;
 
 
-        let (helper, is_gt) = greater_than_chip.greater_than(
+        let (helper, is_gt) = less_than_chip.less_than(
             layouter.namespace(|| "t>y"),
             layouter.namespace(|| "t>y"),
             target.into(),
             target.into(),
                     y_commit_base.into(),
                     y_commit_base.into(),

+ 2 - 2
src/zk/gadget/mod.rs

@@ -4,8 +4,8 @@ pub mod arithmetic;
 /// Even-bits lookup table
 /// Even-bits lookup table
 pub mod even_bits;
 pub mod even_bits;
 
 
-// Greater than comparison gadget;
-pub mod greater_than;
+// less than comparison gadget;
+pub mod less_than;
 
 
 /// Comparison gadget
 /// Comparison gadget
 pub mod cmp;
 pub mod cmp;