Jelajahi Sumber

remove some things from zk scripts

narodnik 5 tahun lalu
induk
melakukan
3f0abbd808
2 mengubah file dengan 2 tambahan dan 30 penghapusan
  1. 1 1
      scripts/finite_fields/polynomial.py
  2. 1 29
      scripts/zk/4.4-proof-of-operation.py

+ 1 - 1
scripts/finite_fields/polynomial.py

@@ -4,7 +4,7 @@ except ImportError:
     from itertools import izip_longest as zip_longest
 import fractions
 
-from numbertype import *
+from .numbertype import *
 
 # strip all copies of elt from the end of the list
 def strip(L, elt):

+ 1 - 29
scripts/zk/4.4-proof-of-operation.py

@@ -48,7 +48,7 @@ encrypted_shifted_powers_g2 = [
 ]
 
 # evaluates unencrypted target polynomial with s: t(s)
-target = (s - 1) * (s - 2)
+target = (s - 1)
 # CRS = common reference string = trusted setup parameters
 target_crs = g1 * target
 alpha_crs = g2 * a
@@ -64,32 +64,6 @@ alpha_crs_g1 = g1 * a
 # Prover
 #################################
 
-# delta shift
-# Removed for now
-#delta = rand_scalar()
-
-# E(p(s)) = p(s)G
-#         = c_d s^d G + ... + c_1 s^1 G + c_0 s^0 G
-#         = s^3 G - 3 s^2 G + 2 s G
-# E(h(s)) = sG
-# t(s) = s^2 - 3s + 2
-# E(h(s)) t(s) = s^3 G - 3 s^2 G + 2 s G
-
-# Lets test these manually:
-
-e_s = encrypted_powers
-e_p_s = e_s[3] - 3 * e_s[2] + 2 * e_s[1]
-e_h_s = e_s[1]
-t_s = s**2 - 3*s + 2
-assert t_s == target
-assert e_p_s == e_h_s * t_s
-
-e_as = encrypted_shifted_powers
-e_p_as = e_as[3] - 3 * e_as[2] + 2 * e_as[1]
-assert e_p_s * a == e_p_as
-
-#############################
-
 left_poly = np.poly1d([3])
 right_poly = np.poly1d([2])
 out_poly = np.poly1d([6])
@@ -118,8 +92,6 @@ def evaluate(poly, encrypted_powers, identity):
             result -= power * (-coeff)
         else:
             result += power * coeff
-    # Add delta to the result
-    # Free extra obfuscation to the polynomial
     return result
 
 assert left_poly * right_poly == out_poly