Commit Graph

1257 Commits

Author SHA1 Message Date
ghassmo
864760df4a Cashier: avoid generating new keypair if keys exist in cashierdb 2021-09-03 04:24:32 +03:00
ghassmo
bbbf469b3d cargo fmt 2021-09-03 04:03:43 +03:00
ghassmo
6fa951b5f3 use debug macro instead of info for debugging & add proper name for target field in each debug macro 2021-09-03 03:56:27 +03:00
ghassmo
59436a1197 fix bugs in the process of withdrawing 2021-09-03 03:13:00 +03:00
ghassmo
133cd13654 update README.md 2021-09-01 15:50:29 +03:00
ghassmo
a362e6aff5 add and pass needed config params to cashierd 2021-09-01 15:46:29 +03:00
ghassmo
13519a7302 cargo fmt 2021-09-01 15:08:13 +03:00
ghassmo
d8eeb7656f Merge branch 'master' of github.com:darkrenaissance/darkfi 2021-09-01 15:06:33 +03:00
ghassmo
4d35fc0e58 wrap client with mutex inside cashier service 2021-09-01 14:59:04 +03:00
Janus
c21699b312 Use shorthand for errors and fmt 2021-08-31 22:14:36 -04:00
Janus
e0e75e7149 Cleanup start_subscribe for btc watching 2021-08-31 16:49:18 -04:00
Janus
a85b840af0 Return GetBalanceRes when scriptpubkey balance is confirmed 2021-08-31 11:52:10 -04:00
ghassmo
7283cc4ada minor changes in walletdb.rs 2021-08-31 14:40:47 +03:00
ghassmo
cd07494953 remove cash_gen_key function from walletdb.rs 2021-08-31 14:32:12 +03:00
ghassmo
4a1716bd3d update todo.md 2021-08-31 14:30:45 +03:00
Janus
9f611c650c Pop scriptpubkey in loop and on change check balance 2021-08-30 15:52:32 -04:00
ghassmo
b6a27a60c5 create Client object for CashierService 2021-08-30 03:10:55 +03:00
ghassmo
f59b7e277c update .gitignore 2021-08-30 03:09:02 +03:00
ghassmo
fff6827343 darkfid return ClientResult with a proper message instead of panic and crash 2021-08-30 01:06:44 +03:00
ghassmo
4a1ecdcbfc create specific error type for client 2021-08-28 19:17:25 +03:00
ghassmo
da9d285cac Merge branch 'master' of github.com:darkrenaissance/darkfi 2021-08-28 16:00:31 +03:00
ghassmo
dcd44c2a71 check if there are coins before transfer the coins 2021-08-28 15:59:42 +03:00
narodnik
2f1ab4a53f halo2: fix TODO item by using quo_rem() function instead of / 2021-08-28 14:08:57 +02:00
narodnik
9f983a998e halo2: add final evaluation check for h(X) 2021-08-28 13:34:14 +02:00
narodnik
93575638bd halo2: working permutation argument 2021-08-28 13:18:08 +02:00
narodnik
b4b3c877cf halo2: create permuted indices
diff --git a/scripts/halo/halo2.sage b/scripts/halo/halo2.sage
index ae207ea..9510eaf 100644
--- a/scripts/halo/halo2.sage
+++ b/scripts/halo/halo2.sage
@@ -60,12 +60,13 @@ F_1_1, F_2_1, F_3_1, F_4_1 = 1, 0, 0, 0
 I_1 = var_z

 # Row 2
-# A1 == I
+# ~0 == 0
 A_1_2, A_2_2, A_3_2, A_4_2 = var_zero, 0, 0, 0
 F_1_2, F_2_2, F_3_2, F_4_2 = 0, 1, 0, 0
 I_2 = 0

 # Row 3
+# Boolean check
 # (1 - s)(s + 0) == 0
 A_1_3, A_2_3, A_3_3, A_4_3 = var_s, var_s, var_zero, var_zero
 F_1_3, F_2_3, F_3_3, F_4_3 = 0, 0, 1, 0
@@ -151,17 +152,63 @@ for i, (A_1_i, A_2_i, A_3_i, A_4_i, F_1_i, F_2_i, F_3_i, F_4_i, I_i) in \

 # beta, gamma

-#       0   1   2    3             4           5    6       ...     15
-# A1:   1,  0,  s,   s,            s,          0,   z
-#      16  17  18   19            20          21   22       ...     31
-# A2:   -,  -,  s,   x,            x,        sxy,   -
-#      32  33  34   35            36          37   38       ...     47
-# A3:   -,  -,  0,   y,            y, (1-s)(x+y),   -
-#      48  49  50   51            52          53   54       ...     63
-# A4:   -,  -,  0, sxy, (1-s)(x + y),          z,   -
-#      64  65  66   67            68          69   70       ...     79
-# A5:   -,  -,  -,   -,            -,          -,   z
-permuted_indices_A1 = []
+#       0   1   2    3             4           5      ...     15
+# A1:   z,  0,  s,   s,            s,          0,
+#
+#      16  17  18   19            20          21      ...     31
+# A2:   -,  -,  s,   x,            x,        sxy,
+#
+#      32  33  34   35            36          37      ...     47
+# A3:   -,  -,  0,   y,            y, (1-s)(x+y),
+#
+#      48  49  50   51            52          53      ...     63
+# A4:   -,  -,  0, sxy, (1-s)(x + y),          z,
+#
+#      64  65  66   67            68          69      ...     79
+# A5:   z,  -,  -,   -,            -,          -,
+
+# z = (0 53 64)
+# 0 = (1 5 34 50)
+# s = (2 3 4 18)
+# x = (19 20)
+# sxy = (21 51)
+# y = (35 36)
+# (1-s)(x+y) = (37 52)
+
+permuted_indices = list(range(n * 5))
+assert len(permuted_indices) == 80
+
+# Apply the actual permutation cycles
+# z
+permuted_indices[0] = 53
+permuted_indices[53] = 64
+permuted_indices[64] = 0
+# ~0
+permuted_indices[1] = 5
+permuted_indices[5] = 34
+permuted_indices[34] = 50
+permuted_indices[50] = 1
+# s
+permuted_indices[2] = 3
+permuted_indices[3] = 4
+permuted_indices[4] = 18
+permuted_indices[18] = 2
+# x
+permuted_indices[19] = 20
+permuted_indices[20] = 19
+# sxy
+permuted_indices[21] = 51
+permuted_indices[51] = 21
+# y
+permuted_indices[35] = 36
+permuted_indices[36] = 35
+# (1-s)(x+y)
+permuted_indices[37] = 52
+permuted_indices[52] = 37
+
+witness = A1 + A2 + A3 + A4 + I
+for i, val in enumerate(witness):
+    assert val == witness[permuted_indices[i]]

 y = K.random_element()
2021-08-28 13:18:08 +02:00
narodnik
8d9b8c8fcd halo2: remove useless constraint 2021-08-28 13:18:08 +02:00
ghassmo
8ebb0e2b7a minor changes in client.rs 2021-08-28 04:25:28 +03:00
ghassmo
a1c2ad5ee9 pass the paths for mint and spend params when initialize a Client 2021-08-28 04:02:46 +03:00
ghassmo
3bd5ffac06 cargo fix & cargo fmt 2021-08-27 17:45:19 +03:00
ghassmo
996cd04335 move all functionalities inside darkfid to a new module client/client.rs 2021-08-27 17:37:58 +03:00
ghassmo
14e984d4b9 detach jsonserver task instead of waiting 2021-08-27 17:36:32 +03:00
ghassmo
900818973b print an explicit error for async_channel 2021-08-27 17:35:09 +03:00
ghassmo
253bf174a5 pass subscriber address when start gateway client 2021-08-27 17:34:18 +03:00
Janus
e440409d81 New btc keys create a connection to existing Electrum Client 2021-08-26 19:22:08 -04:00
Janus
8da9496f52 Run cargo fmt 2021-08-26 08:55:09 -04:00
Janus
1c834bbe5f Make ElectrumClient spawn from cashier 2021-08-26 08:46:44 -04:00
lunar-mining
231d09b8d3 added rpc support to cashierd 2021-08-26 14:02:49 +02:00
narodnik
51bc448a1d halo2: add comment with indices table for permutation cycles 2021-08-26 21:38:58 +02:00
narodnik
1518a44377 halo2: add random blinding rows 2021-08-26 21:30:56 +02:00
lunar-mining
b9b33b638e generalized jsonserver.rs to work with different services 2021-08-26 12:05:09 +02:00
narodnik
3077d70e68 halo2: fix broken arithmetization since gates are independent 2021-08-25 21:47:31 +02:00
narodnik
74b8ed57fa halo2: create lagrange witness and selector polys 2021-08-25 16:52:03 +02:00
narodnik
d7085255cc halo2: delta value used in permutation arg 2021-08-25 16:51:48 +02:00
narodnik
4db7da2a1e halo2 arithmetization of a circuit 2021-08-25 12:07:38 +02:00
narodnik
e3af3e9e2c add clarifying comment to plonk.sage 2021-08-24 21:27:10 +02:00
narodnik
348a3ad89a begin halo2 prover 2021-08-24 21:27:10 +02:00
parazyd
7b858f350b halo2: Burn stub 2021-08-24 10:00:37 +02:00
parazyd
1e6ed3d959 halo2: Move generic function to lib.rs 2021-08-23 16:27:21 +02:00
Janus
7da18619d8 Add subscribe to electrum script to BitcoinKeys 2021-08-23 09:54:58 -04:00