Explorar o código

[zk/lead] pruned abit..

mohab %!s(int64=4) %!d(string=hai) anos
pai
achega
a9d9fa0abc
Modificáronse 2 ficheiros con 3 adicións e 26 borrados
  1. 1 11
      example/lead.rs
  2. 2 15
      src/zk/circuit/lead_contract.rs

+ 1 - 11
example/lead.rs

@@ -112,21 +112,11 @@ fn main() {
         let c_pk_pt = c_pk.to_affine().coordinates().unwrap();
         let c_pk_pt_x : pallas::Base = *c_pk_pt.x();
         let c_pk_pt_y : pallas::Base = *c_pk_pt.y();
-        /*
-        let c_cm_message = [
-            c_pk_pt_x,clone(),
-            c_pk_pt_y.clone(),
-            c_v.clone(),
-            c_seed.clone()
-        ];
-        let c_cm_v poseidon::Hash::<_, P128Pow5T3, ConstantLength<2>, 3, 2>::init().hash(c_cm_message);
-         */
+
         let c_cm_v = c_v.clone() * c_seed.clone() * c_pk_pt_x * c_pk_pt_y;
         let c_cm1_blind = pallas::Base::from(1); //tmp val
         let c_cm2_blind = pallas::Base::from(1); //tmp val
         let c_cm: pallas::Point = pedersen_commitment_scalar(mod_r_p(c_cm_v), mod_r_p(c_cm1_blind));
-        //TODO this return run time error! assertion error, it's out of range most likely
-        //let c_cm_base_bytes : [u8; 32] = c_cm.to_bytes();
 
 
         let c_cm_coordinates = c_cm.to_affine().coordinates().unwrap();

+ 2 - 15
src/zk/circuit/lead_contract.rs

@@ -436,18 +436,7 @@ impl Circuit<pallas::Base> for LeadContract {
         // ==========================
         // commitment of coins c1,c2
         // ==========================
-        //TODO should the reward be added to new minted coin?
-        // read the commitment
-        // concatenate message
-        // subtract those cm and commit output, constraint the output, that should equal 1.
-        //
-        //TODO this proof need to be for the two coins commitment,
-        // but cm1 doesn't exist in public inputs, or witnesses,
-        // does it make sense to calculate cm1, and proof decomm(cm1, coin2, r2)=true?
-        // that doesn't make any sense!
-        // this is the proof for the second commitment only
-        //TODO does both coins have the same value?!! doesn't make sense
-        //but only single value is in witness.
+        //TODO (res) should the reward be added to new minted coin?
 
         /*
         let coin_hash  = {
@@ -472,7 +461,6 @@ impl Circuit<pallas::Base> for LeadContract {
         };
          */
         let coin_val = {
-            //TODO (research) this panic probably due to arith_chip overflowing
 
             let coin_val_pt = ar_chip.mul(layouter.namespace(|| ""),
                                        coin_pk_y.clone(),
@@ -606,7 +594,6 @@ impl Circuit<pallas::Base> for LeadContract {
         let computed_final_root = merkle_inputs
             .calculate_root(layouter.namespace(|| "calculate root"), coin_commit_prod.clone())?;
 
-        //TODO (fix)
 
         layouter.constrain_instance(
             computed_final_root.cell(),
@@ -673,7 +660,7 @@ impl Circuit<pallas::Base> for LeadContract {
             )?
         };
         let rho_commit = com.add(layouter.namespace(|| "nonce commit"), &blind)?;
-        //TODO in case of the v_max lead statement you need to provide a proof
+
         // that the coin value never get past it.
         let scalar = self.load_private(
             layouter.namespace(|| "load scalar "),