@maci-protocol/coordinator 0.0.0-ci.533e19d → 0.0.0-ci.53702dc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +31 -6
  3. package/build/hardhat.config.cjs +9 -3
  4. package/build/hardhat.config.cjs.map +1 -1
  5. package/build/hardhat.config.d.cts +9 -4
  6. package/build/scripts/generateKeypair.js +2 -2
  7. package/build/scripts/generateKeypair.js.map +1 -1
  8. package/build/scripts/generateMaciKeyPair.js +2 -2
  9. package/build/scripts/generateMaciKeyPair.js.map +1 -1
  10. package/build/tests/constants.d.ts +3 -4
  11. package/build/tests/constants.d.ts.map +1 -1
  12. package/build/tests/constants.js +5 -4
  13. package/build/tests/constants.js.map +1 -1
  14. package/build/tests/e2e.deploy.test.js +131 -101
  15. package/build/tests/e2e.deploy.test.js.map +1 -1
  16. package/build/tests/e2e.redis.test.d.ts +2 -0
  17. package/build/tests/e2e.redis.test.d.ts.map +1 -0
  18. package/build/tests/e2e.redis.test.js +118 -0
  19. package/build/tests/e2e.redis.test.js.map +1 -0
  20. package/build/tests/utils.d.ts +7 -1
  21. package/build/tests/utils.d.ts.map +1 -1
  22. package/build/tests/utils.js +17 -6
  23. package/build/tests/utils.js.map +1 -1
  24. package/build/ts/app.module.d.ts.map +1 -1
  25. package/build/ts/app.module.js +6 -0
  26. package/build/ts/app.module.js.map +1 -1
  27. package/build/ts/common/__tests__/common.test.js +44 -46
  28. package/build/ts/common/__tests__/common.test.js.map +1 -1
  29. package/build/ts/common/accountAbstraction.d.ts +7 -24
  30. package/build/ts/common/accountAbstraction.d.ts.map +1 -1
  31. package/build/ts/common/accountAbstraction.js +22 -49
  32. package/build/ts/common/accountAbstraction.js.map +1 -1
  33. package/build/ts/common/chain.d.ts +22 -0
  34. package/build/ts/common/chain.d.ts.map +1 -0
  35. package/build/ts/common/chain.js +37 -0
  36. package/build/ts/common/chain.js.map +1 -0
  37. package/build/ts/common/coordinatorKeypair.d.ts +7 -0
  38. package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
  39. package/build/ts/common/coordinatorKeypair.js +14 -0
  40. package/build/ts/common/coordinatorKeypair.js.map +1 -0
  41. package/build/ts/common/errors.d.ts +13 -10
  42. package/build/ts/common/errors.d.ts.map +1 -1
  43. package/build/ts/common/errors.js +12 -9
  44. package/build/ts/common/errors.js.map +1 -1
  45. package/build/ts/common/index.d.ts +2 -1
  46. package/build/ts/common/index.d.ts.map +1 -1
  47. package/build/ts/common/index.js +2 -1
  48. package/build/ts/common/index.js.map +1 -1
  49. package/build/ts/common/networks.d.ts +2 -21
  50. package/build/ts/common/networks.d.ts.map +1 -1
  51. package/build/ts/common/networks.js +39 -48
  52. package/build/ts/common/networks.js.map +1 -1
  53. package/build/ts/common/types.d.ts +2 -3
  54. package/build/ts/common/types.d.ts.map +1 -1
  55. package/build/ts/deployer/__tests__/deployer.controller.test.js +23 -25
  56. package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -1
  57. package/build/ts/deployer/__tests__/deployer.service.test.js +182 -337
  58. package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -1
  59. package/build/ts/deployer/__tests__/utils.d.ts +31 -6
  60. package/build/ts/deployer/__tests__/utils.d.ts.map +1 -1
  61. package/build/ts/deployer/__tests__/utils.js +48 -15
  62. package/build/ts/deployer/__tests__/utils.js.map +1 -1
  63. package/build/ts/deployer/deployer.service.d.ts +26 -53
  64. package/build/ts/deployer/deployer.service.d.ts.map +1 -1
  65. package/build/ts/deployer/deployer.service.js +345 -453
  66. package/build/ts/deployer/deployer.service.js.map +1 -1
  67. package/build/ts/deployer/dto.d.ts +7 -7
  68. package/build/ts/deployer/dto.d.ts.map +1 -1
  69. package/build/ts/deployer/dto.js +14 -6
  70. package/build/ts/deployer/dto.js.map +1 -1
  71. package/build/ts/deployer/types.d.ts +103 -45
  72. package/build/ts/deployer/types.d.ts.map +1 -1
  73. package/build/ts/file/__tests__/file.service.test.js +12 -11
  74. package/build/ts/file/__tests__/file.service.test.js.map +1 -1
  75. package/build/ts/file/file.service.d.ts +4 -3
  76. package/build/ts/file/file.service.d.ts.map +1 -1
  77. package/build/ts/file/file.service.js +16 -10
  78. package/build/ts/file/file.service.js.map +1 -1
  79. package/build/ts/file/types.d.ts +2 -2
  80. package/build/ts/file/types.d.ts.map +1 -1
  81. package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
  82. package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
  83. package/build/ts/health/__tests__/health.controller.test.js +52 -0
  84. package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
  85. package/build/ts/health/__tests__/health.service.test.d.ts +2 -0
  86. package/build/ts/health/__tests__/health.service.test.d.ts.map +1 -0
  87. package/build/ts/health/__tests__/health.service.test.js +101 -0
  88. package/build/ts/health/__tests__/health.service.test.js.map +1 -0
  89. package/build/ts/health/health.controller.d.ts +16 -0
  90. package/build/ts/health/health.controller.d.ts.map +1 -0
  91. package/build/ts/health/health.controller.js +43 -0
  92. package/build/ts/health/health.controller.js.map +1 -0
  93. package/build/ts/health/health.module.d.ts +3 -0
  94. package/build/ts/health/health.module.d.ts.map +1 -0
  95. package/build/ts/health/health.module.js +22 -0
  96. package/build/ts/health/health.module.js.map +1 -0
  97. package/build/ts/health/health.service.d.ts +42 -0
  98. package/build/ts/health/health.service.d.ts.map +1 -0
  99. package/build/ts/health/health.service.js +176 -0
  100. package/build/ts/health/health.service.js.map +1 -0
  101. package/build/ts/health/types.d.ts +87 -0
  102. package/build/ts/health/types.d.ts.map +1 -0
  103. package/build/ts/health/types.js +2 -0
  104. package/build/ts/health/types.js.map +1 -0
  105. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts +11 -0
  106. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts.map +1 -0
  107. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js +12 -0
  108. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js.map +1 -0
  109. package/build/ts/proof/__tests__/proof.controller.test.js +6 -5
  110. package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -1
  111. package/build/ts/proof/__tests__/proof.gateway.test.js +5 -3
  112. package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -1
  113. package/build/ts/proof/__tests__/proof.service.test.js +31 -75
  114. package/build/ts/proof/__tests__/proof.service.test.js.map +1 -1
  115. package/build/ts/proof/dto.d.ts +15 -18
  116. package/build/ts/proof/dto.d.ts.map +1 -1
  117. package/build/ts/proof/dto.js +55 -49
  118. package/build/ts/proof/dto.js.map +1 -1
  119. package/build/ts/proof/proof.controller.d.ts +3 -2
  120. package/build/ts/proof/proof.controller.d.ts.map +1 -1
  121. package/build/ts/proof/proof.controller.js +1 -4
  122. package/build/ts/proof/proof.controller.js.map +1 -1
  123. package/build/ts/proof/proof.module.d.ts.map +1 -1
  124. package/build/ts/proof/proof.module.js +1 -0
  125. package/build/ts/proof/proof.module.js.map +1 -1
  126. package/build/ts/proof/proof.service.d.ts +4 -6
  127. package/build/ts/proof/proof.service.d.ts.map +1 -1
  128. package/build/ts/proof/proof.service.js +48 -130
  129. package/build/ts/proof/proof.service.js.map +1 -1
  130. package/build/ts/proof/types.d.ts +21 -17
  131. package/build/ts/proof/types.d.ts.map +1 -1
  132. package/build/ts/proof/types.js.map +1 -1
  133. package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
  134. package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
  135. package/build/ts/redis/__tests__/redis.service.test.js +148 -0
  136. package/build/ts/redis/__tests__/redis.service.test.js.map +1 -0
  137. package/build/ts/redis/redis.module.d.ts +3 -0
  138. package/build/ts/redis/redis.module.d.ts.map +1 -0
  139. package/build/ts/redis/redis.module.js +18 -0
  140. package/build/ts/redis/redis.module.js.map +1 -0
  141. package/build/ts/redis/redis.service.d.ts +53 -0
  142. package/build/ts/redis/redis.service.d.ts.map +1 -0
  143. package/build/ts/redis/redis.service.js +99 -0
  144. package/build/ts/redis/redis.service.js.map +1 -0
  145. package/build/ts/redis/types.d.ts +66 -0
  146. package/build/ts/redis/types.d.ts.map +1 -0
  147. package/build/ts/redis/types.js +2 -0
  148. package/build/ts/redis/types.js.map +1 -0
  149. package/build/ts/redis/utils.d.ts +20 -0
  150. package/build/ts/redis/utils.d.ts.map +1 -0
  151. package/build/ts/redis/utils.js +27 -0
  152. package/build/ts/redis/utils.js.map +1 -0
  153. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts +2 -0
  154. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts.map +1 -0
  155. package/build/ts/scheduler/__tests__/scheduler.controller.test.js +62 -0
  156. package/build/ts/scheduler/__tests__/scheduler.controller.test.js.map +1 -0
  157. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts +2 -0
  158. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts.map +1 -0
  159. package/build/ts/scheduler/__tests__/scheduler.service.test.js +369 -0
  160. package/build/ts/scheduler/__tests__/scheduler.service.test.js.map +1 -0
  161. package/build/ts/scheduler/dto.d.ts +41 -0
  162. package/build/ts/scheduler/dto.d.ts.map +1 -0
  163. package/build/ts/scheduler/dto.js +115 -0
  164. package/build/ts/scheduler/dto.js.map +1 -0
  165. package/build/ts/scheduler/scheduler.controller.d.ts +32 -0
  166. package/build/ts/scheduler/scheduler.controller.d.ts.map +1 -0
  167. package/build/ts/scheduler/scheduler.controller.js +111 -0
  168. package/build/ts/scheduler/scheduler.controller.js.map +1 -0
  169. package/build/ts/scheduler/scheduler.module.d.ts +3 -0
  170. package/build/ts/scheduler/scheduler.module.d.ts.map +1 -0
  171. package/build/ts/scheduler/scheduler.module.js +24 -0
  172. package/build/ts/scheduler/scheduler.module.js.map +1 -0
  173. package/build/ts/scheduler/scheduler.service.d.ts +71 -0
  174. package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
  175. package/build/ts/scheduler/scheduler.service.js +297 -0
  176. package/build/ts/scheduler/scheduler.service.js.map +1 -0
  177. package/build/ts/scheduler/types.d.ts +65 -0
  178. package/build/ts/scheduler/types.d.ts.map +1 -0
  179. package/build/ts/scheduler/types.js +2 -0
  180. package/build/ts/scheduler/types.js.map +1 -0
  181. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +2 -2
  182. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -1
  183. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +34 -19
  184. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -1
  185. package/build/ts/sessionKeys/__tests__/utils.d.ts +1 -1
  186. package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -1
  187. package/build/ts/sessionKeys/__tests__/utils.js +7 -6
  188. package/build/ts/sessionKeys/__tests__/utils.js.map +1 -1
  189. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
  190. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
  191. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
  192. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
  193. package/build/ts/sessionKeys/sessionKeys.service.d.ts +16 -4
  194. package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -1
  195. package/build/ts/sessionKeys/sessionKeys.service.js +23 -6
  196. package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -1
  197. package/build/ts/subgraph/__tests__/subgraph.controller.test.js +2 -2
  198. package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -1
  199. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +2 -2
  200. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -1
  201. package/build/ts/subgraph/__tests__/subgraph.service.test.js +5 -5
  202. package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -1
  203. package/build/ts/subgraph/dto.d.ts +2 -2
  204. package/build/ts/subgraph/dto.d.ts.map +1 -1
  205. package/build/ts/subgraph/dto.js +3 -3
  206. package/build/ts/subgraph/dto.js.map +1 -1
  207. package/build/ts/subgraph/subgraph.service.d.ts +4 -0
  208. package/build/ts/subgraph/subgraph.service.d.ts.map +1 -1
  209. package/build/ts/subgraph/subgraph.service.js +23 -10
  210. package/build/ts/subgraph/subgraph.service.js.map +1 -1
  211. package/build/ts/subgraph/types.d.ts +2 -2
  212. package/build/ts/subgraph/types.d.ts.map +1 -1
  213. package/build/tsconfig.build.tsbuildinfo +1 -1
  214. package/package.json +44 -37
  215. package/build/tests/e2e.aa.test.d.ts +0 -2
  216. package/build/tests/e2e.aa.test.d.ts.map +0 -1
  217. package/build/tests/e2e.aa.test.js +0 -103
  218. package/build/tests/e2e.aa.test.js.map +0 -1
  219. package/build/ts/deployer/utils.d.ts +0 -8
  220. package/build/ts/deployer/utils.d.ts.map +0 -1
  221. package/build/ts/deployer/utils.js +0 -9
  222. package/build/ts/deployer/utils.js.map +0 -1
@@ -7,9 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
+ import { ESupportedChains, EMode } from "@maci-protocol/sdk";
10
11
  import { ApiProperty } from "@nestjs/swagger";
11
- import { IsBoolean, IsEnum, IsEthereumAddress, IsInt, IsOptional, IsString, Length, Max, Min } from "class-validator";
12
- import { ESupportedNetworks } from "../common";
12
+ import { IsEnum, IsEthereumAddress, IsInt, IsOptional, IsString, Max, Min } from "class-validator";
13
13
  /**
14
14
  * Data transfer object for generate proof
15
15
  */
@@ -23,17 +23,9 @@ export class GenerateProofDto {
23
23
  */
24
24
  maciContractAddress;
25
25
  /**
26
- * Tally contract address
26
+ * Voting mode
27
27
  */
28
- tallyContractAddress;
29
- /**
30
- * Whether to use Qv or NonQv
31
- */
32
- useQuadraticVoting;
33
- /**
34
- * Encrypted coordinator private key with RSA public key (see .env.example)
35
- */
36
- encryptedCoordinatorPrivateKey;
28
+ mode;
37
29
  /**
38
30
  * Start block for event processing
39
31
  */
@@ -46,6 +38,12 @@ export class GenerateProofDto {
46
38
  * Blocks per batch for event processing
47
39
  */
48
40
  blocksPerBatch;
41
+ sessionKeyAddress;
42
+ approval;
43
+ /**
44
+ * Chain Name
45
+ */
46
+ chain;
49
47
  }
50
48
  __decorate([
51
49
  ApiProperty({
@@ -67,31 +65,12 @@ __decorate([
67
65
  ], GenerateProofDto.prototype, "maciContractAddress", void 0);
68
66
  __decorate([
69
67
  ApiProperty({
70
- description: "Tally contract address",
71
- type: String,
72
- }),
73
- IsEthereumAddress(),
74
- __metadata("design:type", String)
75
- ], GenerateProofDto.prototype, "tallyContractAddress", void 0);
76
- __decorate([
77
- ApiProperty({
78
- description: "Whether to use quadratic voting or not",
79
- type: Boolean,
80
- }),
81
- IsBoolean(),
82
- __metadata("design:type", Boolean)
83
- ], GenerateProofDto.prototype, "useQuadraticVoting", void 0);
84
- __decorate([
85
- ApiProperty({
86
- description: "Encrypted coordinator private key with RSA public key (see README.md)",
87
- minimum: 1,
88
- maximum: 1024,
89
- type: String,
68
+ description: "Voting mode (qv: 0, non-qv: 1, full: 2)",
69
+ type: Number,
90
70
  }),
91
- IsString(),
92
- Length(1, 1024),
93
- __metadata("design:type", String)
94
- ], GenerateProofDto.prototype, "encryptedCoordinatorPrivateKey", void 0);
71
+ IsEnum(EMode),
72
+ __metadata("design:type", Number)
73
+ ], GenerateProofDto.prototype, "mode", void 0);
95
74
  __decorate([
96
75
  ApiProperty({
97
76
  description: "Start block for event parsing",
@@ -127,6 +106,34 @@ __decorate([
127
106
  IsOptional(),
128
107
  __metadata("design:type", Number)
129
108
  ], GenerateProofDto.prototype, "blocksPerBatch", void 0);
109
+ __decorate([
110
+ ApiProperty({
111
+ description: "Session key address",
112
+ type: String,
113
+ required: false,
114
+ }),
115
+ IsOptional(),
116
+ IsEthereumAddress(),
117
+ __metadata("design:type", String)
118
+ ], GenerateProofDto.prototype, "sessionKeyAddress", void 0);
119
+ __decorate([
120
+ ApiProperty({
121
+ description: "Approval",
122
+ type: String,
123
+ required: false,
124
+ }),
125
+ IsOptional(),
126
+ IsString(),
127
+ __metadata("design:type", String)
128
+ ], GenerateProofDto.prototype, "approval", void 0);
129
+ __decorate([
130
+ ApiProperty({
131
+ description: "Chain to which to deploy the contract(s)",
132
+ enum: ESupportedChains,
133
+ }),
134
+ IsEnum(ESupportedChains),
135
+ __metadata("design:type", String)
136
+ ], GenerateProofDto.prototype, "chain", void 0);
130
137
  /**
131
138
  * Data transfer object for merge trees
132
139
  */
@@ -165,7 +172,9 @@ __decorate([
165
172
  ApiProperty({
166
173
  description: "Session key address",
167
174
  type: String,
175
+ required: false,
168
176
  }),
177
+ IsOptional(),
169
178
  IsEthereumAddress(),
170
179
  __metadata("design:type", String)
171
180
  ], MergeTreesDto.prototype, "sessionKeyAddress", void 0);
@@ -173,16 +182,18 @@ __decorate([
173
182
  ApiProperty({
174
183
  description: "Approval",
175
184
  type: String,
185
+ required: false,
176
186
  }),
187
+ IsOptional(),
177
188
  IsString(),
178
189
  __metadata("design:type", String)
179
190
  ], MergeTreesDto.prototype, "approval", void 0);
180
191
  __decorate([
181
192
  ApiProperty({
182
193
  description: "Chain to which to deploy the contract(s)",
183
- enum: ESupportedNetworks,
194
+ enum: ESupportedChains,
184
195
  }),
185
- IsEnum(ESupportedNetworks),
196
+ IsEnum(ESupportedChains),
186
197
  __metadata("design:type", String)
187
198
  ], MergeTreesDto.prototype, "chain", void 0);
188
199
  /**
@@ -194,7 +205,6 @@ export class SubmitProofsDto {
194
205
  */
195
206
  pollId;
196
207
  maciContractAddress;
197
- tallyContractAddress;
198
208
  sessionKeyAddress;
199
209
  approval;
200
210
  /**
@@ -220,19 +230,13 @@ __decorate([
220
230
  IsEthereumAddress(),
221
231
  __metadata("design:type", String)
222
232
  ], SubmitProofsDto.prototype, "maciContractAddress", void 0);
223
- __decorate([
224
- ApiProperty({
225
- description: "Tally contract address",
226
- type: String,
227
- }),
228
- IsEthereumAddress(),
229
- __metadata("design:type", String)
230
- ], SubmitProofsDto.prototype, "tallyContractAddress", void 0);
231
233
  __decorate([
232
234
  ApiProperty({
233
235
  description: "Session key address",
234
236
  type: String,
237
+ required: false,
235
238
  }),
239
+ IsOptional(),
236
240
  IsEthereumAddress(),
237
241
  __metadata("design:type", String)
238
242
  ], SubmitProofsDto.prototype, "sessionKeyAddress", void 0);
@@ -240,16 +244,18 @@ __decorate([
240
244
  ApiProperty({
241
245
  description: "Approval",
242
246
  type: String,
247
+ required: false,
243
248
  }),
249
+ IsOptional(),
244
250
  IsString(),
245
251
  __metadata("design:type", String)
246
252
  ], SubmitProofsDto.prototype, "approval", void 0);
247
253
  __decorate([
248
254
  ApiProperty({
249
255
  description: "Chain to which to deploy the contract(s)",
250
- enum: ESupportedNetworks,
256
+ enum: ESupportedChains,
251
257
  }),
252
- IsEnum(ESupportedNetworks),
258
+ IsEnum(ESupportedChains),
253
259
  __metadata("design:type", String)
254
260
  ], SubmitProofsDto.prototype, "chain", void 0);
255
261
  //# sourceMappingURL=dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dto.js","sourceRoot":"","sources":["../../../ts/proof/dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAItH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IAQH,IAAI,CAAU;IAEd;;OAEG;IAMH,mBAAmB,CAAU;IAE7B;;OAEG;IAMH,oBAAoB,CAAU;IAE9B;;OAEG;IAMH,kBAAkB,CAA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OAEG;IAMH,KAAK,CAAoB;CAC1B;AApCC;IAPC,WAAW,CAAC;QACX,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,MAAM;KACb,CAAC;IACD,KAAK,EAAE;IACP,GAAG,CAAC,CAAC,CAAC;;+CACS;AAOhB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,MAAM;KACb,CAAC;IACD,iBAAiB,EAAE;;4DACM;AAS1B;IAPC,WAAW,CAAC;QACX,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,UAAU,EAAE;IACZ,iBAAiB,EAAE;;0DACI;AASxB;IAPC,WAAW,CAAC;QACX,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,UAAU,EAAE;IACZ,QAAQ,EAAE;;iDACO;AAUlB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,0CAA0C;QACvD,IAAI,EAAE,gBAAgB;KACvB,CAAC;IACD,MAAM,CAAC,gBAAgB,CAAC;;8CACA"}
@@ -1,6 +1,7 @@
1
1
  import type { IGenerateData, IMergeArgs } from "./types";
2
- import type { IGetPublicKeyData } from "../file/types";
2
+ import type { ITallyData } from "@maci-protocol/sdk";
3
3
  import { FileService } from "../file/file.service";
4
+ import { IGetPublicKeyData } from "../file/types";
4
5
  import { GenerateProofDto, SubmitProofsDto } from "./dto";
5
6
  import { ProofGeneratorService } from "./proof.service";
6
7
  export declare class ProofController {
@@ -35,7 +36,7 @@ export declare class ProofController {
35
36
  * Submit proofs on-chain api method
36
37
  * @param args - submit proofs on-chain args
37
38
  */
38
- submit(args: SubmitProofsDto): Promise<boolean>;
39
+ submit(args: SubmitProofsDto): Promise<ITallyData>;
39
40
  /**
40
41
  * Get RSA public key for authorization setup
41
42
  *
@@ -1 +1 @@
1
- {"version":3,"file":"proof.controller.d.ts","sourceRoot":"","sources":["../../../ts/proof/proof.controller.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAiB,eAAe,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,qBAIa,eAAe;IAaxB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAb9B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE3D;;;;;OAKG;gBAEgB,qBAAqB,EAAE,qBAAqB,EAC5C,WAAW,EAAE,WAAW;IAG3C;;;;;OAKG;IAMG,QAAQ,CAAS,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAOtE;;;;;OAKG;IAMG,KAAK,CAAS,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAOvD;;;OAGG;IAMG,MAAM,CAAS,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAO7D;;;;OAIG;IAKG,YAAY,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAMjD"}
1
+ {"version":3,"file":"proof.controller.d.ts","sourceRoot":"","sources":["../../../ts/proof/proof.controller.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAiB,eAAe,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,qBAGa,eAAe;IAaxB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAb9B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE3D;;;;;OAKG;gBAEgB,qBAAqB,EAAE,qBAAqB,EAC5C,WAAW,EAAE,WAAW;IAG3C;;;;;OAKG;IAMG,QAAQ,CAAS,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAOtE;;;;;OAKG;IAMG,KAAK,CAAS,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAOvD;;;OAGG;IAMG,MAAM,CAAS,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAOhE;;;;OAIG;IAIG,YAAY,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAMjD"}
@@ -12,9 +12,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  };
13
13
  var ProofController_1;
14
14
  /* eslint-disable @typescript-eslint/no-shadow */
15
- import { Body, Controller, Get, HttpException, HttpStatus, Logger, Post, UseGuards } from "@nestjs/common";
15
+ import { Body, Controller, Get, HttpException, HttpStatus, Logger, Post } from "@nestjs/common";
16
16
  import { ApiBearerAuth, ApiBody, ApiResponse, ApiTags } from "@nestjs/swagger";
17
- import { AccountSignatureGuard, Public } from "../auth/AccountSignatureGuard.service";
18
17
  import { FileService } from "../file/file.service";
19
18
  import { GenerateProofDto, MergeTreesDto, SubmitProofsDto } from "./dto";
20
19
  import { ProofGeneratorService } from "./proof.service";
@@ -117,7 +116,6 @@ __decorate([
117
116
  __decorate([
118
117
  ApiResponse({ status: HttpStatus.OK, description: "Public key was successfully returned" }),
119
118
  ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "BadRequest" }),
120
- Public(),
121
119
  Get("publicKey"),
122
120
  __metadata("design:type", Function),
123
121
  __metadata("design:paramtypes", []),
@@ -127,7 +125,6 @@ ProofController = ProofController_1 = __decorate([
127
125
  ApiTags("v1/proof"),
128
126
  ApiBearerAuth(),
129
127
  Controller("v1/proof"),
130
- UseGuards(AccountSignatureGuard),
131
128
  __metadata("design:paramtypes", [ProofGeneratorService,
132
129
  FileService])
133
130
  ], ProofController);
@@ -1 +1 @@
1
- {"version":3,"file":"proof.controller.js","sourceRoot":"","sources":["../../../ts/proof/proof.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iDAAiD;AACjD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAK/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAMjD,IAAM,eAAe,uBAArB,MAAM,eAAe;IAaP;IACA;IAbnB;;OAEG;IACc,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAE3D;;;;;OAKG;IACH,YACmB,qBAA4C,EAC5C,WAAwB;QADxB,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAEJ;;;;;OAKG;IAMG,AAAN,KAAK,CAAC,QAAQ,CAAS,IAAsB;QAC3C,OAAO,IAAI,CAAC,qBAAqB,CAAC,QA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AE,UAAU,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IACvE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;IAC1E,IAAI,CAAC,QAAQ,CAAC;IACD,WAAA,IAAI,EAAE,CAAA;;qCAAO,eAAe;;6CAKzC;AAUK;IAHL,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;IAC3F,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;IAC1E,GAAG,CAAC,WAAW,CAAC;;;;mDAMhB;AAlFU,eAAe;IAH3B,OAAO,CAAC,UAAU,CAAC;IACnB,aAAa,EAAE;IACf,UAAU,CAAC,UAAU,CAAC;qCAcqB,qBAAqB;QAC/B,WAAW;GAdhC,eAAe,CAmF3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"proof.module.d.ts","sourceRoot":"","sources":["../../../ts/proof/proof.module.ts"],"names":[],"mappings":"AAUA,qBAKa,WAAW;CAAG"}
1
+ {"version":3,"file":"proof.module.d.ts","sourceRoot":"","sources":["../../../ts/proof/proof.module.ts"],"names":[],"mappings":"AAUA,qBAMa,WAAW;CAAG"}
@@ -18,6 +18,7 @@ ProofModule = __decorate([
18
18
  imports: [FileModule, CryptoModule, SessionKeysModule],
19
19
  controllers: [ProofController],
20
20
  providers: [ProofGeneratorService, ProofGateway],
21
+ exports: [ProofGeneratorService],
21
22
  })
22
23
  ], ProofModule);
23
24
  export { ProofModule };
@@ -1 +1 @@
1
- {"version":3,"file":"proof.module.js","sourceRoot":"","sources":["../../../ts/proof/proof.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OA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AC;GACW,WAAW,CAAG"}
@@ -1,14 +1,12 @@
1
1
  import { type IGenerateProofsOptions } from "@maci-protocol/sdk";
2
- import { IProof } from "@maci-protocol/sdk";
2
+ import { IProof, ITallyData } from "@maci-protocol/sdk";
3
3
  import type { IGenerateArgs, IGenerateData, IMergeArgs, ISubmitProofsArgs } from "./types";
4
- import { CryptoService } from "../crypto/crypto.service";
5
4
  import { FileService } from "../file/file.service";
6
5
  import { SessionKeysService } from "../sessionKeys/sessionKeys.service";
7
6
  /**
8
7
  * ProofGeneratorService is responsible for generating message processing and tally proofs.
9
8
  */
10
9
  export declare class ProofGeneratorService {
11
- private readonly cryptoService;
12
10
  private readonly fileService;
13
11
  private readonly sessionKeysService;
14
12
  /**
@@ -22,7 +20,7 @@ export declare class ProofGeneratorService {
22
20
  /**
23
21
  * Proof generator initialization
24
22
  */
25
- constructor(cryptoService: CryptoService, fileService: FileService, sessionKeysService: SessionKeysService);
23
+ constructor(fileService: FileService, sessionKeysService: SessionKeysService);
26
24
  /**
27
25
  * Read and parse proofs
28
26
  * @param folder - folder path to read proofs from
@@ -36,7 +34,7 @@ export declare class ProofGeneratorService {
36
34
  * @param args - generate proofs arguments
37
35
  * @returns - generated proofs for message processing and tally
38
36
  */
39
- generate({ poll, maciContractAddress, tallyContractAddress, useQuadraticVoting, encryptedCoordinatorPrivateKey, startBlock, endBlock, blocksPerBatch, }: IGenerateArgs, options?: IGenerateProofsOptions): Promise<IGenerateData>;
37
+ generate({ approval, sessionKeyAddress, chain, poll, maciContractAddress, mode, startBlock, endBlock, blocksPerBatch, useWasm, }: IGenerateArgs, options?: IGenerateProofsOptions): Promise<IGenerateData>;
40
38
  /**
41
39
  * Merge state and message trees
42
40
  *
@@ -49,6 +47,6 @@ export declare class ProofGeneratorService {
49
47
  *
50
48
  * @param args - submit proofs on-chain arguments
51
49
  */
52
- submit({ maciContractAddress, pollId, chain }: ISubmitProofsArgs): Promise<boolean>;
50
+ submit({ maciContractAddress, pollId, sessionKeyAddress, approval, chain, }: ISubmitProofsArgs): Promise<ITallyData>;
53
51
  }
54
52
  //# sourceMappingURL=proof.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proof.service.d.ts","sourceRoot":"","sources":["../../../ts/proof/proof.service.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,sBAAsB,EAU5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAc,MAAM,oBAAoB,CAAC;AASxD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAI3F,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE;;GAEG;AACH,qBACa,qBAAqB;IAe9B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAhBrC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;OAEG;gBAEgB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,kBAAkB;IAOzD;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAY9E;;;;;OAKG;IACG,QAAQ,CACZ,EACE,IAAI,EACJ,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,8BAA8B,EAC9B,UAAU,EACV,QAAQ,EACR,cAAc,GACf,EAAE,aAAa,EAChB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,aAAa,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,EACV,QAAQ,EACR,cAAc,EACd,OAAO,GACR,EAAE,aAAa,EAChB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,aAAa,CAAC;IAuEzB;;;;;OAKG;IACG,KAAK,CAAC,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAY9G;;;;OAIG;IACG,MAAM,CAAC,EACX,mBAAmB,EACnB,MAAM,EACN,iBAAiB,EACjB,QAAQ,EACR,KAAK,GACN,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;CAiB3C"}
@@ -8,23 +8,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  var ProofGeneratorService_1;
11
- import { Keypair, PrivKey, PubKey } from "@maci-protocol/domainobjs";
12
- import { Deployment, EContracts, ProofGenerator, Poll__factory as PollFactory, MACI__factory as MACIFactory, Prover, getPoll, mergeSignups, } from "@maci-protocol/sdk";
11
+ import { PublicKey } from "@maci-protocol/domainobjs";
12
+ import { Deployment, EContracts, getPoll, mergeSignups, EMode, } from "@maci-protocol/sdk";
13
+ import { generateProofs, proveOnChain } from "@maci-protocol/sdk";
13
14
  import { Logger, Injectable } from "@nestjs/common";
14
- import { ZeroAddress } from "ethers";
15
15
  import hre from "hardhat";
16
16
  import fs from "fs";
17
17
  import path from "path";
18
18
  import { ErrorCodes } from "../common";
19
- import { getPublicClient } from "../common/accountAbstraction";
20
- import { CryptoService } from "../crypto/crypto.service";
19
+ import { getCoordinatorKeypair } from "../common/coordinatorKeypair";
21
20
  import { FileService } from "../file/file.service";
22
21
  import { SessionKeysService } from "../sessionKeys/sessionKeys.service";
23
22
  /**
24
23
  * ProofGeneratorService is responsible for generating message processing and tally proofs.
25
24
  */
26
25
  let ProofGeneratorService = ProofGeneratorService_1 = class ProofGeneratorService {
27
- cryptoService;
28
26
  fileService;
29
27
  sessionKeysService;
30
28
  /**
@@ -38,8 +36,7 @@ let ProofGeneratorService = ProofGeneratorService_1 = class ProofGeneratorServic
38
36
  /**
39
37
  * Proof generator initialization
40
38
  */
41
- constructor(cryptoService, fileService, sessionKeysService) {
42
- this.cryptoService = cryptoService;
39
+ constructor(fileService, sessionKeysService) {
43
40
  this.fileService = fileService;
44
41
  this.sessionKeysService = sessionKeysService;
45
42
  this.deployment = Deployment.getInstance({ hre });
@@ -65,13 +62,9 @@ let ProofGeneratorService = ProofGeneratorService_1 = class ProofGeneratorServic
65
62
  * @param args - generate proofs arguments
66
63
  * @returns - generated proofs for message processing and tally
67
64
  */
68
- async generate({ poll, maciContractAddress, tallyContractAddress, useQuadraticVoting, encryptedCoordinatorPrivateKey, startBlock, endBlock, blocksPerBatch, }, options) {
65
+ async generate({ approval, sessionKeyAddress, chain, poll, maciContractAddress, mode, startBlock, endBlock, blocksPerBatch, useWasm, }, options) {
69
66
  try {
70
- const maciContract = await this.deployment.getContract({
71
- name: EContracts.MACI,
72
- address: maciContractAddress,
73
- });
74
- const signer = await this.deployment.getDeployer();
67
+ const signer = await this.sessionKeysService.getCoordinatorSigner(chain, sessionKeyAddress, approval);
75
68
  const pollData = await getPoll({
76
69
  maciAddress: maciContractAddress,
77
70
  pollId: poll,
@@ -81,58 +74,41 @@ let ProofGeneratorService = ProofGeneratorService_1 = class ProofGeneratorServic
81
74
  name: EContracts.Poll,
82
75
  address: pollData.address,
83
76
  });
84
- const [coordinatorPublicKey, isStateAqMerged] = await Promise.all([
85
- pollContract.coordinatorPubKey(),
86
- pollContract.stateMerged(),
87
- ]);
88
- if (!isStateAqMerged) {
89
- this.logger.error(`Error: ${ErrorCodes.NOT_MERGED_STATE_TREE}, state tree is not merged`);
90
- throw new Error(ErrorCodes.NOT_MERGED_STATE_TREE.toString());
91
- }
92
- const { privateKey } = await this.fileService.getPrivateKey();
93
- const maciPrivateKey = PrivKey.deserialize(this.cryptoService.decrypt(privateKey, encryptedCoordinatorPrivateKey));
94
- const coordinatorKeypair = new Keypair(maciPrivateKey);
95
- const publicKey = new PubKey([
96
- BigInt(coordinatorPublicKey.x.toString()),
97
- BigInt(coordinatorPublicKey.y.toString()),
77
+ const publicKeyOnChain = await pollContract.coordinatorPublicKey();
78
+ const coordinatorPublicKeyOnChain = new PublicKey([
79
+ BigInt(publicKeyOnChain.x.toString()),
80
+ BigInt(publicKeyOnChain.y.toString()),
98
81
  ]);
99
- if (!coordinatorKeypair.pubKey.equals(publicKey)) {
82
+ const coordinatorKeypair = getCoordinatorKeypair();
83
+ if (!coordinatorKeypair.publicKey.equals(coordinatorPublicKeyOnChain)) {
100
84
  this.logger.error(`Error: ${ErrorCodes.PRIVATE_KEY_MISMATCH}, wrong private key`);
101
85
  throw new Error(ErrorCodes.PRIVATE_KEY_MISMATCH.toString());
102
86
  }
103
- const outputDir = path.resolve("./proofs");
104
- const maciState = await ProofGenerator.prepareState({
105
- maciContract,
106
- pollContract,
107
- maciPrivateKey,
108
- coordinatorKeypair,
109
- pollId: poll,
87
+ // There are only QV and Non-QV modes available for tally circuit
88
+ const tally = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_TALLY_ZKEY_NAME,
89
+ // if FULL use NON_QV because there are only VoteTallyQV and VoteTallyNonQV zkeys
90
+ mode === EMode.FULL ? EMode.NON_QV : mode);
91
+ const messageProcessor = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, mode);
92
+ const { processProofs, tallyProofs, tallyData } = await generateProofs({
93
+ outputDir: path.resolve("./proofs"),
94
+ coordinatorPrivateKey: coordinatorKeypair.privateKey.serialize(),
110
95
  signer,
111
- outputDir,
112
- options: {
113
- startBlock,
114
- endBlock,
115
- blocksPerBatch,
116
- },
117
- });
118
- const foundPoll = maciState.polls.get(BigInt(poll));
119
- if (!foundPoll) {
120
- this.logger.error(`Error: ${ErrorCodes.POLL_NOT_FOUND}, Poll ${poll} not found in maci state`);
121
- throw new Error(ErrorCodes.POLL_NOT_FOUND.toString());
122
- }
123
- const proofGenerator = new ProofGenerator({
124
- poll: foundPoll,
125
- maciContractAddress,
126
- tallyContractAddress,
127
- tally: this.fileService.getZkeyFilePaths(process.env.COORDINATOR_TALLY_ZKEY_NAME, useQuadraticVoting),
128
- mp: this.fileService.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, useQuadraticVoting),
96
+ maciAddress: maciContractAddress,
97
+ pollId: BigInt(poll),
98
+ startBlock,
99
+ endBlock,
100
+ blocksPerBatch,
101
+ useWasm,
129
102
  rapidsnark: process.env.COORDINATOR_RAPIDSNARK_EXE,
130
- outputDir,
131
- tallyOutputFile: path.resolve("./tally.json"),
132
- useQuadraticVoting,
103
+ mode,
104
+ voteTallyZkey: tally.zkey,
105
+ voteTallyWitnessGenerator: tally.witnessGenerator,
106
+ voteTallyWasm: tally.wasm,
107
+ messageProcessorZkey: messageProcessor.zkey,
108
+ messageProcessorWitnessGenerator: messageProcessor.witnessGenerator,
109
+ messageProcessorWasm: messageProcessor.wasm,
110
+ tallyFile: path.resolve("./tally.json"),
133
111
  });
134
- const processProofs = await proofGenerator.generateMpProofs(options);
135
- const { proofs: tallyProofs, tallyData } = await proofGenerator.generateTallyProofs(hre.network.name, String(hre.network.config.chainId || 1), options);
136
112
  return {
137
113
  processProofs,
138
114
  tallyProofs,
@@ -151,9 +127,7 @@ let ProofGeneratorService = ProofGeneratorService_1 = class ProofGeneratorServic
151
127
  * @returns whether the proofs were successfully merged
152
128
  */
153
129
  async merge({ maciContractAddress, pollId, approval, sessionKeyAddress, chain }) {
154
- // get a kernel client
155
- const kernelClient = await this.sessionKeysService.generateClientFromSessionKey(sessionKeyAddress, approval, chain);
156
- const signer = await this.sessionKeysService.getKernelClientSigner(kernelClient);
130
+ const signer = await this.sessionKeysService.getCoordinatorSigner(chain, sessionKeyAddress, approval);
157
131
  await mergeSignups({
158
132
  maciAddress: maciContractAddress,
159
133
  pollId: BigInt(pollId),
@@ -166,80 +140,24 @@ let ProofGeneratorService = ProofGeneratorService_1 = class ProofGeneratorServic
166
140
  *
167
141
  * @param args - submit proofs on-chain arguments
168
142
  */
169
- async submit({ maciContractAddress, pollId, chain }) {
170
- const publicClient = getPublicClient(chain);
171
- // get the poll address
172
- const pollContracts = await publicClient.readContract({
173
- address: maciContractAddress,
174
- abi: MACIFactory.abi,
175
- functionName: "getPoll",
176
- args: [BigInt(pollId)],
177
- });
178
- const pollAddress = pollContracts.poll;
179
- if (pollAddress.toLowerCase() === ZeroAddress.toLowerCase()) {
180
- this.logger.error(`Error: ${ErrorCodes.POLL_NOT_FOUND}, Poll ${pollId} not found`);
181
- throw new Error(ErrorCodes.POLL_NOT_FOUND.toString());
182
- }
183
- // check if state tree has been merged
184
- const isStateMerged = await publicClient.readContract({
185
- address: pollAddress,
186
- abi: PollFactory.abi,
187
- functionName: "stateMerged",
143
+ async submit({ maciContractAddress, pollId, sessionKeyAddress, approval, chain, }) {
144
+ const signer = await this.sessionKeysService.getCoordinatorSigner(chain, sessionKeyAddress, approval);
145
+ const tallyData = await proveOnChain({
146
+ pollId: BigInt(pollId),
147
+ maciAddress: maciContractAddress,
148
+ proofDir: "./proofs",
149
+ tallyFile: "./tally.json",
150
+ signer,
188
151
  });
189
- if (!isStateMerged) {
190
- this.logger.error(`Error: ${ErrorCodes.NOT_MERGED_STATE_TREE}, state tree is not merged`);
191
- throw new Error(ErrorCodes.NOT_MERGED_STATE_TREE.toString());
152
+ if (!tallyData) {
153
+ throw new Error("Tally data is undefined");
192
154
  }
193
- const [maciContract, mpContract, pollContract, tallyContract, vkRegistryContract, verifierContract] = await Promise.all([
194
- this.deployment.getContract({
195
- name: EContracts.MACI,
196
- address: maciContractAddress,
197
- }),
198
- this.deployment.getContract({
199
- name: EContracts.MessageProcessor,
200
- address: pollContracts.messageProcessor,
201
- }),
202
- this.deployment.getContract({
203
- name: EContracts.Poll,
204
- address: pollContracts.poll,
205
- }),
206
- this.deployment.getContract({
207
- name: EContracts.Tally,
208
- address: pollContracts.tally,
209
- }),
210
- this.deployment.getContract({ name: EContracts.VkRegistry }),
211
- this.deployment.getContract({ name: EContracts.Verifier }),
212
- ]);
213
- const prover = new Prover({
214
- maciContract,
215
- mpContract,
216
- pollContract,
217
- tallyContract,
218
- vkRegistryContract,
219
- verifierContract,
220
- });
221
- const data = {
222
- processProofs: await this.readProofs(path.resolve("./proofs"), "process"),
223
- tallyProofs: await this.readProofs(path.resolve("./proofs"), "tally"),
224
- };
225
- // prove message processing
226
- await prover.proveMessageProcessing(data.processProofs);
227
- // read tally data
228
- const tallyData = await fs.promises
229
- .readFile("./tally.json", "utf8")
230
- .then((result) => JSON.parse(result));
231
- // prove tally
232
- await prover.proveTally(data.tallyProofs);
233
- // submit results
234
- const voteOptions = Number(await pollContract.voteOptions());
235
- await prover.submitResults(tallyData, voteOptions);
236
- return true;
155
+ return tallyData;
237
156
  }
238
157
  };
239
158
  ProofGeneratorService = ProofGeneratorService_1 = __decorate([
240
159
  Injectable(),
241
- __metadata("design:paramtypes", [CryptoService,
242
- FileService,
160
+ __metadata("design:paramtypes", [FileService,
243
161
  SessionKeysService])
244
162
  ], ProofGeneratorService);
245
163
  export { ProofGeneratorService };