@maci-protocol/testing 0.0.0-ci.cf26211 → 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 (55) 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 +442 -42
  9. package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
  10. package/build/ts/__tests__/e2e.test.js +337 -326
  11. package/build/ts/__tests__/e2e.test.js.map +1 -1
  12. package/build/ts/__tests__/integration.test.js +73 -75
  13. package/build/ts/__tests__/integration.test.js.map +1 -1
  14. package/build/ts/__tests__/keyChange.test.js +88 -86
  15. package/build/ts/__tests__/keyChange.test.js.map +1 -1
  16. package/build/ts/__tests__/maciKeys.test.js +41 -41
  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 +75 -37
  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 +53 -55
  37. package/build/ts/constants.d.ts.map +1 -1
  38. package/build/ts/constants.js +113 -74
  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 +39 -38
  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/user.d.ts +2 -2
  47. package/build/ts/user.d.ts.map +1 -1
  48. package/build/ts/user.js +1 -1
  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 +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,
45
- coordinatorPrivateKey: constants_1.coordinatorPrivKey,
46
- processWasm: constants_1.testProcessMessagesWasmPath,
47
- tallyWasm: constants_1.testTallyVotesWasmPath,
41
+ messageProcessorWitnessGenerator: constants_1.testProcessMessagesWitnessPath,
42
+ messageProcessorWitnessDatFile: constants_1.testProcessMessagesWitnessDatPath,
43
+ voteTallyWitnessGenerator: constants_1.testTallyVotesWitnessPath,
44
+ voteTallyWitnessDatFile: constants_1.testTallyVotesWitnessDatPath,
45
+ coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
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
  });
@@ -94,38 +94,37 @@ describe("e2e tests", function test() {
94
94
  it("should signup one user", async () => {
95
95
  await (0, sdk_1.signup)({
96
96
  maciAddress: maciAddresses.maciContractAddress,
97
- maciPubKey: user.pubKey.serialize(),
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
- privateKey: user.privKey.serialize(),
106
- stateIndex: 1n,
105
+ privateKey: user.privateKey.serialize(),
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 () => {
119
118
  await (0, sdk_1.publish)({
120
- pubkey: user.pubKey.serialize(),
119
+ publicKey: user.publicKey.serialize(),
121
120
  stateIndex: 1n,
122
121
  voteOptionIndex: 0n,
123
122
  nonce: 1n,
124
123
  pollId: 0n,
125
124
  newVoteWeight: 9n,
126
125
  maciAddress: maciAddresses.maciContractAddress,
127
- salt: (0, crypto_1.genRandomSalt)(),
128
- privateKey: user.privKey.serialize(),
126
+ salt: (0, crypto_1.generateRandomSalt)(),
127
+ privateKey: user.privateKey.serialize(),
129
128
  signer,
130
129
  });
131
130
  });
@@ -139,9 +138,9 @@ describe("e2e tests", function test() {
139
138
  });
140
139
  await (0, sdk_1.signup)({
141
140
  maciAddress: maciAddresses.maciContractAddress,
142
- maciPubKey: new domainobjs_1.Keypair().pubKey.serialize(),
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
  });
@@ -188,9 +191,9 @@ describe("e2e tests", function test() {
188
191
  // eslint-disable-next-line no-await-in-loop
189
192
  await (0, sdk_1.signup)({
190
193
  maciAddress: maciAddresses.maciContractAddress,
191
- maciPubKey: users[i].pubKey.serialize(),
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
  });
@@ -200,115 +203,114 @@ describe("e2e tests", function test() {
200
203
  // eslint-disable-next-line no-await-in-loop
201
204
  await (0, sdk_1.joinPoll)({
202
205
  maciAddress: maciAddresses.maciContractAddress,
203
- privateKey: users[i].privKey.serialize(),
204
- stateIndex: BigInt(i + 1),
206
+ privateKey: users[i].privateKey.serialize(),
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
  });
217
219
  it("should publish eight messages", async () => {
218
220
  await (0, sdk_1.publish)({
219
- pubkey: users[0].pubKey.serialize(),
221
+ publicKey: users[0].publicKey.serialize(),
220
222
  stateIndex: 1n,
221
223
  voteOptionIndex: 0n,
222
224
  nonce: 2n,
223
225
  pollId: 0n,
224
226
  newVoteWeight: 4n,
225
227
  maciAddress: maciAddresses.maciContractAddress,
226
- salt: (0, crypto_1.genRandomSalt)(),
227
- privateKey: users[0].privKey.serialize(),
228
+ salt: (0, crypto_1.generateRandomSalt)(),
229
+ privateKey: users[0].privateKey.serialize(),
228
230
  signer,
229
231
  });
230
232
  await (0, sdk_1.publish)({
231
- pubkey: users[0].pubKey.serialize(),
233
+ publicKey: users[0].publicKey.serialize(),
232
234
  stateIndex: 1n,
233
235
  voteOptionIndex: 0n,
234
236
  nonce: 2n,
235
237
  pollId: 0n,
236
238
  newVoteWeight: 3n,
237
239
  maciAddress: maciAddresses.maciContractAddress,
238
- salt: (0, crypto_1.genRandomSalt)(),
239
- privateKey: users[0].privKey.serialize(),
240
+ salt: (0, crypto_1.generateRandomSalt)(),
241
+ privateKey: users[0].privateKey.serialize(),
240
242
  signer,
241
243
  });
242
244
  await (0, sdk_1.publish)({
243
- pubkey: users[0].pubKey.serialize(),
245
+ publicKey: users[0].publicKey.serialize(),
244
246
  stateIndex: 1n,
245
247
  voteOptionIndex: 0n,
246
248
  nonce: 1n,
247
249
  pollId: 0n,
248
250
  newVoteWeight: 9n,
249
251
  maciAddress: maciAddresses.maciContractAddress,
250
- salt: (0, crypto_1.genRandomSalt)(),
251
- privateKey: users[0].privKey.serialize(),
252
+ salt: (0, crypto_1.generateRandomSalt)(),
253
+ privateKey: users[0].privateKey.serialize(),
252
254
  signer,
253
255
  });
254
256
  await (0, sdk_1.publish)({
255
- pubkey: users[1].pubKey.serialize(),
257
+ publicKey: users[1].publicKey.serialize(),
256
258
  stateIndex: 2n,
257
259
  voteOptionIndex: 2n,
258
260
  nonce: 1n,
259
261
  pollId: 0n,
260
262
  newVoteWeight: 9n,
261
263
  maciAddress: maciAddresses.maciContractAddress,
262
- salt: (0, crypto_1.genRandomSalt)(),
263
- privateKey: users[1].privKey.serialize(),
264
+ salt: (0, crypto_1.generateRandomSalt)(),
265
+ privateKey: users[1].privateKey.serialize(),
264
266
  signer,
265
267
  });
266
268
  await (0, sdk_1.publish)({
267
- pubkey: users[2].pubKey.serialize(),
269
+ publicKey: users[2].publicKey.serialize(),
268
270
  stateIndex: 3n,
269
271
  voteOptionIndex: 2n,
270
272
  nonce: 1n,
271
273
  pollId: 0n,
272
274
  newVoteWeight: 9n,
273
275
  maciAddress: maciAddresses.maciContractAddress,
274
- salt: (0, crypto_1.genRandomSalt)(),
275
- privateKey: users[2].privKey.serialize(),
276
+ salt: (0, crypto_1.generateRandomSalt)(),
277
+ privateKey: users[2].privateKey.serialize(),
276
278
  signer,
277
279
  });
278
280
  await (0, sdk_1.publish)({
279
- pubkey: users[3].pubKey.serialize(),
281
+ publicKey: users[3].publicKey.serialize(),
280
282
  stateIndex: 4n,
281
283
  voteOptionIndex: 2n,
282
284
  nonce: 3n,
283
285
  pollId: 0n,
284
286
  newVoteWeight: 3n,
285
287
  maciAddress: maciAddresses.maciContractAddress,
286
- salt: (0, crypto_1.genRandomSalt)(),
287
- privateKey: users[3].privKey.serialize(),
288
+ salt: (0, crypto_1.generateRandomSalt)(),
289
+ privateKey: users[3].privateKey.serialize(),
288
290
  signer,
289
291
  });
290
292
  await (0, sdk_1.publish)({
291
- pubkey: users[3].pubKey.serialize(),
293
+ publicKey: users[3].publicKey.serialize(),
292
294
  stateIndex: 4n,
293
295
  voteOptionIndex: 2n,
294
296
  nonce: 2n,
295
297
  pollId: 0n,
296
298
  newVoteWeight: 2n,
297
299
  maciAddress: maciAddresses.maciContractAddress,
298
- salt: (0, crypto_1.genRandomSalt)(),
299
- privateKey: users[3].privKey.serialize(),
300
+ salt: (0, crypto_1.generateRandomSalt)(),
301
+ privateKey: users[3].privateKey.serialize(),
300
302
  signer,
301
303
  });
302
304
  await (0, sdk_1.publish)({
303
- pubkey: users[3].pubKey.serialize(),
305
+ publicKey: users[3].publicKey.serialize(),
304
306
  stateIndex: 4n,
305
307
  voteOptionIndex: 1n,
306
308
  nonce: 1n,
307
309
  pollId: 0n,
308
310
  newVoteWeight: 9n,
309
311
  maciAddress: maciAddresses.maciContractAddress,
310
- salt: (0, crypto_1.genRandomSalt)(),
311
- privateKey: users[3].privKey.serialize(),
312
+ salt: (0, crypto_1.generateRandomSalt)(),
313
+ privateKey: users[3].privateKey.serialize(),
312
314
  signer,
313
315
  });
314
316
  });
@@ -317,98 +319,98 @@ 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
- privateKey: users[0].privKey,
324
+ privateKey: users[0].privateKey,
323
325
  stateIndex: 1n,
324
326
  voteWeight: 4n,
325
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
327
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
326
328
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
327
- newPubKey: users[0].pubKey,
329
+ newPublicKey: users[0].publicKey,
328
330
  },
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
- privateKey: users[0].privKey,
336
+ privateKey: users[0].privateKey,
335
337
  stateIndex: 1n,
336
338
  voteWeight: 3n,
337
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
339
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
338
340
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
339
- newPubKey: users[0].pubKey,
341
+ newPublicKey: users[0].publicKey,
340
342
  },
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
- privateKey: users[0].privKey,
348
+ privateKey: users[0].privateKey,
347
349
  stateIndex: 1n,
348
350
  voteWeight: 9n,
349
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
351
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
350
352
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
351
- newPubKey: users[0].pubKey,
353
+ newPublicKey: users[0].publicKey,
352
354
  },
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
- privateKey: users[1].privKey,
360
+ privateKey: users[1].privateKey,
359
361
  stateIndex: 2n,
360
362
  voteWeight: 9n,
361
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
363
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
362
364
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
363
- newPubKey: users[1].pubKey,
365
+ newPublicKey: users[1].publicKey,
364
366
  },
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
- privateKey: users[2].privKey,
372
+ privateKey: users[2].privateKey,
371
373
  stateIndex: 3n,
372
374
  voteWeight: 9n,
373
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
375
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
374
376
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
375
- newPubKey: users[2].pubKey,
377
+ newPublicKey: users[2].publicKey,
376
378
  },
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
- privateKey: users[3].privKey,
384
+ privateKey: users[3].privateKey,
383
385
  stateIndex: 4n,
384
386
  voteWeight: 3n,
385
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
387
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
386
388
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
387
- newPubKey: users[3].pubKey,
389
+ newPublicKey: users[3].publicKey,
388
390
  },
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
- privateKey: users[3].privKey,
396
+ privateKey: users[3].privateKey,
395
397
  stateIndex: 4n,
396
398
  voteWeight: 2n,
397
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
399
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
398
400
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
399
- newPubKey: users[3].pubKey,
401
+ newPublicKey: users[3].publicKey,
400
402
  },
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
- privateKey: users[3].privKey,
408
+ privateKey: users[3].privateKey,
407
409
  stateIndex: 4n,
408
410
  voteWeight: 9n,
409
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
411
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
410
412
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
411
- newPubKey: users[3].pubKey,
413
+ newPublicKey: users[3].publicKey,
412
414
  },
413
415
  ];
414
416
  const messages = votes
@@ -417,8 +419,8 @@ describe("e2e tests", function test() {
417
419
  maciAddress: maciAddresses.maciContractAddress,
418
420
  poll: 0,
419
421
  data: message.data.map(String),
420
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
421
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
422
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
423
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
422
424
  }));
423
425
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
424
426
  });
@@ -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
  });
@@ -472,9 +478,9 @@ describe("e2e tests", function test() {
472
478
  // eslint-disable-next-line no-await-in-loop
473
479
  await (0, sdk_1.signup)({
474
480
  maciAddress: maciAddresses.maciContractAddress,
475
- maciPubKey: users[i].pubKey.serialize(),
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
  });
@@ -482,17 +488,16 @@ describe("e2e tests", function test() {
482
488
  // eslint-disable-next-line no-await-in-loop
483
489
  await (0, sdk_1.joinPoll)({
484
490
  maciAddress: maciAddresses.maciContractAddress,
485
- privateKey: users[0].privKey.serialize(),
486
- stateIndex: 1n,
491
+ privateKey: users[0].privateKey.serialize(),
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,35 +506,35 @@ 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
- privateKey: users[0].privKey,
511
+ privateKey: users[0].privateKey,
507
512
  stateIndex: 1n,
508
513
  voteWeight: 9n,
509
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
514
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
510
515
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
511
- newPubKey: users[0].pubKey,
516
+ newPublicKey: users[0].publicKey,
512
517
  }))
513
518
  .map(({ message, ephemeralKeypair }) => ({
514
519
  maciAddress: maciAddresses.maciContractAddress,
515
520
  poll: 0,
516
521
  data: message.data.map(String),
517
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
518
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
522
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
523
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
519
524
  }));
520
525
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
521
526
  for (let i = 0; i < 12; i += 1) {
522
527
  // eslint-disable-next-line no-await-in-loop
523
528
  await (0, sdk_1.publish)({
524
- pubkey: users[0].pubKey.serialize(),
529
+ publicKey: users[0].publicKey.serialize(),
525
530
  stateIndex: 1n,
526
531
  voteOptionIndex: 0n,
527
532
  nonce: 1n,
528
533
  pollId: 0n,
529
534
  newVoteWeight: 9n,
530
535
  maciAddress: maciAddresses.maciContractAddress,
531
- salt: (0, crypto_1.genRandomSalt)(),
532
- privateKey: users[0].privKey.serialize(),
536
+ salt: (0, crypto_1.generateRandomSalt)(),
537
+ privateKey: users[0].privateKey.serialize(),
533
538
  signer,
534
539
  });
535
540
  }
@@ -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
  });
@@ -585,9 +594,9 @@ describe("e2e tests", function test() {
585
594
  // eslint-disable-next-line no-await-in-loop
586
595
  await (0, sdk_1.signup)({
587
596
  maciAddress: maciAddresses.maciContractAddress,
588
- maciPubKey: users[i].pubKey.serialize(),
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
  });
@@ -597,17 +606,16 @@ describe("e2e tests", function test() {
597
606
  // eslint-disable-next-line no-await-in-loop
598
607
  await (0, sdk_1.joinPoll)({
599
608
  maciAddress: maciAddresses.maciContractAddress,
600
- privateKey: users[i].privKey.serialize(),
601
- stateIndex: BigInt(i + 1),
609
+ privateKey: users[i].privateKey.serialize(),
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
  });
@@ -617,14 +625,14 @@ describe("e2e tests", function test() {
617
625
  // eslint-disable-next-line no-await-in-loop
618
626
  await (0, sdk_1.publish)({
619
627
  maciAddress: maciAddresses.maciContractAddress,
620
- pubkey: users[i].pubKey.serialize(),
628
+ publicKey: users[i].publicKey.serialize(),
621
629
  stateIndex: BigInt(i + 1),
622
630
  voteOptionIndex: 0n,
623
631
  nonce: 1n,
624
632
  pollId: 0n,
625
633
  newVoteWeight: 9n,
626
- salt: (0, crypto_1.genRandomSalt)(),
627
- privateKey: users[i].privKey.serialize(),
634
+ salt: (0, crypto_1.generateRandomSalt)(),
635
+ privateKey: users[i].privateKey.serialize(),
628
636
  signer,
629
637
  });
630
638
  }
@@ -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
  });
@@ -678,9 +690,9 @@ describe("e2e tests", function test() {
678
690
  // eslint-disable-next-line no-await-in-loop
679
691
  await (0, sdk_1.signup)({
680
692
  maciAddress: maciAddresses.maciContractAddress,
681
- maciPubKey: users[i].pubKey.serialize(),
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
  });
@@ -690,17 +702,16 @@ describe("e2e tests", function test() {
690
702
  // eslint-disable-next-line no-await-in-loop
691
703
  await (0, sdk_1.joinPoll)({
692
704
  maciAddress: maciAddresses.maciContractAddress,
693
- privateKey: users[i].privKey.serialize(),
694
- stateIndex: BigInt(i + 1),
705
+ privateKey: users[i].privateKey.serialize(),
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
  });
@@ -710,14 +721,14 @@ describe("e2e tests", function test() {
710
721
  // eslint-disable-next-line no-await-in-loop
711
722
  await (0, sdk_1.publish)({
712
723
  maciAddress: maciAddresses.maciContractAddress,
713
- pubkey: users[i].pubKey.serialize(),
714
- stateIndex: 1n,
724
+ publicKey: users[i].publicKey.serialize(),
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)(),
720
- privateKey: users[i].privKey.serialize(),
730
+ salt: (0, crypto_1.generateRandomSalt)(),
731
+ privateKey: users[i].privateKey.serialize(),
721
732
  signer,
722
733
  });
723
734
  }
@@ -727,38 +738,38 @@ 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
- privateKey: users[0].privKey,
743
+ privateKey: users[0].privateKey,
733
744
  stateIndex: 1n,
734
745
  voteWeight: 5n,
735
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
746
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
736
747
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
737
- newPubKey: users[0].pubKey,
748
+ newPublicKey: users[0].publicKey,
738
749
  },
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
- privateKey: users[2].privKey,
755
+ privateKey: users[2].privateKey,
745
756
  stateIndex: 3n,
746
757
  voteWeight: 9n,
747
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
758
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
748
759
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
749
- newPubKey: users[2].pubKey,
760
+ newPublicKey: users[2].publicKey,
750
761
  },
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
- privateKey: users[3].privKey,
767
+ privateKey: users[3].privateKey,
757
768
  stateIndex: 4n,
758
769
  voteWeight: 7n,
759
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
770
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
760
771
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
761
- newPubKey: users[3].pubKey,
772
+ newPublicKey: users[3].publicKey,
762
773
  },
763
774
  ];
764
775
  const messages = votes
@@ -767,8 +778,8 @@ describe("e2e tests", function test() {
767
778
  maciAddress: maciAddresses.maciContractAddress,
768
779
  poll: 0,
769
780
  data: message.data.map(String),
770
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
771
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
781
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
782
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
772
783
  }));
773
784
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
774
785
  });
@@ -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,85 +828,81 @@ 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
  });
819
834
  // signup
820
835
  await (0, sdk_1.signup)({
821
836
  maciAddress: maciAddresses.maciContractAddress,
822
- maciPubKey: users[0].pubKey.serialize(),
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
- privateKey: users[0].privKey.serialize(),
830
- stateIndex: 1n,
844
+ privateKey: users[0].privateKey.serialize(),
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)({
843
- pubkey: users[0].pubKey.serialize(),
857
+ publicKey: users[0].publicKey.serialize(),
844
858
  stateIndex: 1n,
845
859
  voteOptionIndex: 0n,
846
860
  nonce: 1n,
847
861
  pollId: 0n,
848
862
  newVoteWeight: 9n,
849
863
  maciAddress: maciAddresses.maciContractAddress,
850
- salt: (0, crypto_1.genRandomSalt)(),
851
- privateKey: users[0].privKey.serialize(),
864
+ salt: (0, crypto_1.generateRandomSalt)(),
865
+ privateKey: users[0].privateKey.serialize(),
852
866
  signer,
853
867
  });
854
868
  await (0, sdk_1.signup)({
855
869
  maciAddress: maciAddresses.maciContractAddress,
856
- maciPubKey: users[1].pubKey.serialize(),
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
- maciPubKey: users[2].pubKey.serialize(),
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
- privateKey: users[1].privKey.serialize(),
870
- stateIndex: 2n,
883
+ privateKey: users[1].privateKey.serialize(),
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
- privateKey: users[1].privKey,
900
+ privateKey: users[1].privateKey,
888
901
  stateIndex: 2n,
889
902
  voteWeight: 2n,
890
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
903
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
891
904
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
892
- newPubKey: users[1].pubKey,
905
+ newPublicKey: users[1].publicKey,
893
906
  },
894
907
  ];
895
908
  const messages = votes
@@ -898,8 +911,8 @@ describe("e2e tests", function test() {
898
911
  maciAddress: maciAddresses.maciContractAddress,
899
912
  poll: 0,
900
913
  data: message.data.map(String),
901
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
902
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
914
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
915
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
903
916
  }));
904
917
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
905
918
  const ipfsMessageBackupFiles = await (0, utils_1.getBackupFilenames)();
@@ -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
  });
@@ -938,47 +949,45 @@ describe("e2e tests", function test() {
938
949
  it("should signup two new users", async () => {
939
950
  await (0, sdk_1.signup)({
940
951
  maciAddress: maciAddresses.maciContractAddress,
941
- maciPubKey: users[3].pubKey.serialize(),
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
- maciPubKey: users[4].pubKey.serialize(),
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 () => {
953
964
  // joinPoll
954
965
  await (0, sdk_1.joinPoll)({
955
966
  maciAddress: maciAddresses.maciContractAddress,
956
- privateKey: users[3].privKey.serialize(),
957
- stateIndex: 4n,
967
+ privateKey: users[3].privateKey.serialize(),
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
- privateKey: users[4].privKey.serialize(),
972
- stateIndex: 5n,
981
+ privateKey: users[4].privateKey.serialize(),
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,26 +995,26 @@ 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
- privateKey: users[0].privKey,
1000
+ privateKey: users[0].privateKey,
992
1001
  stateIndex: 1n,
993
1002
  voteWeight: 9n,
994
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1003
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
995
1004
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
996
- newPubKey: users[0].pubKey,
1005
+ newPublicKey: users[0].publicKey,
997
1006
  },
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
- privateKey: users[1].privKey,
1012
+ privateKey: users[1].privateKey,
1004
1013
  stateIndex: 1n,
1005
1014
  voteWeight: 5n,
1006
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1015
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1007
1016
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1008
- newPubKey: users[1].pubKey,
1017
+ newPublicKey: users[1].publicKey,
1009
1018
  },
1010
1019
  ];
1011
1020
  const messages = votes
@@ -1014,36 +1023,36 @@ describe("e2e tests", function test() {
1014
1023
  maciAddress: maciAddresses.maciContractAddress,
1015
1024
  poll: 1,
1016
1025
  data: message.data.map(String),
1017
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1018
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1026
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1027
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1019
1028
  }));
1020
1029
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 1, maciAddress: maciAddresses.maciContractAddress });
1021
1030
  });
1022
1031
  it("should publish a new message from the first poll voter", async () => {
1023
1032
  await (0, sdk_1.publish)({
1024
- pubkey: users[0].pubKey.serialize(),
1033
+ publicKey: users[0].publicKey.serialize(),
1025
1034
  stateIndex: 1n,
1026
1035
  voteOptionIndex: 0n,
1027
1036
  nonce: 1n,
1028
1037
  pollId: 1n,
1029
1038
  newVoteWeight: 7n,
1030
1039
  maciAddress: maciAddresses.maciContractAddress,
1031
- salt: (0, crypto_1.genRandomSalt)(),
1032
- privateKey: users[0].privKey.serialize(),
1040
+ salt: (0, crypto_1.generateRandomSalt)(),
1041
+ privateKey: users[0].privateKey.serialize(),
1033
1042
  signer,
1034
1043
  });
1035
1044
  });
1036
1045
  it("should publish a new message by the new poll voters", async () => {
1037
1046
  await (0, sdk_1.publish)({
1038
- pubkey: users[1].pubKey.serialize(),
1047
+ publicKey: users[1].publicKey.serialize(),
1039
1048
  stateIndex: 1n,
1040
1049
  voteOptionIndex: 0n,
1041
1050
  nonce: 1n,
1042
1051
  pollId: 1n,
1043
1052
  newVoteWeight: 7n,
1044
1053
  maciAddress: maciAddresses.maciContractAddress,
1045
- salt: (0, crypto_1.genRandomSalt)(),
1046
- privateKey: users[1].privKey.serialize(),
1054
+ salt: (0, crypto_1.generateRandomSalt)(),
1055
+ privateKey: users[1].privateKey.serialize(),
1047
1056
  signer,
1048
1057
  });
1049
1058
  });
@@ -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
  });
@@ -1108,14 +1121,14 @@ describe("e2e tests", function test() {
1108
1121
  // eslint-disable-next-line no-await-in-loop
1109
1122
  await (0, sdk_1.signup)({
1110
1123
  maciAddress: maciAddresses.maciContractAddress,
1111
- maciPubKey: users[i].pubKey.serialize(),
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)({
1117
1130
  maciAddress: maciAddresses.maciContractAddress,
1118
- maciPubKey: users[i].pubKey.serialize(),
1131
+ maciPublicKey: users[i].publicKey.serialize(),
1119
1132
  signer,
1120
1133
  });
1121
1134
  (0, chai_1.expect)(isRegistered).to.eq(true);
@@ -1127,23 +1140,22 @@ describe("e2e tests", function test() {
1127
1140
  // eslint-disable-next-line no-await-in-loop
1128
1141
  await (0, sdk_1.joinPoll)({
1129
1142
  maciAddress: maciAddresses.maciContractAddress,
1130
- privateKey: users[i].privKey.serialize(),
1131
- stateIndex: BigInt(i + 1),
1143
+ privateKey: users[i].privateKey.serialize(),
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)({
1144
1156
  maciAddress: maciAddresses.maciContractAddress,
1145
1157
  pollId: 0n,
1146
- pollPubKey: users[i].pubKey.serialize(),
1158
+ pollPublicKey: users[i].publicKey.serialize(),
1147
1159
  signer,
1148
1160
  startBlock: 0,
1149
1161
  });
@@ -1152,29 +1164,29 @@ describe("e2e tests", function test() {
1152
1164
  }
1153
1165
  // publish
1154
1166
  await (0, sdk_1.publish)({
1155
- pubkey: users[0].pubKey.serialize(),
1167
+ publicKey: users[0].publicKey.serialize(),
1156
1168
  stateIndex: 1n,
1157
1169
  voteOptionIndex: 0n,
1158
1170
  nonce: 1n,
1159
1171
  pollId: 0n,
1160
1172
  newVoteWeight: 9n,
1161
1173
  maciAddress: maciAddresses.maciContractAddress,
1162
- salt: (0, crypto_1.genRandomSalt)(),
1163
- privateKey: users[0].privKey.serialize(),
1174
+ salt: (0, crypto_1.generateRandomSalt)(),
1175
+ privateKey: users[0].privateKey.serialize(),
1164
1176
  signer,
1165
1177
  });
1166
1178
  const votes = [
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
- privateKey: users[0].privKey,
1184
+ privateKey: users[0].privateKey,
1173
1185
  stateIndex: 1n,
1174
1186
  voteWeight: 5n,
1175
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1187
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1176
1188
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1177
- newPubKey: users[0].pubKey,
1189
+ newPublicKey: users[0].publicKey,
1178
1190
  },
1179
1191
  ];
1180
1192
  const messages = votes
@@ -1183,8 +1195,8 @@ describe("e2e tests", function test() {
1183
1195
  maciAddress: maciAddresses.maciContractAddress,
1184
1196
  poll: 0,
1185
1197
  data: message.data.map(String),
1186
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1187
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1198
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1199
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1188
1200
  }));
1189
1201
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
1190
1202
  const ipfsMessageBackupFiles = await (0, utils_1.getBackupFilenames)();
@@ -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,28 +1249,28 @@ 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
- privateKey: users[i].privKey.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,
1258
+ privateKey: users[i].privateKey.serialize(),
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),
1265
- pollPubKey: users[i].pubKey.serialize(),
1272
+ pollId: BigInt(pollId),
1273
+ pollPublicKey: users[i].publicKey.serialize(),
1266
1274
  signer,
1267
1275
  startBlock: 0,
1268
1276
  });
@@ -1273,39 +1281,39 @@ describe("e2e tests", function test() {
1273
1281
  });
1274
1282
  it("should publish messages to the second poll", async () => {
1275
1283
  await (0, sdk_1.publish)({
1276
- pubkey: users[0].pubKey.serialize(),
1284
+ publicKey: users[0].publicKey.serialize(),
1277
1285
  stateIndex: 1n,
1278
1286
  voteOptionIndex: 0n,
1279
1287
  nonce: 1n,
1280
1288
  pollId: 1n,
1281
1289
  newVoteWeight: 9n,
1282
1290
  maciAddress: maciAddresses.maciContractAddress,
1283
- salt: (0, crypto_1.genRandomSalt)(),
1284
- privateKey: users[0].privKey.serialize(),
1291
+ salt: (0, crypto_1.generateRandomSalt)(),
1292
+ privateKey: users[0].privateKey.serialize(),
1285
1293
  signer,
1286
1294
  });
1287
1295
  await (0, sdk_1.publish)({
1288
- pubkey: users[1].pubKey.serialize(),
1296
+ publicKey: users[1].publicKey.serialize(),
1289
1297
  stateIndex: 2n,
1290
1298
  voteOptionIndex: 3n,
1291
1299
  nonce: 1n,
1292
1300
  pollId: 1n,
1293
1301
  newVoteWeight: 1n,
1294
1302
  maciAddress: maciAddresses.maciContractAddress,
1295
- salt: (0, crypto_1.genRandomSalt)(),
1296
- privateKey: users[1].privKey.serialize(),
1303
+ salt: (0, crypto_1.generateRandomSalt)(),
1304
+ privateKey: users[1].privateKey.serialize(),
1297
1305
  signer,
1298
1306
  });
1299
1307
  await (0, sdk_1.publish)({
1300
- pubkey: users[2].pubKey.serialize(),
1308
+ publicKey: users[2].publicKey.serialize(),
1301
1309
  stateIndex: 3n,
1302
1310
  voteOptionIndex: 5n,
1303
1311
  nonce: 1n,
1304
1312
  pollId: 1n,
1305
1313
  newVoteWeight: 3n,
1306
1314
  maciAddress: maciAddresses.maciContractAddress,
1307
- salt: (0, crypto_1.genRandomSalt)(),
1308
- privateKey: users[2].privKey.serialize(),
1315
+ salt: (0, crypto_1.generateRandomSalt)(),
1316
+ privateKey: users[2].privateKey.serialize(),
1309
1317
  signer,
1310
1318
  });
1311
1319
  });
@@ -1314,14 +1322,14 @@ 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
- privateKey: users[0].privKey,
1327
+ privateKey: users[0].privateKey,
1320
1328
  stateIndex: 1n,
1321
1329
  voteWeight: 3n,
1322
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1330
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1323
1331
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1324
- newPubKey: users[0].pubKey,
1332
+ newPublicKey: users[0].publicKey,
1325
1333
  },
1326
1334
  ];
1327
1335
  const messages = votes
@@ -1330,8 +1338,8 @@ describe("e2e tests", function test() {
1330
1338
  maciAddress: maciAddresses.maciContractAddress,
1331
1339
  poll: 1,
1332
1340
  data: message.data.map(String),
1333
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1334
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1341
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1342
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1335
1343
  }));
1336
1344
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 1, maciAddress: maciAddresses.maciContractAddress });
1337
1345
  });
@@ -1340,26 +1348,26 @@ 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
- privateKey: users[4].privKey,
1353
+ privateKey: users[4].privateKey,
1346
1354
  stateIndex: 4n,
1347
1355
  voteWeight: 3n,
1348
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1356
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1349
1357
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1350
- newPubKey: users[4].pubKey,
1358
+ newPublicKey: users[4].publicKey,
1351
1359
  },
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
- privateKey: users[5].privKey,
1365
+ privateKey: users[5].privateKey,
1358
1366
  stateIndex: 5n,
1359
1367
  voteWeight: 4n,
1360
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1368
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1361
1369
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1362
- newPubKey: users[5].pubKey,
1370
+ newPublicKey: users[5].publicKey,
1363
1371
  },
1364
1372
  ];
1365
1373
  const messages = votes
@@ -1368,46 +1376,46 @@ describe("e2e tests", function test() {
1368
1376
  maciAddress: maciAddresses.maciContractAddress,
1369
1377
  poll: 2,
1370
1378
  data: message.data.map(String),
1371
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1372
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1379
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1380
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1373
1381
  }));
1374
1382
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 2, maciAddress: maciAddresses.maciContractAddress });
1375
1383
  });
1376
1384
  it("should publish messages to the third poll", async () => {
1377
1385
  await (0, sdk_1.publish)({
1378
- pubkey: users[3].pubKey.serialize(),
1386
+ publicKey: users[3].publicKey.serialize(),
1379
1387
  stateIndex: 3n,
1380
1388
  voteOptionIndex: 5n,
1381
1389
  nonce: 1n,
1382
1390
  pollId: 2n,
1383
1391
  newVoteWeight: 3n,
1384
1392
  maciAddress: maciAddresses.maciContractAddress,
1385
- salt: (0, crypto_1.genRandomSalt)(),
1386
- privateKey: users[3].privKey.serialize(),
1393
+ salt: (0, crypto_1.generateRandomSalt)(),
1394
+ privateKey: users[3].privateKey.serialize(),
1387
1395
  signer,
1388
1396
  });
1389
1397
  await (0, sdk_1.publish)({
1390
- pubkey: users[4].pubKey.serialize(),
1398
+ publicKey: users[4].publicKey.serialize(),
1391
1399
  stateIndex: 4n,
1392
1400
  voteOptionIndex: 7n,
1393
1401
  nonce: 1n,
1394
1402
  pollId: 2n,
1395
1403
  newVoteWeight: 2n,
1396
1404
  maciAddress: maciAddresses.maciContractAddress,
1397
- salt: (0, crypto_1.genRandomSalt)(),
1398
- privateKey: users[4].privKey.serialize(),
1405
+ salt: (0, crypto_1.generateRandomSalt)(),
1406
+ privateKey: users[4].privateKey.serialize(),
1399
1407
  signer,
1400
1408
  });
1401
1409
  await (0, sdk_1.publish)({
1402
- pubkey: users[5].pubKey.serialize(),
1410
+ publicKey: users[5].publicKey.serialize(),
1403
1411
  stateIndex: 5n,
1404
1412
  voteOptionIndex: 5n,
1405
1413
  nonce: 1n,
1406
1414
  pollId: 2n,
1407
1415
  newVoteWeight: 9n,
1408
1416
  maciAddress: maciAddresses.maciContractAddress,
1409
- salt: (0, crypto_1.genRandomSalt)(),
1410
- privateKey: users[5].privKey.serialize(),
1417
+ salt: (0, crypto_1.generateRandomSalt)(),
1418
+ privateKey: users[5].privateKey.serialize(),
1411
1419
  signer,
1412
1420
  });
1413
1421
  });
@@ -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
  });
@@ -1498,7 +1510,7 @@ describe("e2e tests", function test() {
1498
1510
  it("should signup one user", async () => {
1499
1511
  await (0, sdk_1.signup)({
1500
1512
  maciAddress: maciAddresses.maciContractAddress,
1501
- maciPubKey: user.pubKey.serialize(),
1513
+ maciPublicKey: user.publicKey.serialize(),
1502
1514
  sgData: constants_1.DEFAULT_SG_DATA,
1503
1515
  signer,
1504
1516
  });
@@ -1507,13 +1519,12 @@ describe("e2e tests", function test() {
1507
1519
  // joinPoll
1508
1520
  await (0, sdk_1.joinPoll)({
1509
1521
  maciAddress: maciAddresses.maciContractAddress,
1510
- privateKey: user.privKey.serialize(),
1511
- stateIndex: 1n,
1522
+ privateKey: user.privateKey.serialize(),
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,
@@ -1522,15 +1533,15 @@ describe("e2e tests", function test() {
1522
1533
  });
1523
1534
  it("should publish one message", async () => {
1524
1535
  await (0, sdk_1.publish)({
1525
- pubkey: user.pubKey.serialize(),
1536
+ publicKey: user.publicKey.serialize(),
1526
1537
  stateIndex: 1n,
1527
1538
  voteOptionIndex: 5n,
1528
1539
  nonce: 1n,
1529
1540
  pollId: 0n,
1530
1541
  newVoteWeight: 3n,
1531
1542
  maciAddress: maciAddresses.maciContractAddress,
1532
- salt: (0, crypto_1.genRandomSalt)(),
1533
- privateKey: user.privKey.serialize(),
1543
+ salt: (0, crypto_1.generateRandomSalt)(),
1544
+ privateKey: user.privateKey.serialize(),
1534
1545
  signer,
1535
1546
  });
1536
1547
  });
@@ -1539,14 +1550,14 @@ 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
- privateKey: user.privKey,
1555
+ privateKey: user.privateKey,
1545
1556
  stateIndex: 1n,
1546
1557
  voteWeight: 5n,
1547
- coordinatorPubKey: constants_1.coordinatorKeypair.pubKey,
1558
+ coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
1548
1559
  maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
1549
- newPubKey: user.pubKey,
1560
+ newPublicKey: user.publicKey,
1550
1561
  },
1551
1562
  ];
1552
1563
  const messages = votes
@@ -1555,8 +1566,8 @@ describe("e2e tests", function test() {
1555
1566
  maciAddress: maciAddresses.maciContractAddress,
1556
1567
  poll: 0,
1557
1568
  data: message.data.map(String),
1558
- publicKey: ephemeralKeypair.pubKey.asArray().map(String),
1559
- hash: message.hash(ephemeralKeypair.pubKey).toString(),
1569
+ publicKey: ephemeralKeypair.publicKey.asArray().map(String),
1570
+ hash: message.hash(ephemeralKeypair.publicKey).toString(),
1560
1571
  }));
1561
1572
  await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
1562
1573
  });
@@ -1567,7 +1578,7 @@ describe("e2e tests", function test() {
1567
1578
  await (0, sdk_1.generateMaciState)({
1568
1579
  maciAddress: maciAddresses.maciContractAddress,
1569
1580
  outputPath: stateOutPath,
1570
- coordinatorPrivateKey: constants_1.coordinatorPrivKey,
1581
+ coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
1571
1582
  blockPerBatch: 50,
1572
1583
  pollId: 0n,
1573
1584
  signer,