@maci-protocol/testing 0.0.0-ci.f433bba → 0.0.0-ci.f446b8f

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 (59) hide show
  1. package/LICENSE +1 -2
  2. package/build/ts/__tests__/e2e.full.test.d.ts +2 -0
  3. package/build/ts/__tests__/e2e.full.test.d.ts.map +1 -0
  4. package/build/ts/__tests__/e2e.full.test.js +839 -0
  5. package/build/ts/__tests__/e2e.full.test.js.map +1 -0
  6. package/build/ts/__tests__/e2e.nonQv.test.js +438 -41
  7. package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
  8. package/build/ts/__tests__/e2e.test.js +297 -289
  9. package/build/ts/__tests__/e2e.test.js.map +1 -1
  10. package/build/ts/__tests__/integration.test.js +69 -72
  11. package/build/ts/__tests__/integration.test.js.map +1 -1
  12. package/build/ts/__tests__/keyChange.test.js +85 -83
  13. package/build/ts/__tests__/keyChange.test.js.map +1 -1
  14. package/build/ts/__tests__/maciKeys.test.d.ts +2 -0
  15. package/build/ts/__tests__/maciKeys.test.d.ts.map +1 -0
  16. package/build/ts/__tests__/maciKeys.test.js +78 -0
  17. package/build/ts/__tests__/maciKeys.test.js.map +1 -0
  18. package/build/ts/__tests__/stress/stress.full.test.d.ts +2 -0
  19. package/build/ts/__tests__/stress/stress.full.test.d.ts.map +1 -0
  20. package/build/ts/__tests__/stress/stress.full.test.js +186 -0
  21. package/build/ts/__tests__/stress/stress.full.test.js.map +1 -0
  22. package/build/ts/__tests__/unit/joinPoll.test.js +67 -32
  23. package/build/ts/__tests__/unit/joinPoll.test.js.map +1 -1
  24. package/build/ts/__tests__/unit/poll.test.js +9 -11
  25. package/build/ts/__tests__/unit/poll.test.js.map +1 -1
  26. package/build/ts/__tests__/unit/publish.test.js +12 -14
  27. package/build/ts/__tests__/unit/publish.test.js.map +1 -1
  28. package/build/ts/__tests__/unit/setVerifyingKeys.test.d.ts +2 -0
  29. package/build/ts/__tests__/unit/setVerifyingKeys.test.d.ts.map +1 -0
  30. package/build/ts/__tests__/unit/setVerifyingKeys.test.js +52 -0
  31. package/build/ts/__tests__/unit/setVerifyingKeys.test.js.map +1 -0
  32. package/build/ts/__tests__/unit/signup.test.js +11 -9
  33. package/build/ts/__tests__/unit/signup.test.js.map +1 -1
  34. package/build/ts/__tests__/unit/utils.test.js +12 -12
  35. package/build/ts/__tests__/unit/utils.test.js.map +1 -1
  36. package/build/ts/constants.d.ts +54 -55
  37. package/build/ts/constants.d.ts.map +1 -1
  38. package/build/ts/constants.js +116 -74
  39. package/build/ts/constants.js.map +1 -1
  40. package/build/ts/testingClass.d.ts +7 -7
  41. package/build/ts/testingClass.d.ts.map +1 -1
  42. package/build/ts/testingClass.js +40 -37
  43. package/build/ts/testingClass.js.map +1 -1
  44. package/build/ts/types.d.ts +10 -11
  45. package/build/ts/types.d.ts.map +1 -1
  46. package/build/ts/user.d.ts +5 -9
  47. package/build/ts/user.d.ts.map +1 -1
  48. package/build/ts/user.js +5 -6
  49. package/build/ts/user.js.map +1 -1
  50. package/build/ts/utils.d.ts +3 -3
  51. package/build/ts/utils.d.ts.map +1 -1
  52. package/build/ts/utils.js +12 -12
  53. package/build/ts/utils.js.map +1 -1
  54. package/build/tsconfig.tsbuildinfo +1 -1
  55. package/package.json +19 -18
  56. package/build/ts/__tests__/maci-keys.test.d.ts +0 -2
  57. package/build/ts/__tests__/maci-keys.test.d.ts.map +0 -1
  58. package/build/ts/__tests__/maci-keys.test.js +0 -78
  59. package/build/ts/__tests__/maci-keys.test.js.map +0 -1
@@ -27,38 +27,31 @@ describe("e2e tests", function test() {
27
27
  const useWasm = (0, sdk_1.isArm)();
28
28
  this.timeout(900000);
29
29
  let maciAddresses;
30
- let vkRegistryAddress;
31
30
  let initialVoiceCreditProxyContractAddress;
32
- let verifierContractAddress;
33
31
  let signer;
34
32
  const generateProofsArgs = {
35
33
  outputDir: constants_1.testProofsDirPath,
36
34
  tallyFile: constants_1.testTallyFilePath,
37
- tallyZkey: constants_1.tallyVotesTestZkeyPath,
38
- processZkey: constants_1.processMessageTestZkeyPath,
35
+ voteTallyZkey: constants_1.testTallyVotesZkeyPath,
36
+ messageProcessorZkey: constants_1.testProcessMessageZkeyPath,
39
37
  pollId: 0n,
40
38
  rapidsnark: constants_1.testRapidsnarkPath,
41
- processWitgen: constants_1.testProcessMessagesWitnessPath,
42
- processDatFile: constants_1.testProcessMessagesWitnessDatPath,
43
- tallyWitgen: constants_1.testTallyVotesWitnessPath,
44
- tallyDatFile: constants_1.testTallyVotesWitnessDatPath,
45
- coordinatorPrivateKey: constants_1.coordinatorPrivKey,
46
- processWasm: constants_1.testProcessMessagesWasmPath,
47
- tallyWasm: constants_1.testTallyVotesWasmPath,
39
+ messageProcessorWitnessGenerator: constants_1.testProcessMessagesWitnessPath,
40
+ messageProcessorWitnessDatFile: constants_1.testProcessMessagesWitnessDatPath,
41
+ voteTallyWitnessGenerator: constants_1.testTallyVotesWitnessPath,
42
+ voteTallyWitnessDatFile: constants_1.testTallyVotesWitnessDatPath,
43
+ coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
44
+ messageProcessorWasm: constants_1.testProcessMessagesWasmPath,
45
+ voteTallyWasm: constants_1.testTallyVotesWasmPath,
48
46
  useWasm,
49
- useQuadraticVoting: true,
47
+ mode: core_1.EMode.QV,
50
48
  };
51
- // before all tests we deploy the vk registry contract and set the verifying keys
49
+ // before all tests we deploy the verifying keys registry contract and set the verifying keys
52
50
  before(async () => {
53
51
  signer = await (0, sdk_1.getDefaultSigner)();
54
- // we deploy the vk registry contract
55
- vkRegistryAddress = await (0, sdk_1.deployVkRegistryContract)({ signer });
56
- const [initialVoiceCreditProxy] = await (0, sdk_1.deployConstantInitialVoiceCreditProxy)({ amount: constants_1.DEFAULT_INITIAL_VOICE_CREDITS }, signer, undefined, true);
52
+ const constantInitialVoiceCreditProxyFactory = await (0, sdk_1.deployConstantInitialVoiceCreditProxyFactory)(signer, true);
53
+ const initialVoiceCreditProxy = await (0, sdk_1.deployConstantInitialVoiceCreditProxy)({ amount: constants_1.DEFAULT_INITIAL_VOICE_CREDITS }, constantInitialVoiceCreditProxyFactory, signer);
57
54
  initialVoiceCreditProxyContractAddress = await initialVoiceCreditProxy.getAddress();
58
- const verifier = await (0, sdk_1.deployVerifier)(signer, true);
59
- verifierContractAddress = await verifier.getAddress();
60
- // we set the verifying keys
61
- await (0, sdk_1.setVerifyingKeys)({ ...(await (0, constants_1.verifyingKeysArgs)(signer)), vkRegistryAddress });
62
55
  });
63
56
  describe("2 signups (1 after stateAq is merged and logs are fetched), 1 message", () => {
64
57
  after(async () => {
@@ -76,6 +69,12 @@ describe("e2e tests", function test() {
76
69
  signer,
77
70
  signupPolicyAddress: signupPolicyContractAddress,
78
71
  });
72
+ // we set the verifying keys
73
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
74
+ await (0, sdk_1.setVerifyingKeys)({
75
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
76
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
77
+ });
79
78
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
80
79
  // deploy a poll contract
81
80
  await (0, sdk_1.deployPoll)({
@@ -85,8 +84,6 @@ describe("e2e tests", function test() {
85
84
  pollEndTimestamp: startDate + constants_1.pollDuration,
86
85
  relayers: [await signer.getAddress()],
87
86
  maciAddress: maciAddresses.maciContractAddress,
88
- verifierContractAddress,
89
- vkRegistryContractAddress: vkRegistryAddress,
90
87
  policyContractAddress: pollPolicyContractAddress,
91
88
  initialVoiceCreditProxyContractAddress,
92
89
  });
@@ -94,7 +91,7 @@ describe("e2e tests", function test() {
94
91
  it("should signup one user", async () => {
95
92
  await (0, sdk_1.signup)({
96
93
  maciAddress: maciAddresses.maciContractAddress,
97
- maciPubKey: user.pubKey.serialize(),
94
+ maciPublicKey: user.publicKey.serialize(),
98
95
  sgData: constants_1.DEFAULT_SG_DATA,
99
96
  signer,
100
97
  });
@@ -102,13 +99,12 @@ describe("e2e tests", function test() {
102
99
  it("should join one user", async () => {
103
100
  await (0, sdk_1.joinPoll)({
104
101
  maciAddress: maciAddresses.maciContractAddress,
105
- privateKey: user.privKey.serialize(),
106
- stateIndex: 1n,
102
+ privateKey: user.privateKey.serialize(),
107
103
  pollId: 0n,
108
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
109
- useWasm: true,
104
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
105
+ useWasm,
110
106
  pollWasm: constants_1.testPollJoiningWasmPath,
111
- pollWitgen: constants_1.testPollJoiningWitnessPath,
107
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
112
108
  rapidsnark: constants_1.testRapidsnarkPath,
113
109
  sgDataArg: constants_1.DEFAULT_SG_DATA,
114
110
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -117,15 +113,15 @@ describe("e2e tests", function test() {
117
113
  });
118
114
  it("should publish one message", async () => {
119
115
  await (0, sdk_1.publish)({
120
- pubkey: user.pubKey.serialize(),
116
+ publicKey: user.publicKey.serialize(),
121
117
  stateIndex: 1n,
122
118
  voteOptionIndex: 0n,
123
119
  nonce: 1n,
124
120
  pollId: 0n,
125
121
  newVoteWeight: 9n,
126
122
  maciAddress: maciAddresses.maciContractAddress,
127
- salt: (0, crypto_1.genRandomSalt)(),
128
- privateKey: user.privKey.serialize(),
123
+ salt: (0, crypto_1.generateRandomSalt)(),
124
+ privateKey: user.privateKey.serialize(),
129
125
  signer,
130
126
  });
131
127
  });
@@ -139,7 +135,7 @@ describe("e2e tests", function test() {
139
135
  });
140
136
  await (0, sdk_1.signup)({
141
137
  maciAddress: maciAddresses.maciContractAddress,
142
- maciPubKey: new domainobjs_1.Keypair().pubKey.serialize(),
138
+ maciPublicKey: new domainobjs_1.Keypair().publicKey.serialize(),
143
139
  sgData: constants_1.DEFAULT_SG_DATA,
144
140
  signer,
145
141
  });
@@ -167,6 +163,12 @@ describe("e2e tests", function test() {
167
163
  signer,
168
164
  signupPolicyAddress: signupPolicyContractAddress,
169
165
  });
166
+ // we set the verifying keys
167
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
168
+ await (0, sdk_1.setVerifyingKeys)({
169
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
170
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
171
+ });
170
172
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
171
173
  // deploy a poll contract
172
174
  await (0, sdk_1.deployPoll)({
@@ -176,8 +178,6 @@ describe("e2e tests", function test() {
176
178
  pollEndTimestamp: startDate + constants_1.pollDuration,
177
179
  relayers: [await signer.getAddress()],
178
180
  maciAddress: maciAddresses.maciContractAddress,
179
- verifierContractAddress,
180
- vkRegistryContractAddress: vkRegistryAddress,
181
181
  policyContractAddress: pollPolicyContractAddress,
182
182
  initialVoiceCreditProxyContractAddress,
183
183
  });
@@ -188,7 +188,7 @@ describe("e2e tests", function test() {
188
188
  // eslint-disable-next-line no-await-in-loop
189
189
  await (0, sdk_1.signup)({
190
190
  maciAddress: maciAddresses.maciContractAddress,
191
- maciPubKey: users[i].pubKey.serialize(),
191
+ maciPublicKey: users[i].publicKey.serialize(),
192
192
  sgData: constants_1.DEFAULT_SG_DATA,
193
193
  signer,
194
194
  });
@@ -200,13 +200,12 @@ describe("e2e tests", function test() {
200
200
  // eslint-disable-next-line no-await-in-loop
201
201
  await (0, sdk_1.joinPoll)({
202
202
  maciAddress: maciAddresses.maciContractAddress,
203
- privateKey: users[i].privKey.serialize(),
204
- stateIndex: BigInt(i + 1),
203
+ privateKey: users[i].privateKey.serialize(),
205
204
  pollId: 0n,
206
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
207
- useWasm: true,
205
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
206
+ useWasm,
208
207
  pollWasm: constants_1.testPollJoiningWasmPath,
209
- pollWitgen: constants_1.testPollJoiningWitnessPath,
208
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
210
209
  rapidsnark: constants_1.testRapidsnarkPath,
211
210
  sgDataArg: constants_1.DEFAULT_SG_DATA,
212
211
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -216,99 +215,99 @@ describe("e2e tests", function test() {
216
215
  });
217
216
  it("should publish eight messages", async () => {
218
217
  await (0, sdk_1.publish)({
219
- pubkey: users[0].pubKey.serialize(),
218
+ publicKey: users[0].publicKey.serialize(),
220
219
  stateIndex: 1n,
221
220
  voteOptionIndex: 0n,
222
221
  nonce: 2n,
223
222
  pollId: 0n,
224
223
  newVoteWeight: 4n,
225
224
  maciAddress: maciAddresses.maciContractAddress,
226
- salt: (0, crypto_1.genRandomSalt)(),
227
- privateKey: users[0].privKey.serialize(),
225
+ salt: (0, crypto_1.generateRandomSalt)(),
226
+ privateKey: users[0].privateKey.serialize(),
228
227
  signer,
229
228
  });
230
229
  await (0, sdk_1.publish)({
231
- pubkey: users[0].pubKey.serialize(),
230
+ publicKey: users[0].publicKey.serialize(),
232
231
  stateIndex: 1n,
233
232
  voteOptionIndex: 0n,
234
233
  nonce: 2n,
235
234
  pollId: 0n,
236
235
  newVoteWeight: 3n,
237
236
  maciAddress: maciAddresses.maciContractAddress,
238
- salt: (0, crypto_1.genRandomSalt)(),
239
- privateKey: users[0].privKey.serialize(),
237
+ salt: (0, crypto_1.generateRandomSalt)(),
238
+ privateKey: users[0].privateKey.serialize(),
240
239
  signer,
241
240
  });
242
241
  await (0, sdk_1.publish)({
243
- pubkey: users[0].pubKey.serialize(),
242
+ publicKey: users[0].publicKey.serialize(),
244
243
  stateIndex: 1n,
245
244
  voteOptionIndex: 0n,
246
245
  nonce: 1n,
247
246
  pollId: 0n,
248
247
  newVoteWeight: 9n,
249
248
  maciAddress: maciAddresses.maciContractAddress,
250
- salt: (0, crypto_1.genRandomSalt)(),
251
- privateKey: users[0].privKey.serialize(),
249
+ salt: (0, crypto_1.generateRandomSalt)(),
250
+ privateKey: users[0].privateKey.serialize(),
252
251
  signer,
253
252
  });
254
253
  await (0, sdk_1.publish)({
255
- pubkey: users[1].pubKey.serialize(),
254
+ publicKey: users[1].publicKey.serialize(),
256
255
  stateIndex: 2n,
257
256
  voteOptionIndex: 2n,
258
257
  nonce: 1n,
259
258
  pollId: 0n,
260
259
  newVoteWeight: 9n,
261
260
  maciAddress: maciAddresses.maciContractAddress,
262
- salt: (0, crypto_1.genRandomSalt)(),
263
- privateKey: users[1].privKey.serialize(),
261
+ salt: (0, crypto_1.generateRandomSalt)(),
262
+ privateKey: users[1].privateKey.serialize(),
264
263
  signer,
265
264
  });
266
265
  await (0, sdk_1.publish)({
267
- pubkey: users[2].pubKey.serialize(),
266
+ publicKey: users[2].publicKey.serialize(),
268
267
  stateIndex: 3n,
269
268
  voteOptionIndex: 2n,
270
269
  nonce: 1n,
271
270
  pollId: 0n,
272
271
  newVoteWeight: 9n,
273
272
  maciAddress: maciAddresses.maciContractAddress,
274
- salt: (0, crypto_1.genRandomSalt)(),
275
- privateKey: users[2].privKey.serialize(),
273
+ salt: (0, crypto_1.generateRandomSalt)(),
274
+ privateKey: users[2].privateKey.serialize(),
276
275
  signer,
277
276
  });
278
277
  await (0, sdk_1.publish)({
279
- pubkey: users[3].pubKey.serialize(),
278
+ publicKey: users[3].publicKey.serialize(),
280
279
  stateIndex: 4n,
281
280
  voteOptionIndex: 2n,
282
281
  nonce: 3n,
283
282
  pollId: 0n,
284
283
  newVoteWeight: 3n,
285
284
  maciAddress: maciAddresses.maciContractAddress,
286
- salt: (0, crypto_1.genRandomSalt)(),
287
- privateKey: users[3].privKey.serialize(),
285
+ salt: (0, crypto_1.generateRandomSalt)(),
286
+ privateKey: users[3].privateKey.serialize(),
288
287
  signer,
289
288
  });
290
289
  await (0, sdk_1.publish)({
291
- pubkey: users[3].pubKey.serialize(),
290
+ publicKey: users[3].publicKey.serialize(),
292
291
  stateIndex: 4n,
293
292
  voteOptionIndex: 2n,
294
293
  nonce: 2n,
295
294
  pollId: 0n,
296
295
  newVoteWeight: 2n,
297
296
  maciAddress: maciAddresses.maciContractAddress,
298
- salt: (0, crypto_1.genRandomSalt)(),
299
- privateKey: users[3].privKey.serialize(),
297
+ salt: (0, crypto_1.generateRandomSalt)(),
298
+ privateKey: users[3].privateKey.serialize(),
300
299
  signer,
301
300
  });
302
301
  await (0, sdk_1.publish)({
303
- pubkey: users[3].pubKey.serialize(),
302
+ publicKey: users[3].publicKey.serialize(),
304
303
  stateIndex: 4n,
305
304
  voteOptionIndex: 1n,
306
305
  nonce: 1n,
307
306
  pollId: 0n,
308
307
  newVoteWeight: 9n,
309
308
  maciAddress: maciAddresses.maciContractAddress,
310
- salt: (0, crypto_1.genRandomSalt)(),
311
- privateKey: users[3].privKey.serialize(),
309
+ salt: (0, crypto_1.generateRandomSalt)(),
310
+ privateKey: users[3].privateKey.serialize(),
312
311
  signer,
313
312
  });
314
313
  });
@@ -317,98 +316,98 @@ describe("e2e tests", function test() {
317
316
  {
318
317
  pollId: 0n,
319
318
  voteOptionIndex: 1n,
320
- salt: (0, crypto_1.genRandomSalt)(),
319
+ salt: (0, crypto_1.generateRandomSalt)(),
321
320
  nonce: 2n,
322
- privateKey: users[0].privKey,
321
+ privateKey: users[0].privateKey,
323
322
  stateIndex: 1n,
324
323
  voteWeight: 4n,
325
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
324
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
326
325
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
327
- newPubKey: users[0].pubKey,
326
+ newPublicKey: users[0].publicKey,
328
327
  },
329
328
  {
330
329
  pollId: 0n,
331
330
  voteOptionIndex: 1n,
332
- salt: (0, crypto_1.genRandomSalt)(),
331
+ salt: (0, crypto_1.generateRandomSalt)(),
333
332
  nonce: 2n,
334
- privateKey: users[0].privKey,
333
+ privateKey: users[0].privateKey,
335
334
  stateIndex: 1n,
336
335
  voteWeight: 3n,
337
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
336
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
338
337
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
339
- newPubKey: users[0].pubKey,
338
+ newPublicKey: users[0].publicKey,
340
339
  },
341
340
  {
342
341
  pollId: 0n,
343
342
  voteOptionIndex: 1n,
344
- salt: (0, crypto_1.genRandomSalt)(),
343
+ salt: (0, crypto_1.generateRandomSalt)(),
345
344
  nonce: 1n,
346
- privateKey: users[0].privKey,
345
+ privateKey: users[0].privateKey,
347
346
  stateIndex: 1n,
348
347
  voteWeight: 9n,
349
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
348
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
350
349
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
351
- newPubKey: users[0].pubKey,
350
+ newPublicKey: users[0].publicKey,
352
351
  },
353
352
  {
354
353
  pollId: 0n,
355
354
  voteOptionIndex: 1n,
356
- salt: (0, crypto_1.genRandomSalt)(),
355
+ salt: (0, crypto_1.generateRandomSalt)(),
357
356
  nonce: 1n,
358
- privateKey: users[1].privKey,
357
+ privateKey: users[1].privateKey,
359
358
  stateIndex: 2n,
360
359
  voteWeight: 9n,
361
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
360
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
362
361
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
363
- newPubKey: users[1].pubKey,
362
+ newPublicKey: users[1].publicKey,
364
363
  },
365
364
  {
366
365
  pollId: 0n,
367
366
  voteOptionIndex: 1n,
368
- salt: (0, crypto_1.genRandomSalt)(),
367
+ salt: (0, crypto_1.generateRandomSalt)(),
369
368
  nonce: 1n,
370
- privateKey: users[2].privKey,
369
+ privateKey: users[2].privateKey,
371
370
  stateIndex: 3n,
372
371
  voteWeight: 9n,
373
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
372
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
374
373
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
375
- newPubKey: users[2].pubKey,
374
+ newPublicKey: users[2].publicKey,
376
375
  },
377
376
  {
378
377
  pollId: 0n,
379
378
  voteOptionIndex: 0n,
380
- salt: (0, crypto_1.genRandomSalt)(),
379
+ salt: (0, crypto_1.generateRandomSalt)(),
381
380
  nonce: 3n,
382
- privateKey: users[3].privKey,
381
+ privateKey: users[3].privateKey,
383
382
  stateIndex: 4n,
384
383
  voteWeight: 3n,
385
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
384
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
386
385
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
387
- newPubKey: users[3].pubKey,
386
+ newPublicKey: users[3].publicKey,
388
387
  },
389
388
  {
390
389
  pollId: 0n,
391
390
  voteOptionIndex: 0n,
392
- salt: (0, crypto_1.genRandomSalt)(),
391
+ salt: (0, crypto_1.generateRandomSalt)(),
393
392
  nonce: 2n,
394
- privateKey: users[3].privKey,
393
+ privateKey: users[3].privateKey,
395
394
  stateIndex: 4n,
396
395
  voteWeight: 2n,
397
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
396
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
398
397
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
399
- newPubKey: users[3].pubKey,
398
+ newPublicKey: users[3].publicKey,
400
399
  },
401
400
  {
402
401
  pollId: 0n,
403
402
  voteOptionIndex: 0n,
404
- salt: (0, crypto_1.genRandomSalt)(),
403
+ salt: (0, crypto_1.generateRandomSalt)(),
405
404
  nonce: 1n,
406
- privateKey: users[3].privKey,
405
+ privateKey: users[3].privateKey,
407
406
  stateIndex: 4n,
408
407
  voteWeight: 9n,
409
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
408
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
410
409
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
411
- newPubKey: users[3].pubKey,
410
+ newPublicKey: users[3].publicKey,
412
411
  },
413
412
  ];
414
413
  const messages = votes
@@ -417,8 +416,8 @@ describe("e2e tests", function test() {
417
416
  maciAddress: maciAddresses.maciContractAddress,
418
417
  poll: 0,
419
418
  data: message.data.map(String),
420
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
421
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
419
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
420
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
422
421
  }));
423
422
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
424
423
  });
@@ -452,6 +451,12 @@ describe("e2e tests", function test() {
452
451
  signer,
453
452
  signupPolicyAddress: signupPolicyContractAddress,
454
453
  });
454
+ // we set the verifying keys
455
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
456
+ await (0, sdk_1.setVerifyingKeys)({
457
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
458
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
459
+ });
455
460
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
456
461
  // deploy a poll contract
457
462
  await (0, sdk_1.deployPoll)({
@@ -461,8 +466,6 @@ describe("e2e tests", function test() {
461
466
  pollEndTimestamp: startDate + constants_1.pollDuration,
462
467
  relayers: [await signer.getAddress()],
463
468
  maciAddress: maciAddresses.maciContractAddress,
464
- verifierContractAddress,
465
- vkRegistryContractAddress: vkRegistryAddress,
466
469
  policyContractAddress: pollPolicyContractAddress,
467
470
  initialVoiceCreditProxyContractAddress,
468
471
  });
@@ -472,7 +475,7 @@ describe("e2e tests", function test() {
472
475
  // eslint-disable-next-line no-await-in-loop
473
476
  await (0, sdk_1.signup)({
474
477
  maciAddress: maciAddresses.maciContractAddress,
475
- maciPubKey: users[i].pubKey.serialize(),
478
+ maciPublicKey: users[i].publicKey.serialize(),
476
479
  sgData: constants_1.DEFAULT_SG_DATA,
477
480
  signer,
478
481
  });
@@ -482,13 +485,12 @@ describe("e2e tests", function test() {
482
485
  // eslint-disable-next-line no-await-in-loop
483
486
  await (0, sdk_1.joinPoll)({
484
487
  maciAddress: maciAddresses.maciContractAddress,
485
- privateKey: users[0].privKey.serialize(),
486
- stateIndex: 1n,
488
+ privateKey: users[0].privateKey.serialize(),
487
489
  pollId: 0n,
488
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
489
- useWasm: true,
490
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
491
+ useWasm,
490
492
  pollWasm: constants_1.testPollJoiningWasmPath,
491
- pollWitgen: constants_1.testPollJoiningWitnessPath,
493
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
492
494
  rapidsnark: constants_1.testRapidsnarkPath,
493
495
  sgDataArg: constants_1.DEFAULT_SG_DATA,
494
496
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -501,35 +503,35 @@ describe("e2e tests", function test() {
501
503
  .map(() => (0, sdk_1.generateVote)({
502
504
  pollId: 0n,
503
505
  voteOptionIndex: 0n,
504
- salt: (0, crypto_1.genRandomSalt)(),
506
+ salt: (0, crypto_1.generateRandomSalt)(),
505
507
  nonce: 1n,
506
- privateKey: users[0].privKey,
508
+ privateKey: users[0].privateKey,
507
509
  stateIndex: 1n,
508
510
  voteWeight: 9n,
509
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
511
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
510
512
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
511
- newPubKey: users[0].pubKey,
513
+ newPublicKey: users[0].publicKey,
512
514
  }))
513
515
  .map(({ message, ephemeralKeypair }) => ({
514
516
  maciAddress: maciAddresses.maciContractAddress,
515
517
  poll: 0,
516
518
  data: message.data.map(String),
517
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
518
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
519
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
520
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
519
521
  }));
520
522
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
521
523
  for (let i = 0; i < 12; i += 1) {
522
524
  // eslint-disable-next-line no-await-in-loop
523
525
  await (0, sdk_1.publish)({
524
- pubkey: users[0].pubKey.serialize(),
526
+ publicKey: users[0].publicKey.serialize(),
525
527
  stateIndex: 1n,
526
528
  voteOptionIndex: 0n,
527
529
  nonce: 1n,
528
530
  pollId: 0n,
529
531
  newVoteWeight: 9n,
530
532
  maciAddress: maciAddresses.maciContractAddress,
531
- salt: (0, crypto_1.genRandomSalt)(),
532
- privateKey: users[0].privKey.serialize(),
533
+ salt: (0, crypto_1.generateRandomSalt)(),
534
+ privateKey: users[0].privateKey.serialize(),
533
535
  signer,
534
536
  });
535
537
  }
@@ -564,6 +566,12 @@ describe("e2e tests", function test() {
564
566
  signer,
565
567
  signupPolicyAddress: signupPolicyContractAddress,
566
568
  });
569
+ // we set the verifying keys
570
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
571
+ await (0, sdk_1.setVerifyingKeys)({
572
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
573
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
574
+ });
567
575
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
568
576
  // deploy a poll contract
569
577
  await (0, sdk_1.deployPoll)({
@@ -573,8 +581,6 @@ describe("e2e tests", function test() {
573
581
  pollEndTimestamp: startDate + constants_1.pollDuration,
574
582
  relayers: [await signer.getAddress()],
575
583
  maciAddress: maciAddresses.maciContractAddress,
576
- verifierContractAddress,
577
- vkRegistryContractAddress: vkRegistryAddress,
578
584
  policyContractAddress: pollPolicyContractAddress,
579
585
  initialVoiceCreditProxyContractAddress,
580
586
  });
@@ -585,7 +591,7 @@ describe("e2e tests", function test() {
585
591
  // eslint-disable-next-line no-await-in-loop
586
592
  await (0, sdk_1.signup)({
587
593
  maciAddress: maciAddresses.maciContractAddress,
588
- maciPubKey: users[i].pubKey.serialize(),
594
+ maciPublicKey: users[i].publicKey.serialize(),
589
595
  sgData: constants_1.DEFAULT_SG_DATA,
590
596
  signer,
591
597
  });
@@ -597,13 +603,12 @@ describe("e2e tests", function test() {
597
603
  // eslint-disable-next-line no-await-in-loop
598
604
  await (0, sdk_1.joinPoll)({
599
605
  maciAddress: maciAddresses.maciContractAddress,
600
- privateKey: users[i].privKey.serialize(),
601
- stateIndex: BigInt(i + 1),
606
+ privateKey: users[i].privateKey.serialize(),
602
607
  pollId: 0n,
603
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
604
- useWasm: true,
608
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
609
+ useWasm,
605
610
  pollWasm: constants_1.testPollJoiningWasmPath,
606
- pollWitgen: constants_1.testPollJoiningWitnessPath,
611
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
607
612
  rapidsnark: constants_1.testRapidsnarkPath,
608
613
  sgDataArg: constants_1.DEFAULT_SG_DATA,
609
614
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -617,14 +622,14 @@ describe("e2e tests", function test() {
617
622
  // eslint-disable-next-line no-await-in-loop
618
623
  await (0, sdk_1.publish)({
619
624
  maciAddress: maciAddresses.maciContractAddress,
620
- pubkey: users[i].pubKey.serialize(),
625
+ publicKey: users[i].publicKey.serialize(),
621
626
  stateIndex: BigInt(i + 1),
622
627
  voteOptionIndex: 0n,
623
628
  nonce: 1n,
624
629
  pollId: 0n,
625
630
  newVoteWeight: 9n,
626
- salt: (0, crypto_1.genRandomSalt)(),
627
- privateKey: users[i].privKey.serialize(),
631
+ salt: (0, crypto_1.generateRandomSalt)(),
632
+ privateKey: users[i].privateKey.serialize(),
628
633
  signer,
629
634
  });
630
635
  }
@@ -657,6 +662,12 @@ describe("e2e tests", function test() {
657
662
  signer,
658
663
  signupPolicyAddress: signupPolicyContractAddress,
659
664
  });
665
+ // we set the verifying keys
666
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
667
+ await (0, sdk_1.setVerifyingKeys)({
668
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
669
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
670
+ });
660
671
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
661
672
  // deploy a poll contract
662
673
  await (0, sdk_1.deployPoll)({
@@ -666,8 +677,6 @@ describe("e2e tests", function test() {
666
677
  pollEndTimestamp: startDate + constants_1.pollDuration,
667
678
  relayers: [await signer.getAddress()],
668
679
  maciAddress: maciAddresses.maciContractAddress,
669
- verifierContractAddress,
670
- vkRegistryContractAddress: vkRegistryAddress,
671
680
  policyContractAddress: pollPolicyContractAddress,
672
681
  initialVoiceCreditProxyContractAddress,
673
682
  });
@@ -678,7 +687,7 @@ describe("e2e tests", function test() {
678
687
  // eslint-disable-next-line no-await-in-loop
679
688
  await (0, sdk_1.signup)({
680
689
  maciAddress: maciAddresses.maciContractAddress,
681
- maciPubKey: users[i].pubKey.serialize(),
690
+ maciPublicKey: users[i].publicKey.serialize(),
682
691
  sgData: constants_1.DEFAULT_SG_DATA,
683
692
  signer,
684
693
  });
@@ -690,13 +699,12 @@ describe("e2e tests", function test() {
690
699
  // eslint-disable-next-line no-await-in-loop
691
700
  await (0, sdk_1.joinPoll)({
692
701
  maciAddress: maciAddresses.maciContractAddress,
693
- privateKey: users[i].privKey.serialize(),
694
- stateIndex: BigInt(i + 1),
702
+ privateKey: users[i].privateKey.serialize(),
695
703
  pollId: 0n,
696
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
697
- useWasm: true,
704
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
705
+ useWasm,
698
706
  pollWasm: constants_1.testPollJoiningWasmPath,
699
- pollWitgen: constants_1.testPollJoiningWitnessPath,
707
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
700
708
  rapidsnark: constants_1.testRapidsnarkPath,
701
709
  sgDataArg: constants_1.DEFAULT_SG_DATA,
702
710
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -710,14 +718,14 @@ describe("e2e tests", function test() {
710
718
  // eslint-disable-next-line no-await-in-loop
711
719
  await (0, sdk_1.publish)({
712
720
  maciAddress: maciAddresses.maciContractAddress,
713
- pubkey: users[i].pubKey.serialize(),
721
+ publicKey: users[i].publicKey.serialize(),
714
722
  stateIndex: 1n,
715
723
  voteOptionIndex: 0n,
716
724
  nonce: 1n,
717
725
  pollId: 0n,
718
726
  newVoteWeight: 9n,
719
- salt: (0, crypto_1.genRandomSalt)(),
720
- privateKey: users[i].privKey.serialize(),
727
+ salt: (0, crypto_1.generateRandomSalt)(),
728
+ privateKey: users[i].privateKey.serialize(),
721
729
  signer,
722
730
  });
723
731
  }
@@ -727,38 +735,38 @@ describe("e2e tests", function test() {
727
735
  {
728
736
  pollId: 0n,
729
737
  voteOptionIndex: 1n,
730
- salt: (0, crypto_1.genRandomSalt)(),
738
+ salt: (0, crypto_1.generateRandomSalt)(),
731
739
  nonce: 2n,
732
- privateKey: users[0].privKey,
740
+ privateKey: users[0].privateKey,
733
741
  stateIndex: 1n,
734
742
  voteWeight: 5n,
735
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
743
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
736
744
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
737
- newPubKey: users[0].pubKey,
745
+ newPublicKey: users[0].publicKey,
738
746
  },
739
747
  {
740
748
  pollId: 0n,
741
749
  voteOptionIndex: 2n,
742
- salt: (0, crypto_1.genRandomSalt)(),
750
+ salt: (0, crypto_1.generateRandomSalt)(),
743
751
  nonce: 3n,
744
- privateKey: users[2].privKey,
752
+ privateKey: users[2].privateKey,
745
753
  stateIndex: 3n,
746
754
  voteWeight: 9n,
747
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
755
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
748
756
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
749
- newPubKey: users[2].pubKey,
757
+ newPublicKey: users[2].publicKey,
750
758
  },
751
759
  {
752
760
  pollId: 0n,
753
761
  voteOptionIndex: 3n,
754
- salt: (0, crypto_1.genRandomSalt)(),
762
+ salt: (0, crypto_1.generateRandomSalt)(),
755
763
  nonce: 3n,
756
- privateKey: users[3].privKey,
764
+ privateKey: users[3].privateKey,
757
765
  stateIndex: 4n,
758
766
  voteWeight: 7n,
759
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
767
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
760
768
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
761
- newPubKey: users[3].pubKey,
769
+ newPublicKey: users[3].publicKey,
762
770
  },
763
771
  ];
764
772
  const messages = votes
@@ -767,8 +775,8 @@ describe("e2e tests", function test() {
767
775
  maciAddress: maciAddresses.maciContractAddress,
768
776
  poll: 0,
769
777
  data: message.data.map(String),
770
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
771
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
778
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
779
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
772
780
  }));
773
781
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
774
782
  });
@@ -802,6 +810,12 @@ describe("e2e tests", function test() {
802
810
  signer,
803
811
  signupPolicyAddress: signupPolicyContractAddress,
804
812
  });
813
+ // we set the verifying keys
814
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
815
+ await (0, sdk_1.setVerifyingKeys)({
816
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
817
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
818
+ });
805
819
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
806
820
  // deploy a poll contract
807
821
  await (0, sdk_1.deployPoll)({
@@ -811,28 +825,25 @@ describe("e2e tests", function test() {
811
825
  pollEndTimestamp: startDate + constants_1.pollDuration,
812
826
  relayers: [await signer.getAddress()],
813
827
  maciAddress: maciAddresses.maciContractAddress,
814
- verifierContractAddress,
815
- vkRegistryContractAddress: vkRegistryAddress,
816
828
  policyContractAddress: pollPolicyContractAddress,
817
829
  initialVoiceCreditProxyContractAddress,
818
830
  });
819
831
  // signup
820
832
  await (0, sdk_1.signup)({
821
833
  maciAddress: maciAddresses.maciContractAddress,
822
- maciPubKey: users[0].pubKey.serialize(),
834
+ maciPublicKey: users[0].publicKey.serialize(),
823
835
  sgData: constants_1.DEFAULT_SG_DATA,
824
836
  signer,
825
837
  });
826
838
  // joinPoll
827
839
  await (0, sdk_1.joinPoll)({
828
840
  maciAddress: maciAddresses.maciContractAddress,
829
- privateKey: users[0].privKey.serialize(),
830
- stateIndex: 1n,
841
+ privateKey: users[0].privateKey.serialize(),
831
842
  pollId: 0n,
832
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
833
- useWasm: true,
843
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
844
+ useWasm,
834
845
  pollWasm: constants_1.testPollJoiningWasmPath,
835
- pollWitgen: constants_1.testPollJoiningWitnessPath,
846
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
836
847
  rapidsnark: constants_1.testRapidsnarkPath,
837
848
  sgDataArg: constants_1.DEFAULT_SG_DATA,
838
849
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -840,39 +851,38 @@ describe("e2e tests", function test() {
840
851
  });
841
852
  // publish
842
853
  await (0, sdk_1.publish)({
843
- pubkey: users[0].pubKey.serialize(),
854
+ publicKey: users[0].publicKey.serialize(),
844
855
  stateIndex: 1n,
845
856
  voteOptionIndex: 0n,
846
857
  nonce: 1n,
847
858
  pollId: 0n,
848
859
  newVoteWeight: 9n,
849
860
  maciAddress: maciAddresses.maciContractAddress,
850
- salt: (0, crypto_1.genRandomSalt)(),
851
- privateKey: users[0].privKey.serialize(),
861
+ salt: (0, crypto_1.generateRandomSalt)(),
862
+ privateKey: users[0].privateKey.serialize(),
852
863
  signer,
853
864
  });
854
865
  await (0, sdk_1.signup)({
855
866
  maciAddress: maciAddresses.maciContractAddress,
856
- maciPubKey: users[1].pubKey.serialize(),
867
+ maciPublicKey: users[1].publicKey.serialize(),
857
868
  sgData: constants_1.DEFAULT_SG_DATA,
858
869
  signer,
859
870
  });
860
871
  await (0, sdk_1.signup)({
861
872
  maciAddress: maciAddresses.maciContractAddress,
862
- maciPubKey: users[2].pubKey.serialize(),
873
+ maciPublicKey: users[2].publicKey.serialize(),
863
874
  sgData: constants_1.DEFAULT_SG_DATA,
864
875
  signer,
865
876
  });
866
877
  // joinPoll
867
878
  await (0, sdk_1.joinPoll)({
868
879
  maciAddress: maciAddresses.maciContractAddress,
869
- privateKey: users[1].privKey.serialize(),
870
- stateIndex: 2n,
880
+ privateKey: users[1].privateKey.serialize(),
871
881
  pollId: 0n,
872
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
873
- useWasm: true,
882
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
883
+ useWasm,
874
884
  pollWasm: constants_1.testPollJoiningWasmPath,
875
- pollWitgen: constants_1.testPollJoiningWitnessPath,
885
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
876
886
  rapidsnark: constants_1.testRapidsnarkPath,
877
887
  sgDataArg: constants_1.DEFAULT_SG_DATA,
878
888
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -882,14 +892,14 @@ describe("e2e tests", function test() {
882
892
  {
883
893
  pollId: 0n,
884
894
  voteOptionIndex: 0n,
885
- salt: (0, crypto_1.genRandomSalt)(),
895
+ salt: (0, crypto_1.generateRandomSalt)(),
886
896
  nonce: 1n,
887
- privateKey: users[1].privKey,
897
+ privateKey: users[1].privateKey,
888
898
  stateIndex: 2n,
889
899
  voteWeight: 2n,
890
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
900
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
891
901
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
892
- newPubKey: users[1].pubKey,
902
+ newPublicKey: users[1].publicKey,
893
903
  },
894
904
  ];
895
905
  const messages = votes
@@ -898,8 +908,8 @@ describe("e2e tests", function test() {
898
908
  maciAddress: maciAddresses.maciContractAddress,
899
909
  poll: 0,
900
910
  data: message.data.map(String),
901
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
902
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
911
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
912
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
903
913
  }));
904
914
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
905
915
  const ipfsMessageBackupFiles = await (0, utils_1.getBackupFilenames)();
@@ -929,8 +939,6 @@ describe("e2e tests", function test() {
929
939
  pollEndTimestamp: startDate + constants_1.pollDuration,
930
940
  relayers: [await signer.getAddress()],
931
941
  maciAddress: maciAddresses.maciContractAddress,
932
- verifierContractAddress,
933
- vkRegistryContractAddress: vkRegistryAddress,
934
942
  policyContractAddress: pollPolicyContractAddress,
935
943
  initialVoiceCreditProxyContractAddress,
936
944
  });
@@ -938,13 +946,13 @@ describe("e2e tests", function test() {
938
946
  it("should signup two new users", async () => {
939
947
  await (0, sdk_1.signup)({
940
948
  maciAddress: maciAddresses.maciContractAddress,
941
- maciPubKey: users[3].pubKey.serialize(),
949
+ maciPublicKey: users[3].publicKey.serialize(),
942
950
  sgData: constants_1.DEFAULT_SG_DATA,
943
951
  signer,
944
952
  });
945
953
  await (0, sdk_1.signup)({
946
954
  maciAddress: maciAddresses.maciContractAddress,
947
- maciPubKey: users[4].pubKey.serialize(),
955
+ maciPublicKey: users[4].publicKey.serialize(),
948
956
  sgData: constants_1.DEFAULT_SG_DATA,
949
957
  signer,
950
958
  });
@@ -953,13 +961,12 @@ describe("e2e tests", function test() {
953
961
  // joinPoll
954
962
  await (0, sdk_1.joinPoll)({
955
963
  maciAddress: maciAddresses.maciContractAddress,
956
- privateKey: users[3].privKey.serialize(),
957
- stateIndex: 4n,
964
+ privateKey: users[3].privateKey.serialize(),
958
965
  pollId: 1n,
959
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
960
- useWasm: true,
966
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
967
+ useWasm,
961
968
  pollWasm: constants_1.testPollJoiningWasmPath,
962
- pollWitgen: constants_1.testPollJoiningWitnessPath,
969
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
963
970
  rapidsnark: constants_1.testRapidsnarkPath,
964
971
  sgDataArg: constants_1.DEFAULT_SG_DATA,
965
972
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -968,13 +975,12 @@ describe("e2e tests", function test() {
968
975
  // joinPoll
969
976
  await (0, sdk_1.joinPoll)({
970
977
  maciAddress: maciAddresses.maciContractAddress,
971
- privateKey: users[4].privKey.serialize(),
972
- stateIndex: 5n,
978
+ privateKey: users[4].privateKey.serialize(),
973
979
  pollId: 1n,
974
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
975
- useWasm: true,
980
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
981
+ useWasm,
976
982
  pollWasm: constants_1.testPollJoiningWasmPath,
977
- pollWitgen: constants_1.testPollJoiningWitnessPath,
983
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
978
984
  rapidsnark: constants_1.testRapidsnarkPath,
979
985
  sgDataArg: constants_1.DEFAULT_SG_DATA,
980
986
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -986,26 +992,26 @@ describe("e2e tests", function test() {
986
992
  {
987
993
  pollId: 1n,
988
994
  voteOptionIndex: 1n,
989
- salt: (0, crypto_1.genRandomSalt)(),
995
+ salt: (0, crypto_1.generateRandomSalt)(),
990
996
  nonce: 1n,
991
- privateKey: users[0].privKey,
997
+ privateKey: users[0].privateKey,
992
998
  stateIndex: 1n,
993
999
  voteWeight: 9n,
994
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1000
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
995
1001
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
996
- newPubKey: users[0].pubKey,
1002
+ newPublicKey: users[0].publicKey,
997
1003
  },
998
1004
  {
999
1005
  pollId: 1n,
1000
1006
  voteOptionIndex: 0n,
1001
- salt: (0, crypto_1.genRandomSalt)(),
1007
+ salt: (0, crypto_1.generateRandomSalt)(),
1002
1008
  nonce: 1n,
1003
- privateKey: users[1].privKey,
1009
+ privateKey: users[1].privateKey,
1004
1010
  stateIndex: 1n,
1005
1011
  voteWeight: 5n,
1006
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1012
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1007
1013
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1008
- newPubKey: users[1].pubKey,
1014
+ newPublicKey: users[1].publicKey,
1009
1015
  },
1010
1016
  ];
1011
1017
  const messages = votes
@@ -1014,36 +1020,36 @@ describe("e2e tests", function test() {
1014
1020
  maciAddress: maciAddresses.maciContractAddress,
1015
1021
  poll: 1,
1016
1022
  data: message.data.map(String),
1017
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1018
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1023
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1024
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1019
1025
  }));
1020
1026
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 1, maciAddress: maciAddresses.maciContractAddress });
1021
1027
  });
1022
1028
  it("should publish a new message from the first poll voter", async () => {
1023
1029
  await (0, sdk_1.publish)({
1024
- pubkey: users[0].pubKey.serialize(),
1030
+ publicKey: users[0].publicKey.serialize(),
1025
1031
  stateIndex: 1n,
1026
1032
  voteOptionIndex: 0n,
1027
1033
  nonce: 1n,
1028
1034
  pollId: 1n,
1029
1035
  newVoteWeight: 7n,
1030
1036
  maciAddress: maciAddresses.maciContractAddress,
1031
- salt: (0, crypto_1.genRandomSalt)(),
1032
- privateKey: users[0].privKey.serialize(),
1037
+ salt: (0, crypto_1.generateRandomSalt)(),
1038
+ privateKey: users[0].privateKey.serialize(),
1033
1039
  signer,
1034
1040
  });
1035
1041
  });
1036
1042
  it("should publish a new message by the new poll voters", async () => {
1037
1043
  await (0, sdk_1.publish)({
1038
- pubkey: users[1].pubKey.serialize(),
1044
+ publicKey: users[1].publicKey.serialize(),
1039
1045
  stateIndex: 1n,
1040
1046
  voteOptionIndex: 0n,
1041
1047
  nonce: 1n,
1042
1048
  pollId: 1n,
1043
1049
  newVoteWeight: 7n,
1044
1050
  maciAddress: maciAddresses.maciContractAddress,
1045
- salt: (0, crypto_1.genRandomSalt)(),
1046
- privateKey: users[1].privKey.serialize(),
1051
+ salt: (0, crypto_1.generateRandomSalt)(),
1052
+ privateKey: users[1].privateKey.serialize(),
1047
1053
  signer,
1048
1054
  });
1049
1055
  });
@@ -1084,6 +1090,12 @@ describe("e2e tests", function test() {
1084
1090
  signer,
1085
1091
  signupPolicyAddress: signupPolicyContractAddress,
1086
1092
  });
1093
+ // we set the verifying keys
1094
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
1095
+ await (0, sdk_1.setVerifyingKeys)({
1096
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
1097
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
1098
+ });
1087
1099
  });
1088
1100
  it("should run the first poll", async () => {
1089
1101
  const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
@@ -1097,8 +1109,6 @@ describe("e2e tests", function test() {
1097
1109
  pollEndTimestamp: startDate + constants_1.pollDuration,
1098
1110
  relayers: [await signer.getAddress()],
1099
1111
  maciAddress: maciAddresses.maciContractAddress,
1100
- verifierContractAddress,
1101
- vkRegistryContractAddress: vkRegistryAddress,
1102
1112
  policyContractAddress: pollPolicyContractAddress,
1103
1113
  initialVoiceCreditProxyContractAddress,
1104
1114
  });
@@ -1108,14 +1118,14 @@ describe("e2e tests", function test() {
1108
1118
  // eslint-disable-next-line no-await-in-loop
1109
1119
  await (0, sdk_1.signup)({
1110
1120
  maciAddress: maciAddresses.maciContractAddress,
1111
- maciPubKey: users[i].pubKey.serialize(),
1121
+ maciPublicKey: users[i].publicKey.serialize(),
1112
1122
  sgData: constants_1.DEFAULT_SG_DATA,
1113
1123
  signer,
1114
1124
  });
1115
1125
  // eslint-disable-next-line no-await-in-loop
1116
1126
  const { isRegistered, stateIndex } = await (0, sdk_1.getSignedupUserData)({
1117
1127
  maciAddress: maciAddresses.maciContractAddress,
1118
- maciPubKey: users[i].pubKey.serialize(),
1128
+ maciPublicKey: users[i].publicKey.serialize(),
1119
1129
  signer,
1120
1130
  });
1121
1131
  (0, chai_1.expect)(isRegistered).to.eq(true);
@@ -1127,13 +1137,12 @@ describe("e2e tests", function test() {
1127
1137
  // eslint-disable-next-line no-await-in-loop
1128
1138
  await (0, sdk_1.joinPoll)({
1129
1139
  maciAddress: maciAddresses.maciContractAddress,
1130
- privateKey: users[i].privKey.serialize(),
1131
- stateIndex: BigInt(i + 1),
1140
+ privateKey: users[i].privateKey.serialize(),
1132
1141
  pollId: 0n,
1133
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
1134
- useWasm: true,
1142
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
1143
+ useWasm,
1135
1144
  pollWasm: constants_1.testPollJoiningWasmPath,
1136
- pollWitgen: constants_1.testPollJoiningWitnessPath,
1145
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
1137
1146
  rapidsnark: constants_1.testRapidsnarkPath,
1138
1147
  sgDataArg: constants_1.DEFAULT_SG_DATA,
1139
1148
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -1143,7 +1152,7 @@ describe("e2e tests", function test() {
1143
1152
  const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
1144
1153
  maciAddress: maciAddresses.maciContractAddress,
1145
1154
  pollId: 0n,
1146
- pollPubKey: users[i].pubKey.serialize(),
1155
+ pollPublicKey: users[i].publicKey.serialize(),
1147
1156
  signer,
1148
1157
  startBlock: 0,
1149
1158
  });
@@ -1152,29 +1161,29 @@ describe("e2e tests", function test() {
1152
1161
  }
1153
1162
  // publish
1154
1163
  await (0, sdk_1.publish)({
1155
- pubkey: users[0].pubKey.serialize(),
1164
+ publicKey: users[0].publicKey.serialize(),
1156
1165
  stateIndex: 1n,
1157
1166
  voteOptionIndex: 0n,
1158
1167
  nonce: 1n,
1159
1168
  pollId: 0n,
1160
1169
  newVoteWeight: 9n,
1161
1170
  maciAddress: maciAddresses.maciContractAddress,
1162
- salt: (0, crypto_1.genRandomSalt)(),
1163
- privateKey: users[0].privKey.serialize(),
1171
+ salt: (0, crypto_1.generateRandomSalt)(),
1172
+ privateKey: users[0].privateKey.serialize(),
1164
1173
  signer,
1165
1174
  });
1166
1175
  const votes = [
1167
1176
  {
1168
1177
  pollId: 0n,
1169
1178
  voteOptionIndex: 0n,
1170
- salt: (0, crypto_1.genRandomSalt)(),
1179
+ salt: (0, crypto_1.generateRandomSalt)(),
1171
1180
  nonce: 1n,
1172
- privateKey: users[0].privKey,
1181
+ privateKey: users[0].privateKey,
1173
1182
  stateIndex: 1n,
1174
1183
  voteWeight: 5n,
1175
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1184
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1176
1185
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1177
- newPubKey: users[0].pubKey,
1186
+ newPublicKey: users[0].publicKey,
1178
1187
  },
1179
1188
  ];
1180
1189
  const messages = votes
@@ -1183,8 +1192,8 @@ describe("e2e tests", function test() {
1183
1192
  maciAddress: maciAddresses.maciContractAddress,
1184
1193
  poll: 0,
1185
1194
  data: message.data.map(String),
1186
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1187
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1195
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1196
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1188
1197
  }));
1189
1198
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
1190
1199
  const ipfsMessageBackupFiles = await (0, utils_1.getBackupFilenames)();
@@ -1215,8 +1224,6 @@ describe("e2e tests", function test() {
1215
1224
  pollEndTimestamp: startDate + constants_1.pollDuration,
1216
1225
  relayers: [await signer.getAddress()],
1217
1226
  maciAddress: maciAddresses.maciContractAddress,
1218
- verifierContractAddress,
1219
- vkRegistryContractAddress: vkRegistryAddress,
1220
1227
  policyContractAddress: pollPolicyContractAddress,
1221
1228
  initialVoiceCreditProxyContractAddress,
1222
1229
  });
@@ -1232,8 +1239,6 @@ describe("e2e tests", function test() {
1232
1239
  pollEndTimestamp: startDate + constants_1.pollDuration,
1233
1240
  relayers: [await signer.getAddress()],
1234
1241
  maciAddress: maciAddresses.maciContractAddress,
1235
- verifierContractAddress,
1236
- vkRegistryContractAddress: vkRegistryAddress,
1237
1242
  policyContractAddress: pollPolicyContractAddress,
1238
1243
  initialVoiceCreditProxyContractAddress,
1239
1244
  });
@@ -1241,18 +1246,18 @@ describe("e2e tests", function test() {
1241
1246
  });
1242
1247
  it("join the second and third polls", async () => {
1243
1248
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
1244
- for (let p = 1; p <= 2; p += 1) {
1249
+ for (let pollId = 1; pollId <= 2; pollId += 1) {
1250
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
1245
1251
  for (let i = 0; i < users.length; i += 1) {
1246
1252
  // eslint-disable-next-line no-await-in-loop
1247
1253
  await (0, sdk_1.joinPoll)({
1248
1254
  maciAddress: maciAddresses.maciContractAddress,
1249
- privateKey: users[i].privKey.serialize(),
1250
- stateIndex: BigInt(i + 1),
1251
- pollId: BigInt(p),
1252
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
1253
- useWasm: true,
1255
+ privateKey: users[i].privateKey.serialize(),
1256
+ pollId: BigInt(pollId),
1257
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
1258
+ useWasm,
1254
1259
  pollWasm: constants_1.testPollJoiningWasmPath,
1255
- pollWitgen: constants_1.testPollJoiningWitnessPath,
1260
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
1256
1261
  rapidsnark: constants_1.testRapidsnarkPath,
1257
1262
  sgDataArg: constants_1.DEFAULT_SG_DATA,
1258
1263
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -1261,8 +1266,8 @@ describe("e2e tests", function test() {
1261
1266
  // eslint-disable-next-line no-await-in-loop
1262
1267
  const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
1263
1268
  maciAddress: maciAddresses.maciContractAddress,
1264
- pollId: BigInt(p),
1265
- pollPubKey: users[i].pubKey.serialize(),
1269
+ pollId: BigInt(pollId),
1270
+ pollPublicKey: users[i].publicKey.serialize(),
1266
1271
  signer,
1267
1272
  startBlock: 0,
1268
1273
  });
@@ -1273,39 +1278,39 @@ describe("e2e tests", function test() {
1273
1278
  });
1274
1279
  it("should publish messages to the second poll", async () => {
1275
1280
  await (0, sdk_1.publish)({
1276
- pubkey: users[0].pubKey.serialize(),
1281
+ publicKey: users[0].publicKey.serialize(),
1277
1282
  stateIndex: 1n,
1278
1283
  voteOptionIndex: 0n,
1279
1284
  nonce: 1n,
1280
1285
  pollId: 1n,
1281
1286
  newVoteWeight: 9n,
1282
1287
  maciAddress: maciAddresses.maciContractAddress,
1283
- salt: (0, crypto_1.genRandomSalt)(),
1284
- privateKey: users[0].privKey.serialize(),
1288
+ salt: (0, crypto_1.generateRandomSalt)(),
1289
+ privateKey: users[0].privateKey.serialize(),
1285
1290
  signer,
1286
1291
  });
1287
1292
  await (0, sdk_1.publish)({
1288
- pubkey: users[1].pubKey.serialize(),
1293
+ publicKey: users[1].publicKey.serialize(),
1289
1294
  stateIndex: 2n,
1290
1295
  voteOptionIndex: 3n,
1291
1296
  nonce: 1n,
1292
1297
  pollId: 1n,
1293
1298
  newVoteWeight: 1n,
1294
1299
  maciAddress: maciAddresses.maciContractAddress,
1295
- salt: (0, crypto_1.genRandomSalt)(),
1296
- privateKey: users[1].privKey.serialize(),
1300
+ salt: (0, crypto_1.generateRandomSalt)(),
1301
+ privateKey: users[1].privateKey.serialize(),
1297
1302
  signer,
1298
1303
  });
1299
1304
  await (0, sdk_1.publish)({
1300
- pubkey: users[2].pubKey.serialize(),
1305
+ publicKey: users[2].publicKey.serialize(),
1301
1306
  stateIndex: 3n,
1302
1307
  voteOptionIndex: 5n,
1303
1308
  nonce: 1n,
1304
1309
  pollId: 1n,
1305
1310
  newVoteWeight: 3n,
1306
1311
  maciAddress: maciAddresses.maciContractAddress,
1307
- salt: (0, crypto_1.genRandomSalt)(),
1308
- privateKey: users[2].privKey.serialize(),
1312
+ salt: (0, crypto_1.generateRandomSalt)(),
1313
+ privateKey: users[2].privateKey.serialize(),
1309
1314
  signer,
1310
1315
  });
1311
1316
  });
@@ -1314,14 +1319,14 @@ describe("e2e tests", function test() {
1314
1319
  {
1315
1320
  pollId: 1n,
1316
1321
  voteOptionIndex: 0n,
1317
- salt: (0, crypto_1.genRandomSalt)(),
1322
+ salt: (0, crypto_1.generateRandomSalt)(),
1318
1323
  nonce: 1n,
1319
- privateKey: users[0].privKey,
1324
+ privateKey: users[0].privateKey,
1320
1325
  stateIndex: 1n,
1321
1326
  voteWeight: 3n,
1322
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1327
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1323
1328
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1324
- newPubKey: users[0].pubKey,
1329
+ newPublicKey: users[0].publicKey,
1325
1330
  },
1326
1331
  ];
1327
1332
  const messages = votes
@@ -1330,8 +1335,8 @@ describe("e2e tests", function test() {
1330
1335
  maciAddress: maciAddresses.maciContractAddress,
1331
1336
  poll: 1,
1332
1337
  data: message.data.map(String),
1333
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1334
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1338
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1339
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1335
1340
  }));
1336
1341
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 1, maciAddress: maciAddresses.maciContractAddress });
1337
1342
  });
@@ -1340,26 +1345,26 @@ describe("e2e tests", function test() {
1340
1345
  {
1341
1346
  pollId: 2n,
1342
1347
  voteOptionIndex: 7n,
1343
- salt: (0, crypto_1.genRandomSalt)(),
1348
+ salt: (0, crypto_1.generateRandomSalt)(),
1344
1349
  nonce: 1n,
1345
- privateKey: users[4].privKey,
1350
+ privateKey: users[4].privateKey,
1346
1351
  stateIndex: 4n,
1347
1352
  voteWeight: 3n,
1348
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1353
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1349
1354
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1350
- newPubKey: users[4].pubKey,
1355
+ newPublicKey: users[4].publicKey,
1351
1356
  },
1352
1357
  {
1353
1358
  pollId: 2n,
1354
1359
  voteOptionIndex: 5n,
1355
- salt: (0, crypto_1.genRandomSalt)(),
1360
+ salt: (0, crypto_1.generateRandomSalt)(),
1356
1361
  nonce: 1n,
1357
- privateKey: users[5].privKey,
1362
+ privateKey: users[5].privateKey,
1358
1363
  stateIndex: 5n,
1359
1364
  voteWeight: 4n,
1360
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1365
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1361
1366
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1362
- newPubKey: users[5].pubKey,
1367
+ newPublicKey: users[5].publicKey,
1363
1368
  },
1364
1369
  ];
1365
1370
  const messages = votes
@@ -1368,46 +1373,46 @@ describe("e2e tests", function test() {
1368
1373
  maciAddress: maciAddresses.maciContractAddress,
1369
1374
  poll: 2,
1370
1375
  data: message.data.map(String),
1371
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1372
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1376
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1377
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1373
1378
  }));
1374
1379
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 2, maciAddress: maciAddresses.maciContractAddress });
1375
1380
  });
1376
1381
  it("should publish messages to the third poll", async () => {
1377
1382
  await (0, sdk_1.publish)({
1378
- pubkey: users[3].pubKey.serialize(),
1383
+ publicKey: users[3].publicKey.serialize(),
1379
1384
  stateIndex: 3n,
1380
1385
  voteOptionIndex: 5n,
1381
1386
  nonce: 1n,
1382
1387
  pollId: 2n,
1383
1388
  newVoteWeight: 3n,
1384
1389
  maciAddress: maciAddresses.maciContractAddress,
1385
- salt: (0, crypto_1.genRandomSalt)(),
1386
- privateKey: users[3].privKey.serialize(),
1390
+ salt: (0, crypto_1.generateRandomSalt)(),
1391
+ privateKey: users[3].privateKey.serialize(),
1387
1392
  signer,
1388
1393
  });
1389
1394
  await (0, sdk_1.publish)({
1390
- pubkey: users[4].pubKey.serialize(),
1395
+ publicKey: users[4].publicKey.serialize(),
1391
1396
  stateIndex: 4n,
1392
1397
  voteOptionIndex: 7n,
1393
1398
  nonce: 1n,
1394
1399
  pollId: 2n,
1395
1400
  newVoteWeight: 2n,
1396
1401
  maciAddress: maciAddresses.maciContractAddress,
1397
- salt: (0, crypto_1.genRandomSalt)(),
1398
- privateKey: users[4].privKey.serialize(),
1402
+ salt: (0, crypto_1.generateRandomSalt)(),
1403
+ privateKey: users[4].privateKey.serialize(),
1399
1404
  signer,
1400
1405
  });
1401
1406
  await (0, sdk_1.publish)({
1402
- pubkey: users[5].pubKey.serialize(),
1407
+ publicKey: users[5].publicKey.serialize(),
1403
1408
  stateIndex: 5n,
1404
1409
  voteOptionIndex: 5n,
1405
1410
  nonce: 1n,
1406
1411
  pollId: 2n,
1407
1412
  newVoteWeight: 9n,
1408
1413
  maciAddress: maciAddresses.maciContractAddress,
1409
- salt: (0, crypto_1.genRandomSalt)(),
1410
- privateKey: users[5].privKey.serialize(),
1414
+ salt: (0, crypto_1.generateRandomSalt)(),
1415
+ privateKey: users[5].privateKey.serialize(),
1411
1416
  signer,
1412
1417
  });
1413
1418
  });
@@ -1480,6 +1485,12 @@ describe("e2e tests", function test() {
1480
1485
  signer,
1481
1486
  signupPolicyAddress: signupPolicyContractAddress,
1482
1487
  });
1488
+ // we set the verifying keys
1489
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
1490
+ await (0, sdk_1.setVerifyingKeys)({
1491
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
1492
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
1493
+ });
1483
1494
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
1484
1495
  // deploy a poll contract
1485
1496
  await (0, sdk_1.deployPoll)({
@@ -1489,8 +1500,6 @@ describe("e2e tests", function test() {
1489
1500
  pollEndTimestamp: startDate + constants_1.pollDuration,
1490
1501
  relayers: [await signer.getAddress()],
1491
1502
  maciAddress: maciAddresses.maciContractAddress,
1492
- verifierContractAddress,
1493
- vkRegistryContractAddress: vkRegistryAddress,
1494
1503
  policyContractAddress: pollPolicyContractAddress,
1495
1504
  initialVoiceCreditProxyContractAddress,
1496
1505
  });
@@ -1498,7 +1507,7 @@ describe("e2e tests", function test() {
1498
1507
  it("should signup one user", async () => {
1499
1508
  await (0, sdk_1.signup)({
1500
1509
  maciAddress: maciAddresses.maciContractAddress,
1501
- maciPubKey: user.pubKey.serialize(),
1510
+ maciPublicKey: user.publicKey.serialize(),
1502
1511
  sgData: constants_1.DEFAULT_SG_DATA,
1503
1512
  signer,
1504
1513
  });
@@ -1507,13 +1516,12 @@ describe("e2e tests", function test() {
1507
1516
  // joinPoll
1508
1517
  await (0, sdk_1.joinPoll)({
1509
1518
  maciAddress: maciAddresses.maciContractAddress,
1510
- privateKey: user.privKey.serialize(),
1511
- stateIndex: 1n,
1519
+ privateKey: user.privateKey.serialize(),
1512
1520
  pollId: 0n,
1513
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
1514
- useWasm: true,
1521
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
1522
+ useWasm,
1515
1523
  pollWasm: constants_1.testPollJoiningWasmPath,
1516
- pollWitgen: constants_1.testPollJoiningWitnessPath,
1524
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
1517
1525
  rapidsnark: constants_1.testRapidsnarkPath,
1518
1526
  sgDataArg: constants_1.DEFAULT_SG_DATA,
1519
1527
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -1522,15 +1530,15 @@ describe("e2e tests", function test() {
1522
1530
  });
1523
1531
  it("should publish one message", async () => {
1524
1532
  await (0, sdk_1.publish)({
1525
- pubkey: user.pubKey.serialize(),
1533
+ publicKey: user.publicKey.serialize(),
1526
1534
  stateIndex: 1n,
1527
1535
  voteOptionIndex: 5n,
1528
1536
  nonce: 1n,
1529
1537
  pollId: 0n,
1530
1538
  newVoteWeight: 3n,
1531
1539
  maciAddress: maciAddresses.maciContractAddress,
1532
- salt: (0, crypto_1.genRandomSalt)(),
1533
- privateKey: user.privKey.serialize(),
1540
+ salt: (0, crypto_1.generateRandomSalt)(),
1541
+ privateKey: user.privateKey.serialize(),
1534
1542
  signer,
1535
1543
  });
1536
1544
  });
@@ -1539,14 +1547,14 @@ describe("e2e tests", function test() {
1539
1547
  {
1540
1548
  pollId: 0n,
1541
1549
  voteOptionIndex: 5n,
1542
- salt: (0, crypto_1.genRandomSalt)(),
1550
+ salt: (0, crypto_1.generateRandomSalt)(),
1543
1551
  nonce: 1n,
1544
- privateKey: user.privKey,
1552
+ privateKey: user.privateKey,
1545
1553
  stateIndex: 1n,
1546
1554
  voteWeight: 5n,
1547
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1555
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1548
1556
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1549
- newPubKey: user.pubKey,
1557
+ newPublicKey: user.publicKey,
1550
1558
  },
1551
1559
  ];
1552
1560
  const messages = votes
@@ -1555,8 +1563,8 @@ describe("e2e tests", function test() {
1555
1563
  maciAddress: maciAddresses.maciContractAddress,
1556
1564
  poll: 0,
1557
1565
  data: message.data.map(String),
1558
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1559
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1566
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1567
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1560
1568
  }));
1561
1569
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
1562
1570
  });
@@ -1567,7 +1575,7 @@ describe("e2e tests", function test() {
1567
1575
  await (0, sdk_1.generateMaciState)({
1568
1576
  maciAddress: maciAddresses.maciContractAddress,
1569
1577
  outputPath: stateOutPath,
1570
- coordinatorPrivateKey: constants_1.coordinatorPrivKey,
1578
+ coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
1571
1579
  blockPerBatch: 50,
1572
1580
  pollId: 0n,
1573
1581
  signer,