@maci-protocol/testing 0.0.0-ci.ce69388 → 0.0.0-ci.cf2cc5b

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 (51) hide show
  1. package/LICENSE +1 -2
  2. package/build/hardhat.config.js +1 -1
  3. package/build/hardhat.config.js.map +1 -1
  4. package/build/ts/__tests__/e2e.full.test.d.ts +2 -0
  5. package/build/ts/__tests__/e2e.full.test.d.ts.map +1 -0
  6. package/build/ts/__tests__/e2e.full.test.js +842 -0
  7. package/build/ts/__tests__/e2e.full.test.js.map +1 -0
  8. package/build/ts/__tests__/e2e.nonQv.test.js +432 -32
  9. package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
  10. package/build/ts/__tests__/e2e.test.js +183 -172
  11. package/build/ts/__tests__/e2e.test.js.map +1 -1
  12. package/build/ts/__tests__/integration.test.js +55 -57
  13. package/build/ts/__tests__/integration.test.js.map +1 -1
  14. package/build/ts/__tests__/keyChange.test.js +55 -53
  15. package/build/ts/__tests__/keyChange.test.js.map +1 -1
  16. package/build/ts/__tests__/maciKeys.test.js +39 -39
  17. package/build/ts/__tests__/maciKeys.test.js.map +1 -1
  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 +189 -0
  21. package/build/ts/__tests__/stress/stress.full.test.js.map +1 -0
  22. package/build/ts/__tests__/unit/joinPoll.test.js +74 -36
  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 +9 -11
  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 +7 -5
  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 +51 -53
  37. package/build/ts/constants.d.ts.map +1 -1
  38. package/build/ts/constants.js +110 -71
  39. package/build/ts/constants.js.map +1 -1
  40. package/build/ts/testingClass.d.ts +9 -9
  41. package/build/ts/testingClass.d.ts.map +1 -1
  42. package/build/ts/testingClass.js +36 -35
  43. package/build/ts/testingClass.js.map +1 -1
  44. package/build/ts/types.d.ts +12 -13
  45. package/build/ts/types.d.ts.map +1 -1
  46. package/build/ts/utils.d.ts +3 -3
  47. package/build/ts/utils.d.ts.map +1 -1
  48. package/build/ts/utils.js +12 -12
  49. package/build/ts/utils.js.map +1 -1
  50. package/build/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +20 -18
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const contracts_1 = require("@maci-protocol/contracts");
6
7
  const core_1 = require("@maci-protocol/core");
7
8
  const crypto_1 = require("@maci-protocol/crypto");
8
9
  const domainobjs_1 = require("@maci-protocol/domainobjs");
@@ -27,38 +28,33 @@ describe("e2e tests", function test() {
27
28
  const useWasm = (0, sdk_1.isArm)();
28
29
  this.timeout(900000);
29
30
  let maciAddresses;
30
- let vkRegistryAddress;
31
31
  let initialVoiceCreditProxyContractAddress;
32
- let verifierContractAddress;
33
32
  let signer;
33
+ let userSigners;
34
34
  const generateProofsArgs = {
35
35
  outputDir: constants_1.testProofsDirPath,
36
36
  tallyFile: constants_1.testTallyFilePath,
37
- tallyZkey: constants_1.tallyVotesTestZkeyPath,
38
- processZkey: constants_1.processMessageTestZkeyPath,
37
+ voteTallyZkey: constants_1.testTallyVotesZkeyPath,
38
+ messageProcessorZkey: constants_1.testProcessMessageZkeyPath,
39
39
  pollId: 0n,
40
40
  rapidsnark: constants_1.testRapidsnarkPath,
41
- processWitgen: constants_1.testProcessMessagesWitnessPath,
42
- processDatFile: constants_1.testProcessMessagesWitnessDatPath,
43
- tallyWitgen: constants_1.testTallyVotesWitnessPath,
44
- tallyDatFile: constants_1.testTallyVotesWitnessDatPath,
41
+ messageProcessorWitnessGenerator: constants_1.testProcessMessagesWitnessPath,
42
+ messageProcessorWitnessDatFile: constants_1.testProcessMessagesWitnessDatPath,
43
+ voteTallyWitnessGenerator: constants_1.testTallyVotesWitnessPath,
44
+ voteTallyWitnessDatFile: constants_1.testTallyVotesWitnessDatPath,
45
45
  coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
46
- processWasm: constants_1.testProcessMessagesWasmPath,
47
- tallyWasm: constants_1.testTallyVotesWasmPath,
46
+ messageProcessorWasm: constants_1.testProcessMessagesWasmPath,
47
+ voteTallyWasm: constants_1.testTallyVotesWasmPath,
48
48
  useWasm,
49
- useQuadraticVoting: true,
49
+ mode: core_1.EMode.QV,
50
50
  };
51
- // before all tests we deploy the vk registry contract and set the verifying keys
51
+ // before all tests we deploy the verifying keys registry contract and set the verifying keys
52
52
  before(async () => {
53
- 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);
53
+ const signers = await (0, contracts_1.getSigners)();
54
+ [signer, ...userSigners] = signers;
55
+ const constantInitialVoiceCreditProxyFactory = await (0, sdk_1.deployConstantInitialVoiceCreditProxyFactory)(signer, true);
56
+ const initialVoiceCreditProxy = await (0, sdk_1.deployConstantInitialVoiceCreditProxy)({ amount: constants_1.DEFAULT_INITIAL_VOICE_CREDITS }, constantInitialVoiceCreditProxyFactory, signer);
57
57
  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
58
  });
63
59
  describe("2 signups (1 after stateAq is merged and logs are fetched), 1 message", () => {
64
60
  after(async () => {
@@ -76,6 +72,12 @@ describe("e2e tests", function test() {
76
72
  signer,
77
73
  signupPolicyAddress: signupPolicyContractAddress,
78
74
  });
75
+ // we set the verifying keys
76
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
77
+ await (0, sdk_1.setVerifyingKeys)({
78
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
79
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
80
+ });
79
81
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
80
82
  // deploy a poll contract
81
83
  await (0, sdk_1.deployPoll)({
@@ -85,8 +87,6 @@ describe("e2e tests", function test() {
85
87
  pollEndTimestamp: startDate + constants_1.pollDuration,
86
88
  relayers: [await signer.getAddress()],
87
89
  maciAddress: maciAddresses.maciContractAddress,
88
- verifierContractAddress,
89
- vkRegistryContractAddress: vkRegistryAddress,
90
90
  policyContractAddress: pollPolicyContractAddress,
91
91
  initialVoiceCreditProxyContractAddress,
92
92
  });
@@ -96,23 +96,22 @@ describe("e2e tests", function test() {
96
96
  maciAddress: maciAddresses.maciContractAddress,
97
97
  maciPublicKey: user.publicKey.serialize(),
98
98
  sgData: constants_1.DEFAULT_SG_DATA,
99
- signer,
99
+ signer: userSigners[0],
100
100
  });
101
101
  });
102
102
  it("should join one user", async () => {
103
103
  await (0, sdk_1.joinPoll)({
104
104
  maciAddress: maciAddresses.maciContractAddress,
105
105
  privateKey: user.privateKey.serialize(),
106
- stateIndex: 1n,
107
106
  pollId: 0n,
108
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
109
- useWasm: true,
110
- pollWasm: constants_1.testPollJoiningWasmPath,
111
- pollWitgen: constants_1.testPollJoiningWitnessPath,
107
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
108
+ useWasm,
109
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
110
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
112
111
  rapidsnark: constants_1.testRapidsnarkPath,
113
112
  sgDataArg: constants_1.DEFAULT_SG_DATA,
114
113
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
115
- signer,
114
+ signer: userSigners[0],
116
115
  });
117
116
  });
118
117
  it("should publish one message", async () => {
@@ -124,7 +123,7 @@ describe("e2e tests", function test() {
124
123
  pollId: 0n,
125
124
  newVoteWeight: 9n,
126
125
  maciAddress: maciAddresses.maciContractAddress,
127
- salt: (0, crypto_1.genRandomSalt)(),
126
+ salt: (0, crypto_1.generateRandomSalt)(),
128
127
  privateKey: user.privateKey.serialize(),
129
128
  signer,
130
129
  });
@@ -141,7 +140,7 @@ describe("e2e tests", function test() {
141
140
  maciAddress: maciAddresses.maciContractAddress,
142
141
  maciPublicKey: new domainobjs_1.Keypair().publicKey.serialize(),
143
142
  sgData: constants_1.DEFAULT_SG_DATA,
144
- signer,
143
+ signer: userSigners[1],
145
144
  });
146
145
  await (0, sdk_1.proveOnChain)({ ...constants_1.proveOnChainArgs, maciAddress: maciAddresses.maciContractAddress, signer });
147
146
  await (0, sdk_1.verify)({
@@ -167,6 +166,12 @@ describe("e2e tests", function test() {
167
166
  signer,
168
167
  signupPolicyAddress: signupPolicyContractAddress,
169
168
  });
169
+ // we set the verifying keys
170
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
171
+ await (0, sdk_1.setVerifyingKeys)({
172
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
173
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
174
+ });
170
175
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
171
176
  // deploy a poll contract
172
177
  await (0, sdk_1.deployPoll)({
@@ -176,8 +181,6 @@ describe("e2e tests", function test() {
176
181
  pollEndTimestamp: startDate + constants_1.pollDuration,
177
182
  relayers: [await signer.getAddress()],
178
183
  maciAddress: maciAddresses.maciContractAddress,
179
- verifierContractAddress,
180
- vkRegistryContractAddress: vkRegistryAddress,
181
184
  policyContractAddress: pollPolicyContractAddress,
182
185
  initialVoiceCreditProxyContractAddress,
183
186
  });
@@ -190,7 +193,7 @@ describe("e2e tests", function test() {
190
193
  maciAddress: maciAddresses.maciContractAddress,
191
194
  maciPublicKey: users[i].publicKey.serialize(),
192
195
  sgData: constants_1.DEFAULT_SG_DATA,
193
- signer,
196
+ signer: userSigners[i],
194
197
  });
195
198
  }
196
199
  });
@@ -201,16 +204,15 @@ describe("e2e tests", function test() {
201
204
  await (0, sdk_1.joinPoll)({
202
205
  maciAddress: maciAddresses.maciContractAddress,
203
206
  privateKey: users[i].privateKey.serialize(),
204
- stateIndex: BigInt(i + 1),
205
207
  pollId: 0n,
206
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
207
- useWasm: true,
208
- pollWasm: constants_1.testPollJoiningWasmPath,
209
- pollWitgen: constants_1.testPollJoiningWitnessPath,
208
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
209
+ useWasm,
210
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
211
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
210
212
  rapidsnark: constants_1.testRapidsnarkPath,
211
213
  sgDataArg: constants_1.DEFAULT_SG_DATA,
212
214
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
213
- signer,
215
+ signer: userSigners[i],
214
216
  });
215
217
  }
216
218
  });
@@ -223,7 +225,7 @@ describe("e2e tests", function test() {
223
225
  pollId: 0n,
224
226
  newVoteWeight: 4n,
225
227
  maciAddress: maciAddresses.maciContractAddress,
226
- salt: (0, crypto_1.genRandomSalt)(),
228
+ salt: (0, crypto_1.generateRandomSalt)(),
227
229
  privateKey: users[0].privateKey.serialize(),
228
230
  signer,
229
231
  });
@@ -235,7 +237,7 @@ describe("e2e tests", function test() {
235
237
  pollId: 0n,
236
238
  newVoteWeight: 3n,
237
239
  maciAddress: maciAddresses.maciContractAddress,
238
- salt: (0, crypto_1.genRandomSalt)(),
240
+ salt: (0, crypto_1.generateRandomSalt)(),
239
241
  privateKey: users[0].privateKey.serialize(),
240
242
  signer,
241
243
  });
@@ -247,7 +249,7 @@ describe("e2e tests", function test() {
247
249
  pollId: 0n,
248
250
  newVoteWeight: 9n,
249
251
  maciAddress: maciAddresses.maciContractAddress,
250
- salt: (0, crypto_1.genRandomSalt)(),
252
+ salt: (0, crypto_1.generateRandomSalt)(),
251
253
  privateKey: users[0].privateKey.serialize(),
252
254
  signer,
253
255
  });
@@ -259,7 +261,7 @@ describe("e2e tests", function test() {
259
261
  pollId: 0n,
260
262
  newVoteWeight: 9n,
261
263
  maciAddress: maciAddresses.maciContractAddress,
262
- salt: (0, crypto_1.genRandomSalt)(),
264
+ salt: (0, crypto_1.generateRandomSalt)(),
263
265
  privateKey: users[1].privateKey.serialize(),
264
266
  signer,
265
267
  });
@@ -271,7 +273,7 @@ describe("e2e tests", function test() {
271
273
  pollId: 0n,
272
274
  newVoteWeight: 9n,
273
275
  maciAddress: maciAddresses.maciContractAddress,
274
- salt: (0, crypto_1.genRandomSalt)(),
276
+ salt: (0, crypto_1.generateRandomSalt)(),
275
277
  privateKey: users[2].privateKey.serialize(),
276
278
  signer,
277
279
  });
@@ -283,7 +285,7 @@ describe("e2e tests", function test() {
283
285
  pollId: 0n,
284
286
  newVoteWeight: 3n,
285
287
  maciAddress: maciAddresses.maciContractAddress,
286
- salt: (0, crypto_1.genRandomSalt)(),
288
+ salt: (0, crypto_1.generateRandomSalt)(),
287
289
  privateKey: users[3].privateKey.serialize(),
288
290
  signer,
289
291
  });
@@ -295,7 +297,7 @@ describe("e2e tests", function test() {
295
297
  pollId: 0n,
296
298
  newVoteWeight: 2n,
297
299
  maciAddress: maciAddresses.maciContractAddress,
298
- salt: (0, crypto_1.genRandomSalt)(),
300
+ salt: (0, crypto_1.generateRandomSalt)(),
299
301
  privateKey: users[3].privateKey.serialize(),
300
302
  signer,
301
303
  });
@@ -307,7 +309,7 @@ describe("e2e tests", function test() {
307
309
  pollId: 0n,
308
310
  newVoteWeight: 9n,
309
311
  maciAddress: maciAddresses.maciContractAddress,
310
- salt: (0, crypto_1.genRandomSalt)(),
312
+ salt: (0, crypto_1.generateRandomSalt)(),
311
313
  privateKey: users[3].privateKey.serialize(),
312
314
  signer,
313
315
  });
@@ -317,7 +319,7 @@ describe("e2e tests", function test() {
317
319
  {
318
320
  pollId: 0n,
319
321
  voteOptionIndex: 1n,
320
- salt: (0, crypto_1.genRandomSalt)(),
322
+ salt: (0, crypto_1.generateRandomSalt)(),
321
323
  nonce: 2n,
322
324
  privateKey: users[0].privateKey,
323
325
  stateIndex: 1n,
@@ -329,7 +331,7 @@ describe("e2e tests", function test() {
329
331
  {
330
332
  pollId: 0n,
331
333
  voteOptionIndex: 1n,
332
- salt: (0, crypto_1.genRandomSalt)(),
334
+ salt: (0, crypto_1.generateRandomSalt)(),
333
335
  nonce: 2n,
334
336
  privateKey: users[0].privateKey,
335
337
  stateIndex: 1n,
@@ -341,7 +343,7 @@ describe("e2e tests", function test() {
341
343
  {
342
344
  pollId: 0n,
343
345
  voteOptionIndex: 1n,
344
- salt: (0, crypto_1.genRandomSalt)(),
346
+ salt: (0, crypto_1.generateRandomSalt)(),
345
347
  nonce: 1n,
346
348
  privateKey: users[0].privateKey,
347
349
  stateIndex: 1n,
@@ -353,7 +355,7 @@ describe("e2e tests", function test() {
353
355
  {
354
356
  pollId: 0n,
355
357
  voteOptionIndex: 1n,
356
- salt: (0, crypto_1.genRandomSalt)(),
358
+ salt: (0, crypto_1.generateRandomSalt)(),
357
359
  nonce: 1n,
358
360
  privateKey: users[1].privateKey,
359
361
  stateIndex: 2n,
@@ -365,7 +367,7 @@ describe("e2e tests", function test() {
365
367
  {
366
368
  pollId: 0n,
367
369
  voteOptionIndex: 1n,
368
- salt: (0, crypto_1.genRandomSalt)(),
370
+ salt: (0, crypto_1.generateRandomSalt)(),
369
371
  nonce: 1n,
370
372
  privateKey: users[2].privateKey,
371
373
  stateIndex: 3n,
@@ -377,7 +379,7 @@ describe("e2e tests", function test() {
377
379
  {
378
380
  pollId: 0n,
379
381
  voteOptionIndex: 0n,
380
- salt: (0, crypto_1.genRandomSalt)(),
382
+ salt: (0, crypto_1.generateRandomSalt)(),
381
383
  nonce: 3n,
382
384
  privateKey: users[3].privateKey,
383
385
  stateIndex: 4n,
@@ -389,7 +391,7 @@ describe("e2e tests", function test() {
389
391
  {
390
392
  pollId: 0n,
391
393
  voteOptionIndex: 0n,
392
- salt: (0, crypto_1.genRandomSalt)(),
394
+ salt: (0, crypto_1.generateRandomSalt)(),
393
395
  nonce: 2n,
394
396
  privateKey: users[3].privateKey,
395
397
  stateIndex: 4n,
@@ -401,7 +403,7 @@ describe("e2e tests", function test() {
401
403
  {
402
404
  pollId: 0n,
403
405
  voteOptionIndex: 0n,
404
- salt: (0, crypto_1.genRandomSalt)(),
406
+ salt: (0, crypto_1.generateRandomSalt)(),
405
407
  nonce: 1n,
406
408
  privateKey: users[3].privateKey,
407
409
  stateIndex: 4n,
@@ -452,6 +454,12 @@ describe("e2e tests", function test() {
452
454
  signer,
453
455
  signupPolicyAddress: signupPolicyContractAddress,
454
456
  });
457
+ // we set the verifying keys
458
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
459
+ await (0, sdk_1.setVerifyingKeys)({
460
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
461
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
462
+ });
455
463
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
456
464
  // deploy a poll contract
457
465
  await (0, sdk_1.deployPoll)({
@@ -461,8 +469,6 @@ describe("e2e tests", function test() {
461
469
  pollEndTimestamp: startDate + constants_1.pollDuration,
462
470
  relayers: [await signer.getAddress()],
463
471
  maciAddress: maciAddresses.maciContractAddress,
464
- verifierContractAddress,
465
- vkRegistryContractAddress: vkRegistryAddress,
466
472
  policyContractAddress: pollPolicyContractAddress,
467
473
  initialVoiceCreditProxyContractAddress,
468
474
  });
@@ -474,7 +480,7 @@ describe("e2e tests", function test() {
474
480
  maciAddress: maciAddresses.maciContractAddress,
475
481
  maciPublicKey: users[i].publicKey.serialize(),
476
482
  sgData: constants_1.DEFAULT_SG_DATA,
477
- signer,
483
+ signer: userSigners[i],
478
484
  });
479
485
  }
480
486
  });
@@ -483,16 +489,15 @@ describe("e2e tests", function test() {
483
489
  await (0, sdk_1.joinPoll)({
484
490
  maciAddress: maciAddresses.maciContractAddress,
485
491
  privateKey: users[0].privateKey.serialize(),
486
- stateIndex: 1n,
487
492
  pollId: 0n,
488
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
489
- useWasm: true,
490
- pollWasm: constants_1.testPollJoiningWasmPath,
491
- pollWitgen: constants_1.testPollJoiningWitnessPath,
493
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
494
+ useWasm,
495
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
496
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
492
497
  rapidsnark: constants_1.testRapidsnarkPath,
493
498
  sgDataArg: constants_1.DEFAULT_SG_DATA,
494
499
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
495
- signer,
500
+ signer: userSigners[0],
496
501
  });
497
502
  });
498
503
  it("should publish and relay 12 messages with the same nonce", async () => {
@@ -501,7 +506,7 @@ describe("e2e tests", function test() {
501
506
  .map(() => (0, sdk_1.generateVote)({
502
507
  pollId: 0n,
503
508
  voteOptionIndex: 0n,
504
- salt: (0, crypto_1.genRandomSalt)(),
509
+ salt: (0, crypto_1.generateRandomSalt)(),
505
510
  nonce: 1n,
506
511
  privateKey: users[0].privateKey,
507
512
  stateIndex: 1n,
@@ -528,7 +533,7 @@ describe("e2e tests", function test() {
528
533
  pollId: 0n,
529
534
  newVoteWeight: 9n,
530
535
  maciAddress: maciAddresses.maciContractAddress,
531
- salt: (0, crypto_1.genRandomSalt)(),
536
+ salt: (0, crypto_1.generateRandomSalt)(),
532
537
  privateKey: users[0].privateKey.serialize(),
533
538
  signer,
534
539
  });
@@ -564,6 +569,12 @@ describe("e2e tests", function test() {
564
569
  signer,
565
570
  signupPolicyAddress: signupPolicyContractAddress,
566
571
  });
572
+ // we set the verifying keys
573
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
574
+ await (0, sdk_1.setVerifyingKeys)({
575
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
576
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
577
+ });
567
578
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
568
579
  // deploy a poll contract
569
580
  await (0, sdk_1.deployPoll)({
@@ -573,8 +584,6 @@ describe("e2e tests", function test() {
573
584
  pollEndTimestamp: startDate + constants_1.pollDuration,
574
585
  relayers: [await signer.getAddress()],
575
586
  maciAddress: maciAddresses.maciContractAddress,
576
- verifierContractAddress,
577
- vkRegistryContractAddress: vkRegistryAddress,
578
587
  policyContractAddress: pollPolicyContractAddress,
579
588
  initialVoiceCreditProxyContractAddress,
580
589
  });
@@ -587,7 +596,7 @@ describe("e2e tests", function test() {
587
596
  maciAddress: maciAddresses.maciContractAddress,
588
597
  maciPublicKey: users[i].publicKey.serialize(),
589
598
  sgData: constants_1.DEFAULT_SG_DATA,
590
- signer,
599
+ signer: userSigners[i],
591
600
  });
592
601
  }
593
602
  });
@@ -598,16 +607,15 @@ describe("e2e tests", function test() {
598
607
  await (0, sdk_1.joinPoll)({
599
608
  maciAddress: maciAddresses.maciContractAddress,
600
609
  privateKey: users[i].privateKey.serialize(),
601
- stateIndex: BigInt(i + 1),
602
610
  pollId: 0n,
603
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
604
- useWasm: true,
605
- pollWasm: constants_1.testPollJoiningWasmPath,
606
- pollWitgen: constants_1.testPollJoiningWitnessPath,
611
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
612
+ useWasm,
613
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
614
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
607
615
  rapidsnark: constants_1.testRapidsnarkPath,
608
616
  sgDataArg: constants_1.DEFAULT_SG_DATA,
609
617
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
610
- signer,
618
+ signer: userSigners[i],
611
619
  });
612
620
  }
613
621
  });
@@ -623,7 +631,7 @@ describe("e2e tests", function test() {
623
631
  nonce: 1n,
624
632
  pollId: 0n,
625
633
  newVoteWeight: 9n,
626
- salt: (0, crypto_1.genRandomSalt)(),
634
+ salt: (0, crypto_1.generateRandomSalt)(),
627
635
  privateKey: users[i].privateKey.serialize(),
628
636
  signer,
629
637
  });
@@ -657,6 +665,12 @@ describe("e2e tests", function test() {
657
665
  signer,
658
666
  signupPolicyAddress: signupPolicyContractAddress,
659
667
  });
668
+ // we set the verifying keys
669
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
670
+ await (0, sdk_1.setVerifyingKeys)({
671
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
672
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
673
+ });
660
674
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
661
675
  // deploy a poll contract
662
676
  await (0, sdk_1.deployPoll)({
@@ -666,8 +680,6 @@ describe("e2e tests", function test() {
666
680
  pollEndTimestamp: startDate + constants_1.pollDuration,
667
681
  relayers: [await signer.getAddress()],
668
682
  maciAddress: maciAddresses.maciContractAddress,
669
- verifierContractAddress,
670
- vkRegistryContractAddress: vkRegistryAddress,
671
683
  policyContractAddress: pollPolicyContractAddress,
672
684
  initialVoiceCreditProxyContractAddress,
673
685
  });
@@ -680,7 +692,7 @@ describe("e2e tests", function test() {
680
692
  maciAddress: maciAddresses.maciContractAddress,
681
693
  maciPublicKey: users[i].publicKey.serialize(),
682
694
  sgData: constants_1.DEFAULT_SG_DATA,
683
- signer,
695
+ signer: userSigners[i],
684
696
  });
685
697
  }
686
698
  });
@@ -691,16 +703,15 @@ describe("e2e tests", function test() {
691
703
  await (0, sdk_1.joinPoll)({
692
704
  maciAddress: maciAddresses.maciContractAddress,
693
705
  privateKey: users[i].privateKey.serialize(),
694
- stateIndex: BigInt(i + 1),
695
706
  pollId: 0n,
696
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
697
- useWasm: true,
698
- pollWasm: constants_1.testPollJoiningWasmPath,
699
- pollWitgen: constants_1.testPollJoiningWitnessPath,
707
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
708
+ useWasm,
709
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
710
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
700
711
  rapidsnark: constants_1.testRapidsnarkPath,
701
712
  sgDataArg: constants_1.DEFAULT_SG_DATA,
702
713
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
703
- signer,
714
+ signer: userSigners[i],
704
715
  });
705
716
  }
706
717
  });
@@ -711,12 +722,12 @@ describe("e2e tests", function test() {
711
722
  await (0, sdk_1.publish)({
712
723
  maciAddress: maciAddresses.maciContractAddress,
713
724
  publicKey: users[i].publicKey.serialize(),
714
- stateIndex: 1n,
725
+ stateIndex: BigInt(i + 1),
715
726
  voteOptionIndex: 0n,
716
727
  nonce: 1n,
717
728
  pollId: 0n,
718
729
  newVoteWeight: 9n,
719
- salt: (0, crypto_1.genRandomSalt)(),
730
+ salt: (0, crypto_1.generateRandomSalt)(),
720
731
  privateKey: users[i].privateKey.serialize(),
721
732
  signer,
722
733
  });
@@ -727,7 +738,7 @@ describe("e2e tests", function test() {
727
738
  {
728
739
  pollId: 0n,
729
740
  voteOptionIndex: 1n,
730
- salt: (0, crypto_1.genRandomSalt)(),
741
+ salt: (0, crypto_1.generateRandomSalt)(),
731
742
  nonce: 2n,
732
743
  privateKey: users[0].privateKey,
733
744
  stateIndex: 1n,
@@ -739,7 +750,7 @@ describe("e2e tests", function test() {
739
750
  {
740
751
  pollId: 0n,
741
752
  voteOptionIndex: 2n,
742
- salt: (0, crypto_1.genRandomSalt)(),
753
+ salt: (0, crypto_1.generateRandomSalt)(),
743
754
  nonce: 3n,
744
755
  privateKey: users[2].privateKey,
745
756
  stateIndex: 3n,
@@ -751,7 +762,7 @@ describe("e2e tests", function test() {
751
762
  {
752
763
  pollId: 0n,
753
764
  voteOptionIndex: 3n,
754
- salt: (0, crypto_1.genRandomSalt)(),
765
+ salt: (0, crypto_1.generateRandomSalt)(),
755
766
  nonce: 3n,
756
767
  privateKey: users[3].privateKey,
757
768
  stateIndex: 4n,
@@ -802,6 +813,12 @@ describe("e2e tests", function test() {
802
813
  signer,
803
814
  signupPolicyAddress: signupPolicyContractAddress,
804
815
  });
816
+ // we set the verifying keys
817
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
818
+ await (0, sdk_1.setVerifyingKeys)({
819
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
820
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
821
+ });
805
822
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
806
823
  // deploy a poll contract
807
824
  await (0, sdk_1.deployPoll)({
@@ -811,8 +828,6 @@ describe("e2e tests", function test() {
811
828
  pollEndTimestamp: startDate + constants_1.pollDuration,
812
829
  relayers: [await signer.getAddress()],
813
830
  maciAddress: maciAddresses.maciContractAddress,
814
- verifierContractAddress,
815
- vkRegistryContractAddress: vkRegistryAddress,
816
831
  policyContractAddress: pollPolicyContractAddress,
817
832
  initialVoiceCreditProxyContractAddress,
818
833
  });
@@ -821,22 +836,21 @@ describe("e2e tests", function test() {
821
836
  maciAddress: maciAddresses.maciContractAddress,
822
837
  maciPublicKey: users[0].publicKey.serialize(),
823
838
  sgData: constants_1.DEFAULT_SG_DATA,
824
- signer,
839
+ signer: userSigners[0],
825
840
  });
826
841
  // joinPoll
827
842
  await (0, sdk_1.joinPoll)({
828
843
  maciAddress: maciAddresses.maciContractAddress,
829
844
  privateKey: users[0].privateKey.serialize(),
830
- stateIndex: 1n,
831
845
  pollId: 0n,
832
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
833
- useWasm: true,
834
- pollWasm: constants_1.testPollJoiningWasmPath,
835
- pollWitgen: constants_1.testPollJoiningWitnessPath,
846
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
847
+ useWasm,
848
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
849
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
836
850
  rapidsnark: constants_1.testRapidsnarkPath,
837
851
  sgDataArg: constants_1.DEFAULT_SG_DATA,
838
852
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
839
- signer,
853
+ signer: userSigners[0],
840
854
  });
841
855
  // publish
842
856
  await (0, sdk_1.publish)({
@@ -847,7 +861,7 @@ describe("e2e tests", function test() {
847
861
  pollId: 0n,
848
862
  newVoteWeight: 9n,
849
863
  maciAddress: maciAddresses.maciContractAddress,
850
- salt: (0, crypto_1.genRandomSalt)(),
864
+ salt: (0, crypto_1.generateRandomSalt)(),
851
865
  privateKey: users[0].privateKey.serialize(),
852
866
  signer,
853
867
  });
@@ -855,34 +869,33 @@ describe("e2e tests", function test() {
855
869
  maciAddress: maciAddresses.maciContractAddress,
856
870
  maciPublicKey: users[1].publicKey.serialize(),
857
871
  sgData: constants_1.DEFAULT_SG_DATA,
858
- signer,
872
+ signer: userSigners[1],
859
873
  });
860
874
  await (0, sdk_1.signup)({
861
875
  maciAddress: maciAddresses.maciContractAddress,
862
876
  maciPublicKey: users[2].publicKey.serialize(),
863
877
  sgData: constants_1.DEFAULT_SG_DATA,
864
- signer,
878
+ signer: userSigners[2],
865
879
  });
866
880
  // joinPoll
867
881
  await (0, sdk_1.joinPoll)({
868
882
  maciAddress: maciAddresses.maciContractAddress,
869
883
  privateKey: users[1].privateKey.serialize(),
870
- stateIndex: 2n,
871
884
  pollId: 0n,
872
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
873
- useWasm: true,
874
- pollWasm: constants_1.testPollJoiningWasmPath,
875
- pollWitgen: constants_1.testPollJoiningWitnessPath,
885
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
886
+ useWasm,
887
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
888
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
876
889
  rapidsnark: constants_1.testRapidsnarkPath,
877
890
  sgDataArg: constants_1.DEFAULT_SG_DATA,
878
891
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
879
- signer,
892
+ signer: userSigners[1],
880
893
  });
881
894
  const votes = [
882
895
  {
883
896
  pollId: 0n,
884
897
  voteOptionIndex: 0n,
885
- salt: (0, crypto_1.genRandomSalt)(),
898
+ salt: (0, crypto_1.generateRandomSalt)(),
886
899
  nonce: 1n,
887
900
  privateKey: users[1].privateKey,
888
901
  stateIndex: 2n,
@@ -929,8 +942,6 @@ describe("e2e tests", function test() {
929
942
  pollEndTimestamp: startDate + constants_1.pollDuration,
930
943
  relayers: [await signer.getAddress()],
931
944
  maciAddress: maciAddresses.maciContractAddress,
932
- verifierContractAddress,
933
- vkRegistryContractAddress: vkRegistryAddress,
934
945
  policyContractAddress: pollPolicyContractAddress,
935
946
  initialVoiceCreditProxyContractAddress,
936
947
  });
@@ -940,13 +951,13 @@ describe("e2e tests", function test() {
940
951
  maciAddress: maciAddresses.maciContractAddress,
941
952
  maciPublicKey: users[3].publicKey.serialize(),
942
953
  sgData: constants_1.DEFAULT_SG_DATA,
943
- signer,
954
+ signer: userSigners[3],
944
955
  });
945
956
  await (0, sdk_1.signup)({
946
957
  maciAddress: maciAddresses.maciContractAddress,
947
958
  maciPublicKey: users[4].publicKey.serialize(),
948
959
  sgData: constants_1.DEFAULT_SG_DATA,
949
- signer,
960
+ signer: userSigners[4],
950
961
  });
951
962
  });
952
963
  it("should join users", async () => {
@@ -954,31 +965,29 @@ describe("e2e tests", function test() {
954
965
  await (0, sdk_1.joinPoll)({
955
966
  maciAddress: maciAddresses.maciContractAddress,
956
967
  privateKey: users[3].privateKey.serialize(),
957
- stateIndex: 4n,
958
968
  pollId: 1n,
959
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
960
- useWasm: true,
961
- pollWasm: constants_1.testPollJoiningWasmPath,
962
- pollWitgen: constants_1.testPollJoiningWitnessPath,
969
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
970
+ useWasm,
971
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
972
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
963
973
  rapidsnark: constants_1.testRapidsnarkPath,
964
974
  sgDataArg: constants_1.DEFAULT_SG_DATA,
965
975
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
966
- signer,
976
+ signer: userSigners[3],
967
977
  });
968
978
  // joinPoll
969
979
  await (0, sdk_1.joinPoll)({
970
980
  maciAddress: maciAddresses.maciContractAddress,
971
981
  privateKey: users[4].privateKey.serialize(),
972
- stateIndex: 5n,
973
982
  pollId: 1n,
974
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
975
- useWasm: true,
976
- pollWasm: constants_1.testPollJoiningWasmPath,
977
- pollWitgen: constants_1.testPollJoiningWitnessPath,
983
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
984
+ useWasm,
985
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
986
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
978
987
  rapidsnark: constants_1.testRapidsnarkPath,
979
988
  sgDataArg: constants_1.DEFAULT_SG_DATA,
980
989
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
981
- signer,
990
+ signer: userSigners[4],
982
991
  });
983
992
  });
984
993
  it("should relay new messages", async () => {
@@ -986,7 +995,7 @@ describe("e2e tests", function test() {
986
995
  {
987
996
  pollId: 1n,
988
997
  voteOptionIndex: 1n,
989
- salt: (0, crypto_1.genRandomSalt)(),
998
+ salt: (0, crypto_1.generateRandomSalt)(),
990
999
  nonce: 1n,
991
1000
  privateKey: users[0].privateKey,
992
1001
  stateIndex: 1n,
@@ -998,7 +1007,7 @@ describe("e2e tests", function test() {
998
1007
  {
999
1008
  pollId: 1n,
1000
1009
  voteOptionIndex: 0n,
1001
- salt: (0, crypto_1.genRandomSalt)(),
1010
+ salt: (0, crypto_1.generateRandomSalt)(),
1002
1011
  nonce: 1n,
1003
1012
  privateKey: users[1].privateKey,
1004
1013
  stateIndex: 1n,
@@ -1028,7 +1037,7 @@ describe("e2e tests", function test() {
1028
1037
  pollId: 1n,
1029
1038
  newVoteWeight: 7n,
1030
1039
  maciAddress: maciAddresses.maciContractAddress,
1031
- salt: (0, crypto_1.genRandomSalt)(),
1040
+ salt: (0, crypto_1.generateRandomSalt)(),
1032
1041
  privateKey: users[0].privateKey.serialize(),
1033
1042
  signer,
1034
1043
  });
@@ -1042,7 +1051,7 @@ describe("e2e tests", function test() {
1042
1051
  pollId: 1n,
1043
1052
  newVoteWeight: 7n,
1044
1053
  maciAddress: maciAddresses.maciContractAddress,
1045
- salt: (0, crypto_1.genRandomSalt)(),
1054
+ salt: (0, crypto_1.generateRandomSalt)(),
1046
1055
  privateKey: users[1].privateKey.serialize(),
1047
1056
  signer,
1048
1057
  });
@@ -1084,6 +1093,12 @@ describe("e2e tests", function test() {
1084
1093
  signer,
1085
1094
  signupPolicyAddress: signupPolicyContractAddress,
1086
1095
  });
1096
+ // we set the verifying keys
1097
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
1098
+ await (0, sdk_1.setVerifyingKeys)({
1099
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
1100
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
1101
+ });
1087
1102
  });
1088
1103
  it("should run the first poll", async () => {
1089
1104
  const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
@@ -1097,8 +1112,6 @@ describe("e2e tests", function test() {
1097
1112
  pollEndTimestamp: startDate + constants_1.pollDuration,
1098
1113
  relayers: [await signer.getAddress()],
1099
1114
  maciAddress: maciAddresses.maciContractAddress,
1100
- verifierContractAddress,
1101
- vkRegistryContractAddress: vkRegistryAddress,
1102
1115
  policyContractAddress: pollPolicyContractAddress,
1103
1116
  initialVoiceCreditProxyContractAddress,
1104
1117
  });
@@ -1110,7 +1123,7 @@ describe("e2e tests", function test() {
1110
1123
  maciAddress: maciAddresses.maciContractAddress,
1111
1124
  maciPublicKey: users[i].publicKey.serialize(),
1112
1125
  sgData: constants_1.DEFAULT_SG_DATA,
1113
- signer,
1126
+ signer: userSigners[i],
1114
1127
  });
1115
1128
  // eslint-disable-next-line no-await-in-loop
1116
1129
  const { isRegistered, stateIndex } = await (0, sdk_1.getSignedupUserData)({
@@ -1128,16 +1141,15 @@ describe("e2e tests", function test() {
1128
1141
  await (0, sdk_1.joinPoll)({
1129
1142
  maciAddress: maciAddresses.maciContractAddress,
1130
1143
  privateKey: users[i].privateKey.serialize(),
1131
- stateIndex: BigInt(i + 1),
1132
1144
  pollId: 0n,
1133
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
1134
- useWasm: true,
1135
- pollWasm: constants_1.testPollJoiningWasmPath,
1136
- pollWitgen: constants_1.testPollJoiningWitnessPath,
1145
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
1146
+ useWasm,
1147
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
1148
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
1137
1149
  rapidsnark: constants_1.testRapidsnarkPath,
1138
1150
  sgDataArg: constants_1.DEFAULT_SG_DATA,
1139
1151
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
1140
- signer,
1152
+ signer: userSigners[i],
1141
1153
  });
1142
1154
  // eslint-disable-next-line no-await-in-loop
1143
1155
  const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
@@ -1159,7 +1171,7 @@ describe("e2e tests", function test() {
1159
1171
  pollId: 0n,
1160
1172
  newVoteWeight: 9n,
1161
1173
  maciAddress: maciAddresses.maciContractAddress,
1162
- salt: (0, crypto_1.genRandomSalt)(),
1174
+ salt: (0, crypto_1.generateRandomSalt)(),
1163
1175
  privateKey: users[0].privateKey.serialize(),
1164
1176
  signer,
1165
1177
  });
@@ -1167,7 +1179,7 @@ describe("e2e tests", function test() {
1167
1179
  {
1168
1180
  pollId: 0n,
1169
1181
  voteOptionIndex: 0n,
1170
- salt: (0, crypto_1.genRandomSalt)(),
1182
+ salt: (0, crypto_1.generateRandomSalt)(),
1171
1183
  nonce: 1n,
1172
1184
  privateKey: users[0].privateKey,
1173
1185
  stateIndex: 1n,
@@ -1215,8 +1227,6 @@ describe("e2e tests", function test() {
1215
1227
  pollEndTimestamp: startDate + constants_1.pollDuration,
1216
1228
  relayers: [await signer.getAddress()],
1217
1229
  maciAddress: maciAddresses.maciContractAddress,
1218
- verifierContractAddress,
1219
- vkRegistryContractAddress: vkRegistryAddress,
1220
1230
  policyContractAddress: pollPolicyContractAddress,
1221
1231
  initialVoiceCreditProxyContractAddress,
1222
1232
  });
@@ -1232,8 +1242,6 @@ describe("e2e tests", function test() {
1232
1242
  pollEndTimestamp: startDate + constants_1.pollDuration,
1233
1243
  relayers: [await signer.getAddress()],
1234
1244
  maciAddress: maciAddresses.maciContractAddress,
1235
- verifierContractAddress,
1236
- vkRegistryContractAddress: vkRegistryAddress,
1237
1245
  policyContractAddress: pollPolicyContractAddress,
1238
1246
  initialVoiceCreditProxyContractAddress,
1239
1247
  });
@@ -1241,27 +1249,27 @@ describe("e2e tests", function test() {
1241
1249
  });
1242
1250
  it("join the second and third polls", async () => {
1243
1251
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
1244
- for (let p = 1; p <= 2; p += 1) {
1252
+ for (let pollId = 1; pollId <= 2; pollId += 1) {
1253
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
1245
1254
  for (let i = 0; i < users.length; i += 1) {
1246
1255
  // eslint-disable-next-line no-await-in-loop
1247
1256
  await (0, sdk_1.joinPoll)({
1248
1257
  maciAddress: maciAddresses.maciContractAddress,
1249
1258
  privateKey: users[i].privateKey.serialize(),
1250
- stateIndex: BigInt(i + 1),
1251
- pollId: BigInt(p),
1252
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
1253
- useWasm: true,
1254
- pollWasm: constants_1.testPollJoiningWasmPath,
1255
- pollWitgen: constants_1.testPollJoiningWitnessPath,
1259
+ pollId: BigInt(pollId),
1260
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
1261
+ useWasm,
1262
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
1263
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
1256
1264
  rapidsnark: constants_1.testRapidsnarkPath,
1257
1265
  sgDataArg: constants_1.DEFAULT_SG_DATA,
1258
1266
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
1259
- signer,
1267
+ signer: userSigners[i],
1260
1268
  });
1261
1269
  // eslint-disable-next-line no-await-in-loop
1262
1270
  const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
1263
1271
  maciAddress: maciAddresses.maciContractAddress,
1264
- pollId: BigInt(p),
1272
+ pollId: BigInt(pollId),
1265
1273
  pollPublicKey: users[i].publicKey.serialize(),
1266
1274
  signer,
1267
1275
  startBlock: 0,
@@ -1280,7 +1288,7 @@ describe("e2e tests", function test() {
1280
1288
  pollId: 1n,
1281
1289
  newVoteWeight: 9n,
1282
1290
  maciAddress: maciAddresses.maciContractAddress,
1283
- salt: (0, crypto_1.genRandomSalt)(),
1291
+ salt: (0, crypto_1.generateRandomSalt)(),
1284
1292
  privateKey: users[0].privateKey.serialize(),
1285
1293
  signer,
1286
1294
  });
@@ -1292,7 +1300,7 @@ describe("e2e tests", function test() {
1292
1300
  pollId: 1n,
1293
1301
  newVoteWeight: 1n,
1294
1302
  maciAddress: maciAddresses.maciContractAddress,
1295
- salt: (0, crypto_1.genRandomSalt)(),
1303
+ salt: (0, crypto_1.generateRandomSalt)(),
1296
1304
  privateKey: users[1].privateKey.serialize(),
1297
1305
  signer,
1298
1306
  });
@@ -1304,7 +1312,7 @@ describe("e2e tests", function test() {
1304
1312
  pollId: 1n,
1305
1313
  newVoteWeight: 3n,
1306
1314
  maciAddress: maciAddresses.maciContractAddress,
1307
- salt: (0, crypto_1.genRandomSalt)(),
1315
+ salt: (0, crypto_1.generateRandomSalt)(),
1308
1316
  privateKey: users[2].privateKey.serialize(),
1309
1317
  signer,
1310
1318
  });
@@ -1314,7 +1322,7 @@ describe("e2e tests", function test() {
1314
1322
  {
1315
1323
  pollId: 1n,
1316
1324
  voteOptionIndex: 0n,
1317
- salt: (0, crypto_1.genRandomSalt)(),
1325
+ salt: (0, crypto_1.generateRandomSalt)(),
1318
1326
  nonce: 1n,
1319
1327
  privateKey: users[0].privateKey,
1320
1328
  stateIndex: 1n,
@@ -1340,7 +1348,7 @@ describe("e2e tests", function test() {
1340
1348
  {
1341
1349
  pollId: 2n,
1342
1350
  voteOptionIndex: 7n,
1343
- salt: (0, crypto_1.genRandomSalt)(),
1351
+ salt: (0, crypto_1.generateRandomSalt)(),
1344
1352
  nonce: 1n,
1345
1353
  privateKey: users[4].privateKey,
1346
1354
  stateIndex: 4n,
@@ -1352,7 +1360,7 @@ describe("e2e tests", function test() {
1352
1360
  {
1353
1361
  pollId: 2n,
1354
1362
  voteOptionIndex: 5n,
1355
- salt: (0, crypto_1.genRandomSalt)(),
1363
+ salt: (0, crypto_1.generateRandomSalt)(),
1356
1364
  nonce: 1n,
1357
1365
  privateKey: users[5].privateKey,
1358
1366
  stateIndex: 5n,
@@ -1382,7 +1390,7 @@ describe("e2e tests", function test() {
1382
1390
  pollId: 2n,
1383
1391
  newVoteWeight: 3n,
1384
1392
  maciAddress: maciAddresses.maciContractAddress,
1385
- salt: (0, crypto_1.genRandomSalt)(),
1393
+ salt: (0, crypto_1.generateRandomSalt)(),
1386
1394
  privateKey: users[3].privateKey.serialize(),
1387
1395
  signer,
1388
1396
  });
@@ -1394,7 +1402,7 @@ describe("e2e tests", function test() {
1394
1402
  pollId: 2n,
1395
1403
  newVoteWeight: 2n,
1396
1404
  maciAddress: maciAddresses.maciContractAddress,
1397
- salt: (0, crypto_1.genRandomSalt)(),
1405
+ salt: (0, crypto_1.generateRandomSalt)(),
1398
1406
  privateKey: users[4].privateKey.serialize(),
1399
1407
  signer,
1400
1408
  });
@@ -1406,7 +1414,7 @@ describe("e2e tests", function test() {
1406
1414
  pollId: 2n,
1407
1415
  newVoteWeight: 9n,
1408
1416
  maciAddress: maciAddresses.maciContractAddress,
1409
- salt: (0, crypto_1.genRandomSalt)(),
1417
+ salt: (0, crypto_1.generateRandomSalt)(),
1410
1418
  privateKey: users[5].privateKey.serialize(),
1411
1419
  signer,
1412
1420
  });
@@ -1480,6 +1488,12 @@ describe("e2e tests", function test() {
1480
1488
  signer,
1481
1489
  signupPolicyAddress: signupPolicyContractAddress,
1482
1490
  });
1491
+ // we set the verifying keys
1492
+ const { verifyingKeysRegistryContractAddress } = maciAddresses;
1493
+ await (0, sdk_1.setVerifyingKeys)({
1494
+ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
1495
+ verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
1496
+ });
1483
1497
  const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
1484
1498
  // deploy a poll contract
1485
1499
  await (0, sdk_1.deployPoll)({
@@ -1489,8 +1503,6 @@ describe("e2e tests", function test() {
1489
1503
  pollEndTimestamp: startDate + constants_1.pollDuration,
1490
1504
  relayers: [await signer.getAddress()],
1491
1505
  maciAddress: maciAddresses.maciContractAddress,
1492
- verifierContractAddress,
1493
- vkRegistryContractAddress: vkRegistryAddress,
1494
1506
  policyContractAddress: pollPolicyContractAddress,
1495
1507
  initialVoiceCreditProxyContractAddress,
1496
1508
  });
@@ -1508,12 +1520,11 @@ describe("e2e tests", function test() {
1508
1520
  await (0, sdk_1.joinPoll)({
1509
1521
  maciAddress: maciAddresses.maciContractAddress,
1510
1522
  privateKey: user.privateKey.serialize(),
1511
- stateIndex: 1n,
1512
1523
  pollId: 0n,
1513
- pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
1514
- useWasm: true,
1515
- pollWasm: constants_1.testPollJoiningWasmPath,
1516
- pollWitgen: constants_1.testPollJoiningWitnessPath,
1524
+ pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
1525
+ useWasm,
1526
+ pollJoiningWasm: constants_1.testPollJoiningWasmPath,
1527
+ pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
1517
1528
  rapidsnark: constants_1.testRapidsnarkPath,
1518
1529
  sgDataArg: constants_1.DEFAULT_SG_DATA,
1519
1530
  ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
@@ -1529,7 +1540,7 @@ describe("e2e tests", function test() {
1529
1540
  pollId: 0n,
1530
1541
  newVoteWeight: 3n,
1531
1542
  maciAddress: maciAddresses.maciContractAddress,
1532
- salt: (0, crypto_1.genRandomSalt)(),
1543
+ salt: (0, crypto_1.generateRandomSalt)(),
1533
1544
  privateKey: user.privateKey.serialize(),
1534
1545
  signer,
1535
1546
  });
@@ -1539,7 +1550,7 @@ describe("e2e tests", function test() {
1539
1550
  {
1540
1551
  pollId: 0n,
1541
1552
  voteOptionIndex: 5n,
1542
- salt: (0, crypto_1.genRandomSalt)(),
1553
+ salt: (0, crypto_1.generateRandomSalt)(),
1543
1554
  nonce: 1n,
1544
1555
  privateKey: user.privateKey,
1545
1556
  stateIndex: 1n,