@maci-protocol/testing 0.0.0-ci.f9da2fc → 0.0.0-ci.fb960ed
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.
- package/build/ts/__tests__/e2e.nonQv.test.js +10 -10
- package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
- package/build/ts/__tests__/e2e.test.js +154 -154
- package/build/ts/__tests__/e2e.test.js.map +1 -1
- package/build/ts/__tests__/integration.test.js +24 -21
- package/build/ts/__tests__/integration.test.js.map +1 -1
- package/build/ts/__tests__/keyChange.test.js +35 -35
- package/build/ts/__tests__/keyChange.test.js.map +1 -1
- package/build/ts/__tests__/maciKeys.test.js +18 -18
- package/build/ts/__tests__/maciKeys.test.js.map +1 -1
- package/build/ts/__tests__/unit/joinPoll.test.js +5 -5
- package/build/ts/__tests__/unit/joinPoll.test.js.map +1 -1
- package/build/ts/__tests__/unit/publish.test.js +3 -3
- package/build/ts/__tests__/unit/publish.test.js.map +1 -1
- package/build/ts/__tests__/unit/signup.test.js +4 -4
- package/build/ts/__tests__/unit/signup.test.js.map +1 -1
- package/build/ts/constants.d.ts +3 -2
- package/build/ts/constants.d.ts.map +1 -1
- package/build/ts/constants.js +8 -5
- package/build/ts/constants.js.map +1 -1
- package/build/ts/testingClass.d.ts.map +1 -1
- package/build/ts/testingClass.js +5 -3
- package/build/ts/testingClass.js.map +1 -1
- package/build/ts/user.d.ts +2 -2
- package/build/ts/user.d.ts.map +1 -1
- package/build/ts/user.js +1 -1
- package/build/ts/user.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
|
@@ -42,7 +42,7 @@ describe("e2e tests", function test() {
|
|
|
42
42
|
processDatFile: constants_1.testProcessMessagesWitnessDatPath,
|
|
43
43
|
tallyWitgen: constants_1.testTallyVotesWitnessPath,
|
|
44
44
|
tallyDatFile: constants_1.testTallyVotesWitnessDatPath,
|
|
45
|
-
coordinatorPrivateKey: constants_1.
|
|
45
|
+
coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
|
|
46
46
|
processWasm: constants_1.testProcessMessagesWasmPath,
|
|
47
47
|
tallyWasm: constants_1.testTallyVotesWasmPath,
|
|
48
48
|
useWasm,
|
|
@@ -94,7 +94,7 @@ 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
|
-
|
|
97
|
+
maciPublicKey: user.publicKey.serialize(),
|
|
98
98
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
99
99
|
signer,
|
|
100
100
|
});
|
|
@@ -102,7 +102,7 @@ describe("e2e tests", function test() {
|
|
|
102
102
|
it("should join one user", async () => {
|
|
103
103
|
await (0, sdk_1.joinPoll)({
|
|
104
104
|
maciAddress: maciAddresses.maciContractAddress,
|
|
105
|
-
privateKey: user.
|
|
105
|
+
privateKey: user.privateKey.serialize(),
|
|
106
106
|
stateIndex: 1n,
|
|
107
107
|
pollId: 0n,
|
|
108
108
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -117,7 +117,7 @@ describe("e2e tests", function test() {
|
|
|
117
117
|
});
|
|
118
118
|
it("should publish one message", async () => {
|
|
119
119
|
await (0, sdk_1.publish)({
|
|
120
|
-
|
|
120
|
+
publicKey: user.publicKey.serialize(),
|
|
121
121
|
stateIndex: 1n,
|
|
122
122
|
voteOptionIndex: 0n,
|
|
123
123
|
nonce: 1n,
|
|
@@ -125,7 +125,7 @@ describe("e2e tests", function test() {
|
|
|
125
125
|
newVoteWeight: 9n,
|
|
126
126
|
maciAddress: maciAddresses.maciContractAddress,
|
|
127
127
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
128
|
-
privateKey: user.
|
|
128
|
+
privateKey: user.privateKey.serialize(),
|
|
129
129
|
signer,
|
|
130
130
|
});
|
|
131
131
|
});
|
|
@@ -139,7 +139,7 @@ describe("e2e tests", function test() {
|
|
|
139
139
|
});
|
|
140
140
|
await (0, sdk_1.signup)({
|
|
141
141
|
maciAddress: maciAddresses.maciContractAddress,
|
|
142
|
-
|
|
142
|
+
maciPublicKey: new domainobjs_1.Keypair().publicKey.serialize(),
|
|
143
143
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
144
144
|
signer,
|
|
145
145
|
});
|
|
@@ -188,7 +188,7 @@ describe("e2e tests", function test() {
|
|
|
188
188
|
// eslint-disable-next-line no-await-in-loop
|
|
189
189
|
await (0, sdk_1.signup)({
|
|
190
190
|
maciAddress: maciAddresses.maciContractAddress,
|
|
191
|
-
|
|
191
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
192
192
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
193
193
|
signer,
|
|
194
194
|
});
|
|
@@ -200,7 +200,7 @@ describe("e2e tests", function test() {
|
|
|
200
200
|
// eslint-disable-next-line no-await-in-loop
|
|
201
201
|
await (0, sdk_1.joinPoll)({
|
|
202
202
|
maciAddress: maciAddresses.maciContractAddress,
|
|
203
|
-
privateKey: users[i].
|
|
203
|
+
privateKey: users[i].privateKey.serialize(),
|
|
204
204
|
stateIndex: BigInt(i + 1),
|
|
205
205
|
pollId: 0n,
|
|
206
206
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -216,7 +216,7 @@ describe("e2e tests", function test() {
|
|
|
216
216
|
});
|
|
217
217
|
it("should publish eight messages", async () => {
|
|
218
218
|
await (0, sdk_1.publish)({
|
|
219
|
-
|
|
219
|
+
publicKey: users[0].publicKey.serialize(),
|
|
220
220
|
stateIndex: 1n,
|
|
221
221
|
voteOptionIndex: 0n,
|
|
222
222
|
nonce: 2n,
|
|
@@ -224,11 +224,11 @@ describe("e2e tests", function test() {
|
|
|
224
224
|
newVoteWeight: 4n,
|
|
225
225
|
maciAddress: maciAddresses.maciContractAddress,
|
|
226
226
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
227
|
-
privateKey: users[0].
|
|
227
|
+
privateKey: users[0].privateKey.serialize(),
|
|
228
228
|
signer,
|
|
229
229
|
});
|
|
230
230
|
await (0, sdk_1.publish)({
|
|
231
|
-
|
|
231
|
+
publicKey: users[0].publicKey.serialize(),
|
|
232
232
|
stateIndex: 1n,
|
|
233
233
|
voteOptionIndex: 0n,
|
|
234
234
|
nonce: 2n,
|
|
@@ -236,11 +236,11 @@ describe("e2e tests", function test() {
|
|
|
236
236
|
newVoteWeight: 3n,
|
|
237
237
|
maciAddress: maciAddresses.maciContractAddress,
|
|
238
238
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
239
|
-
privateKey: users[0].
|
|
239
|
+
privateKey: users[0].privateKey.serialize(),
|
|
240
240
|
signer,
|
|
241
241
|
});
|
|
242
242
|
await (0, sdk_1.publish)({
|
|
243
|
-
|
|
243
|
+
publicKey: users[0].publicKey.serialize(),
|
|
244
244
|
stateIndex: 1n,
|
|
245
245
|
voteOptionIndex: 0n,
|
|
246
246
|
nonce: 1n,
|
|
@@ -248,11 +248,11 @@ describe("e2e tests", function test() {
|
|
|
248
248
|
newVoteWeight: 9n,
|
|
249
249
|
maciAddress: maciAddresses.maciContractAddress,
|
|
250
250
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
251
|
-
privateKey: users[0].
|
|
251
|
+
privateKey: users[0].privateKey.serialize(),
|
|
252
252
|
signer,
|
|
253
253
|
});
|
|
254
254
|
await (0, sdk_1.publish)({
|
|
255
|
-
|
|
255
|
+
publicKey: users[1].publicKey.serialize(),
|
|
256
256
|
stateIndex: 2n,
|
|
257
257
|
voteOptionIndex: 2n,
|
|
258
258
|
nonce: 1n,
|
|
@@ -260,11 +260,11 @@ describe("e2e tests", function test() {
|
|
|
260
260
|
newVoteWeight: 9n,
|
|
261
261
|
maciAddress: maciAddresses.maciContractAddress,
|
|
262
262
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
263
|
-
privateKey: users[1].
|
|
263
|
+
privateKey: users[1].privateKey.serialize(),
|
|
264
264
|
signer,
|
|
265
265
|
});
|
|
266
266
|
await (0, sdk_1.publish)({
|
|
267
|
-
|
|
267
|
+
publicKey: users[2].publicKey.serialize(),
|
|
268
268
|
stateIndex: 3n,
|
|
269
269
|
voteOptionIndex: 2n,
|
|
270
270
|
nonce: 1n,
|
|
@@ -272,11 +272,11 @@ describe("e2e tests", function test() {
|
|
|
272
272
|
newVoteWeight: 9n,
|
|
273
273
|
maciAddress: maciAddresses.maciContractAddress,
|
|
274
274
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
275
|
-
privateKey: users[2].
|
|
275
|
+
privateKey: users[2].privateKey.serialize(),
|
|
276
276
|
signer,
|
|
277
277
|
});
|
|
278
278
|
await (0, sdk_1.publish)({
|
|
279
|
-
|
|
279
|
+
publicKey: users[3].publicKey.serialize(),
|
|
280
280
|
stateIndex: 4n,
|
|
281
281
|
voteOptionIndex: 2n,
|
|
282
282
|
nonce: 3n,
|
|
@@ -284,11 +284,11 @@ describe("e2e tests", function test() {
|
|
|
284
284
|
newVoteWeight: 3n,
|
|
285
285
|
maciAddress: maciAddresses.maciContractAddress,
|
|
286
286
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
287
|
-
privateKey: users[3].
|
|
287
|
+
privateKey: users[3].privateKey.serialize(),
|
|
288
288
|
signer,
|
|
289
289
|
});
|
|
290
290
|
await (0, sdk_1.publish)({
|
|
291
|
-
|
|
291
|
+
publicKey: users[3].publicKey.serialize(),
|
|
292
292
|
stateIndex: 4n,
|
|
293
293
|
voteOptionIndex: 2n,
|
|
294
294
|
nonce: 2n,
|
|
@@ -296,11 +296,11 @@ describe("e2e tests", function test() {
|
|
|
296
296
|
newVoteWeight: 2n,
|
|
297
297
|
maciAddress: maciAddresses.maciContractAddress,
|
|
298
298
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
299
|
-
privateKey: users[3].
|
|
299
|
+
privateKey: users[3].privateKey.serialize(),
|
|
300
300
|
signer,
|
|
301
301
|
});
|
|
302
302
|
await (0, sdk_1.publish)({
|
|
303
|
-
|
|
303
|
+
publicKey: users[3].publicKey.serialize(),
|
|
304
304
|
stateIndex: 4n,
|
|
305
305
|
voteOptionIndex: 1n,
|
|
306
306
|
nonce: 1n,
|
|
@@ -308,7 +308,7 @@ describe("e2e tests", function test() {
|
|
|
308
308
|
newVoteWeight: 9n,
|
|
309
309
|
maciAddress: maciAddresses.maciContractAddress,
|
|
310
310
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
311
|
-
privateKey: users[3].
|
|
311
|
+
privateKey: users[3].privateKey.serialize(),
|
|
312
312
|
signer,
|
|
313
313
|
});
|
|
314
314
|
});
|
|
@@ -319,96 +319,96 @@ describe("e2e tests", function test() {
|
|
|
319
319
|
voteOptionIndex: 1n,
|
|
320
320
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
321
321
|
nonce: 2n,
|
|
322
|
-
privateKey: users[0].
|
|
322
|
+
privateKey: users[0].privateKey,
|
|
323
323
|
stateIndex: 1n,
|
|
324
324
|
voteWeight: 4n,
|
|
325
|
-
|
|
325
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
326
326
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
327
|
-
|
|
327
|
+
newPublicKey: users[0].publicKey,
|
|
328
328
|
},
|
|
329
329
|
{
|
|
330
330
|
pollId: 0n,
|
|
331
331
|
voteOptionIndex: 1n,
|
|
332
332
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
333
333
|
nonce: 2n,
|
|
334
|
-
privateKey: users[0].
|
|
334
|
+
privateKey: users[0].privateKey,
|
|
335
335
|
stateIndex: 1n,
|
|
336
336
|
voteWeight: 3n,
|
|
337
|
-
|
|
337
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
338
338
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
339
|
-
|
|
339
|
+
newPublicKey: users[0].publicKey,
|
|
340
340
|
},
|
|
341
341
|
{
|
|
342
342
|
pollId: 0n,
|
|
343
343
|
voteOptionIndex: 1n,
|
|
344
344
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
345
345
|
nonce: 1n,
|
|
346
|
-
privateKey: users[0].
|
|
346
|
+
privateKey: users[0].privateKey,
|
|
347
347
|
stateIndex: 1n,
|
|
348
348
|
voteWeight: 9n,
|
|
349
|
-
|
|
349
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
350
350
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
351
|
-
|
|
351
|
+
newPublicKey: users[0].publicKey,
|
|
352
352
|
},
|
|
353
353
|
{
|
|
354
354
|
pollId: 0n,
|
|
355
355
|
voteOptionIndex: 1n,
|
|
356
356
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
357
357
|
nonce: 1n,
|
|
358
|
-
privateKey: users[1].
|
|
358
|
+
privateKey: users[1].privateKey,
|
|
359
359
|
stateIndex: 2n,
|
|
360
360
|
voteWeight: 9n,
|
|
361
|
-
|
|
361
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
362
362
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
363
|
-
|
|
363
|
+
newPublicKey: users[1].publicKey,
|
|
364
364
|
},
|
|
365
365
|
{
|
|
366
366
|
pollId: 0n,
|
|
367
367
|
voteOptionIndex: 1n,
|
|
368
368
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
369
369
|
nonce: 1n,
|
|
370
|
-
privateKey: users[2].
|
|
370
|
+
privateKey: users[2].privateKey,
|
|
371
371
|
stateIndex: 3n,
|
|
372
372
|
voteWeight: 9n,
|
|
373
|
-
|
|
373
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
374
374
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
375
|
-
|
|
375
|
+
newPublicKey: users[2].publicKey,
|
|
376
376
|
},
|
|
377
377
|
{
|
|
378
378
|
pollId: 0n,
|
|
379
379
|
voteOptionIndex: 0n,
|
|
380
380
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
381
381
|
nonce: 3n,
|
|
382
|
-
privateKey: users[3].
|
|
382
|
+
privateKey: users[3].privateKey,
|
|
383
383
|
stateIndex: 4n,
|
|
384
384
|
voteWeight: 3n,
|
|
385
|
-
|
|
385
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
386
386
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
387
|
-
|
|
387
|
+
newPublicKey: users[3].publicKey,
|
|
388
388
|
},
|
|
389
389
|
{
|
|
390
390
|
pollId: 0n,
|
|
391
391
|
voteOptionIndex: 0n,
|
|
392
392
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
393
393
|
nonce: 2n,
|
|
394
|
-
privateKey: users[3].
|
|
394
|
+
privateKey: users[3].privateKey,
|
|
395
395
|
stateIndex: 4n,
|
|
396
396
|
voteWeight: 2n,
|
|
397
|
-
|
|
397
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
398
398
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
399
|
-
|
|
399
|
+
newPublicKey: users[3].publicKey,
|
|
400
400
|
},
|
|
401
401
|
{
|
|
402
402
|
pollId: 0n,
|
|
403
403
|
voteOptionIndex: 0n,
|
|
404
404
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
405
405
|
nonce: 1n,
|
|
406
|
-
privateKey: users[3].
|
|
406
|
+
privateKey: users[3].privateKey,
|
|
407
407
|
stateIndex: 4n,
|
|
408
408
|
voteWeight: 9n,
|
|
409
|
-
|
|
409
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
410
410
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
411
|
-
|
|
411
|
+
newPublicKey: users[3].publicKey,
|
|
412
412
|
},
|
|
413
413
|
];
|
|
414
414
|
const messages = votes
|
|
@@ -417,8 +417,8 @@ describe("e2e tests", function test() {
|
|
|
417
417
|
maciAddress: maciAddresses.maciContractAddress,
|
|
418
418
|
poll: 0,
|
|
419
419
|
data: message.data.map(String),
|
|
420
|
-
publicKey: ephemeralKeypair.
|
|
421
|
-
hash: message.hash(ephemeralKeypair.
|
|
420
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
421
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
422
422
|
}));
|
|
423
423
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
424
424
|
});
|
|
@@ -472,7 +472,7 @@ describe("e2e tests", function test() {
|
|
|
472
472
|
// eslint-disable-next-line no-await-in-loop
|
|
473
473
|
await (0, sdk_1.signup)({
|
|
474
474
|
maciAddress: maciAddresses.maciContractAddress,
|
|
475
|
-
|
|
475
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
476
476
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
477
477
|
signer,
|
|
478
478
|
});
|
|
@@ -482,7 +482,7 @@ describe("e2e tests", function test() {
|
|
|
482
482
|
// eslint-disable-next-line no-await-in-loop
|
|
483
483
|
await (0, sdk_1.joinPoll)({
|
|
484
484
|
maciAddress: maciAddresses.maciContractAddress,
|
|
485
|
-
privateKey: users[0].
|
|
485
|
+
privateKey: users[0].privateKey.serialize(),
|
|
486
486
|
stateIndex: 1n,
|
|
487
487
|
pollId: 0n,
|
|
488
488
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -503,25 +503,25 @@ describe("e2e tests", function test() {
|
|
|
503
503
|
voteOptionIndex: 0n,
|
|
504
504
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
505
505
|
nonce: 1n,
|
|
506
|
-
privateKey: users[0].
|
|
506
|
+
privateKey: users[0].privateKey,
|
|
507
507
|
stateIndex: 1n,
|
|
508
508
|
voteWeight: 9n,
|
|
509
|
-
|
|
509
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
510
510
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
511
|
-
|
|
511
|
+
newPublicKey: users[0].publicKey,
|
|
512
512
|
}))
|
|
513
513
|
.map(({ message, ephemeralKeypair }) => ({
|
|
514
514
|
maciAddress: maciAddresses.maciContractAddress,
|
|
515
515
|
poll: 0,
|
|
516
516
|
data: message.data.map(String),
|
|
517
|
-
publicKey: ephemeralKeypair.
|
|
518
|
-
hash: message.hash(ephemeralKeypair.
|
|
517
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
518
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
519
519
|
}));
|
|
520
520
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
521
521
|
for (let i = 0; i < 12; i += 1) {
|
|
522
522
|
// eslint-disable-next-line no-await-in-loop
|
|
523
523
|
await (0, sdk_1.publish)({
|
|
524
|
-
|
|
524
|
+
publicKey: users[0].publicKey.serialize(),
|
|
525
525
|
stateIndex: 1n,
|
|
526
526
|
voteOptionIndex: 0n,
|
|
527
527
|
nonce: 1n,
|
|
@@ -529,7 +529,7 @@ describe("e2e tests", function test() {
|
|
|
529
529
|
newVoteWeight: 9n,
|
|
530
530
|
maciAddress: maciAddresses.maciContractAddress,
|
|
531
531
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
532
|
-
privateKey: users[0].
|
|
532
|
+
privateKey: users[0].privateKey.serialize(),
|
|
533
533
|
signer,
|
|
534
534
|
});
|
|
535
535
|
}
|
|
@@ -585,7 +585,7 @@ describe("e2e tests", function test() {
|
|
|
585
585
|
// eslint-disable-next-line no-await-in-loop
|
|
586
586
|
await (0, sdk_1.signup)({
|
|
587
587
|
maciAddress: maciAddresses.maciContractAddress,
|
|
588
|
-
|
|
588
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
589
589
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
590
590
|
signer,
|
|
591
591
|
});
|
|
@@ -597,7 +597,7 @@ describe("e2e tests", function test() {
|
|
|
597
597
|
// eslint-disable-next-line no-await-in-loop
|
|
598
598
|
await (0, sdk_1.joinPoll)({
|
|
599
599
|
maciAddress: maciAddresses.maciContractAddress,
|
|
600
|
-
privateKey: users[i].
|
|
600
|
+
privateKey: users[i].privateKey.serialize(),
|
|
601
601
|
stateIndex: BigInt(i + 1),
|
|
602
602
|
pollId: 0n,
|
|
603
603
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -617,14 +617,14 @@ describe("e2e tests", function test() {
|
|
|
617
617
|
// eslint-disable-next-line no-await-in-loop
|
|
618
618
|
await (0, sdk_1.publish)({
|
|
619
619
|
maciAddress: maciAddresses.maciContractAddress,
|
|
620
|
-
|
|
620
|
+
publicKey: users[i].publicKey.serialize(),
|
|
621
621
|
stateIndex: BigInt(i + 1),
|
|
622
622
|
voteOptionIndex: 0n,
|
|
623
623
|
nonce: 1n,
|
|
624
624
|
pollId: 0n,
|
|
625
625
|
newVoteWeight: 9n,
|
|
626
626
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
627
|
-
privateKey: users[i].
|
|
627
|
+
privateKey: users[i].privateKey.serialize(),
|
|
628
628
|
signer,
|
|
629
629
|
});
|
|
630
630
|
}
|
|
@@ -678,7 +678,7 @@ describe("e2e tests", function test() {
|
|
|
678
678
|
// eslint-disable-next-line no-await-in-loop
|
|
679
679
|
await (0, sdk_1.signup)({
|
|
680
680
|
maciAddress: maciAddresses.maciContractAddress,
|
|
681
|
-
|
|
681
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
682
682
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
683
683
|
signer,
|
|
684
684
|
});
|
|
@@ -690,7 +690,7 @@ describe("e2e tests", function test() {
|
|
|
690
690
|
// eslint-disable-next-line no-await-in-loop
|
|
691
691
|
await (0, sdk_1.joinPoll)({
|
|
692
692
|
maciAddress: maciAddresses.maciContractAddress,
|
|
693
|
-
privateKey: users[i].
|
|
693
|
+
privateKey: users[i].privateKey.serialize(),
|
|
694
694
|
stateIndex: BigInt(i + 1),
|
|
695
695
|
pollId: 0n,
|
|
696
696
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -710,14 +710,14 @@ describe("e2e tests", function test() {
|
|
|
710
710
|
// eslint-disable-next-line no-await-in-loop
|
|
711
711
|
await (0, sdk_1.publish)({
|
|
712
712
|
maciAddress: maciAddresses.maciContractAddress,
|
|
713
|
-
|
|
713
|
+
publicKey: users[i].publicKey.serialize(),
|
|
714
714
|
stateIndex: 1n,
|
|
715
715
|
voteOptionIndex: 0n,
|
|
716
716
|
nonce: 1n,
|
|
717
717
|
pollId: 0n,
|
|
718
718
|
newVoteWeight: 9n,
|
|
719
719
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
720
|
-
privateKey: users[i].
|
|
720
|
+
privateKey: users[i].privateKey.serialize(),
|
|
721
721
|
signer,
|
|
722
722
|
});
|
|
723
723
|
}
|
|
@@ -729,36 +729,36 @@ describe("e2e tests", function test() {
|
|
|
729
729
|
voteOptionIndex: 1n,
|
|
730
730
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
731
731
|
nonce: 2n,
|
|
732
|
-
privateKey: users[0].
|
|
732
|
+
privateKey: users[0].privateKey,
|
|
733
733
|
stateIndex: 1n,
|
|
734
734
|
voteWeight: 5n,
|
|
735
|
-
|
|
735
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
736
736
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
737
|
-
|
|
737
|
+
newPublicKey: users[0].publicKey,
|
|
738
738
|
},
|
|
739
739
|
{
|
|
740
740
|
pollId: 0n,
|
|
741
741
|
voteOptionIndex: 2n,
|
|
742
742
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
743
743
|
nonce: 3n,
|
|
744
|
-
privateKey: users[2].
|
|
744
|
+
privateKey: users[2].privateKey,
|
|
745
745
|
stateIndex: 3n,
|
|
746
746
|
voteWeight: 9n,
|
|
747
|
-
|
|
747
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
748
748
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
749
|
-
|
|
749
|
+
newPublicKey: users[2].publicKey,
|
|
750
750
|
},
|
|
751
751
|
{
|
|
752
752
|
pollId: 0n,
|
|
753
753
|
voteOptionIndex: 3n,
|
|
754
754
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
755
755
|
nonce: 3n,
|
|
756
|
-
privateKey: users[3].
|
|
756
|
+
privateKey: users[3].privateKey,
|
|
757
757
|
stateIndex: 4n,
|
|
758
758
|
voteWeight: 7n,
|
|
759
|
-
|
|
759
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
760
760
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
761
|
-
|
|
761
|
+
newPublicKey: users[3].publicKey,
|
|
762
762
|
},
|
|
763
763
|
];
|
|
764
764
|
const messages = votes
|
|
@@ -767,8 +767,8 @@ describe("e2e tests", function test() {
|
|
|
767
767
|
maciAddress: maciAddresses.maciContractAddress,
|
|
768
768
|
poll: 0,
|
|
769
769
|
data: message.data.map(String),
|
|
770
|
-
publicKey: ephemeralKeypair.
|
|
771
|
-
hash: message.hash(ephemeralKeypair.
|
|
770
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
771
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
772
772
|
}));
|
|
773
773
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
774
774
|
});
|
|
@@ -819,14 +819,14 @@ describe("e2e tests", function test() {
|
|
|
819
819
|
// signup
|
|
820
820
|
await (0, sdk_1.signup)({
|
|
821
821
|
maciAddress: maciAddresses.maciContractAddress,
|
|
822
|
-
|
|
822
|
+
maciPublicKey: users[0].publicKey.serialize(),
|
|
823
823
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
824
824
|
signer,
|
|
825
825
|
});
|
|
826
826
|
// joinPoll
|
|
827
827
|
await (0, sdk_1.joinPoll)({
|
|
828
828
|
maciAddress: maciAddresses.maciContractAddress,
|
|
829
|
-
privateKey: users[0].
|
|
829
|
+
privateKey: users[0].privateKey.serialize(),
|
|
830
830
|
stateIndex: 1n,
|
|
831
831
|
pollId: 0n,
|
|
832
832
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -840,7 +840,7 @@ describe("e2e tests", function test() {
|
|
|
840
840
|
});
|
|
841
841
|
// publish
|
|
842
842
|
await (0, sdk_1.publish)({
|
|
843
|
-
|
|
843
|
+
publicKey: users[0].publicKey.serialize(),
|
|
844
844
|
stateIndex: 1n,
|
|
845
845
|
voteOptionIndex: 0n,
|
|
846
846
|
nonce: 1n,
|
|
@@ -848,25 +848,25 @@ describe("e2e tests", function test() {
|
|
|
848
848
|
newVoteWeight: 9n,
|
|
849
849
|
maciAddress: maciAddresses.maciContractAddress,
|
|
850
850
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
851
|
-
privateKey: users[0].
|
|
851
|
+
privateKey: users[0].privateKey.serialize(),
|
|
852
852
|
signer,
|
|
853
853
|
});
|
|
854
854
|
await (0, sdk_1.signup)({
|
|
855
855
|
maciAddress: maciAddresses.maciContractAddress,
|
|
856
|
-
|
|
856
|
+
maciPublicKey: users[1].publicKey.serialize(),
|
|
857
857
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
858
858
|
signer,
|
|
859
859
|
});
|
|
860
860
|
await (0, sdk_1.signup)({
|
|
861
861
|
maciAddress: maciAddresses.maciContractAddress,
|
|
862
|
-
|
|
862
|
+
maciPublicKey: users[2].publicKey.serialize(),
|
|
863
863
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
864
864
|
signer,
|
|
865
865
|
});
|
|
866
866
|
// joinPoll
|
|
867
867
|
await (0, sdk_1.joinPoll)({
|
|
868
868
|
maciAddress: maciAddresses.maciContractAddress,
|
|
869
|
-
privateKey: users[1].
|
|
869
|
+
privateKey: users[1].privateKey.serialize(),
|
|
870
870
|
stateIndex: 2n,
|
|
871
871
|
pollId: 0n,
|
|
872
872
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -884,12 +884,12 @@ describe("e2e tests", function test() {
|
|
|
884
884
|
voteOptionIndex: 0n,
|
|
885
885
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
886
886
|
nonce: 1n,
|
|
887
|
-
privateKey: users[1].
|
|
887
|
+
privateKey: users[1].privateKey,
|
|
888
888
|
stateIndex: 2n,
|
|
889
889
|
voteWeight: 2n,
|
|
890
|
-
|
|
890
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
891
891
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
892
|
-
|
|
892
|
+
newPublicKey: users[1].publicKey,
|
|
893
893
|
},
|
|
894
894
|
];
|
|
895
895
|
const messages = votes
|
|
@@ -898,8 +898,8 @@ describe("e2e tests", function test() {
|
|
|
898
898
|
maciAddress: maciAddresses.maciContractAddress,
|
|
899
899
|
poll: 0,
|
|
900
900
|
data: message.data.map(String),
|
|
901
|
-
publicKey: ephemeralKeypair.
|
|
902
|
-
hash: message.hash(ephemeralKeypair.
|
|
901
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
902
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
903
903
|
}));
|
|
904
904
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
905
905
|
const ipfsMessageBackupFiles = await (0, utils_1.getBackupFilenames)();
|
|
@@ -938,13 +938,13 @@ describe("e2e tests", function test() {
|
|
|
938
938
|
it("should signup two new users", async () => {
|
|
939
939
|
await (0, sdk_1.signup)({
|
|
940
940
|
maciAddress: maciAddresses.maciContractAddress,
|
|
941
|
-
|
|
941
|
+
maciPublicKey: users[3].publicKey.serialize(),
|
|
942
942
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
943
943
|
signer,
|
|
944
944
|
});
|
|
945
945
|
await (0, sdk_1.signup)({
|
|
946
946
|
maciAddress: maciAddresses.maciContractAddress,
|
|
947
|
-
|
|
947
|
+
maciPublicKey: users[4].publicKey.serialize(),
|
|
948
948
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
949
949
|
signer,
|
|
950
950
|
});
|
|
@@ -953,7 +953,7 @@ describe("e2e tests", function test() {
|
|
|
953
953
|
// joinPoll
|
|
954
954
|
await (0, sdk_1.joinPoll)({
|
|
955
955
|
maciAddress: maciAddresses.maciContractAddress,
|
|
956
|
-
privateKey: users[3].
|
|
956
|
+
privateKey: users[3].privateKey.serialize(),
|
|
957
957
|
stateIndex: 4n,
|
|
958
958
|
pollId: 1n,
|
|
959
959
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -968,7 +968,7 @@ describe("e2e tests", function test() {
|
|
|
968
968
|
// joinPoll
|
|
969
969
|
await (0, sdk_1.joinPoll)({
|
|
970
970
|
maciAddress: maciAddresses.maciContractAddress,
|
|
971
|
-
privateKey: users[4].
|
|
971
|
+
privateKey: users[4].privateKey.serialize(),
|
|
972
972
|
stateIndex: 5n,
|
|
973
973
|
pollId: 1n,
|
|
974
974
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -988,24 +988,24 @@ describe("e2e tests", function test() {
|
|
|
988
988
|
voteOptionIndex: 1n,
|
|
989
989
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
990
990
|
nonce: 1n,
|
|
991
|
-
privateKey: users[0].
|
|
991
|
+
privateKey: users[0].privateKey,
|
|
992
992
|
stateIndex: 1n,
|
|
993
993
|
voteWeight: 9n,
|
|
994
|
-
|
|
994
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
995
995
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
996
|
-
|
|
996
|
+
newPublicKey: users[0].publicKey,
|
|
997
997
|
},
|
|
998
998
|
{
|
|
999
999
|
pollId: 1n,
|
|
1000
1000
|
voteOptionIndex: 0n,
|
|
1001
1001
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1002
1002
|
nonce: 1n,
|
|
1003
|
-
privateKey: users[1].
|
|
1003
|
+
privateKey: users[1].privateKey,
|
|
1004
1004
|
stateIndex: 1n,
|
|
1005
1005
|
voteWeight: 5n,
|
|
1006
|
-
|
|
1006
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1007
1007
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1008
|
-
|
|
1008
|
+
newPublicKey: users[1].publicKey,
|
|
1009
1009
|
},
|
|
1010
1010
|
];
|
|
1011
1011
|
const messages = votes
|
|
@@ -1014,14 +1014,14 @@ describe("e2e tests", function test() {
|
|
|
1014
1014
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1015
1015
|
poll: 1,
|
|
1016
1016
|
data: message.data.map(String),
|
|
1017
|
-
publicKey: ephemeralKeypair.
|
|
1018
|
-
hash: message.hash(ephemeralKeypair.
|
|
1017
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1018
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1019
1019
|
}));
|
|
1020
1020
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 1, maciAddress: maciAddresses.maciContractAddress });
|
|
1021
1021
|
});
|
|
1022
1022
|
it("should publish a new message from the first poll voter", async () => {
|
|
1023
1023
|
await (0, sdk_1.publish)({
|
|
1024
|
-
|
|
1024
|
+
publicKey: users[0].publicKey.serialize(),
|
|
1025
1025
|
stateIndex: 1n,
|
|
1026
1026
|
voteOptionIndex: 0n,
|
|
1027
1027
|
nonce: 1n,
|
|
@@ -1029,13 +1029,13 @@ describe("e2e tests", function test() {
|
|
|
1029
1029
|
newVoteWeight: 7n,
|
|
1030
1030
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1031
1031
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1032
|
-
privateKey: users[0].
|
|
1032
|
+
privateKey: users[0].privateKey.serialize(),
|
|
1033
1033
|
signer,
|
|
1034
1034
|
});
|
|
1035
1035
|
});
|
|
1036
1036
|
it("should publish a new message by the new poll voters", async () => {
|
|
1037
1037
|
await (0, sdk_1.publish)({
|
|
1038
|
-
|
|
1038
|
+
publicKey: users[1].publicKey.serialize(),
|
|
1039
1039
|
stateIndex: 1n,
|
|
1040
1040
|
voteOptionIndex: 0n,
|
|
1041
1041
|
nonce: 1n,
|
|
@@ -1043,7 +1043,7 @@ describe("e2e tests", function test() {
|
|
|
1043
1043
|
newVoteWeight: 7n,
|
|
1044
1044
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1045
1045
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1046
|
-
privateKey: users[1].
|
|
1046
|
+
privateKey: users[1].privateKey.serialize(),
|
|
1047
1047
|
signer,
|
|
1048
1048
|
});
|
|
1049
1049
|
});
|
|
@@ -1108,14 +1108,14 @@ describe("e2e tests", function test() {
|
|
|
1108
1108
|
// eslint-disable-next-line no-await-in-loop
|
|
1109
1109
|
await (0, sdk_1.signup)({
|
|
1110
1110
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1111
|
-
|
|
1111
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
1112
1112
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
1113
1113
|
signer,
|
|
1114
1114
|
});
|
|
1115
1115
|
// eslint-disable-next-line no-await-in-loop
|
|
1116
1116
|
const { isRegistered, stateIndex } = await (0, sdk_1.getSignedupUserData)({
|
|
1117
1117
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1118
|
-
|
|
1118
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
1119
1119
|
signer,
|
|
1120
1120
|
});
|
|
1121
1121
|
(0, chai_1.expect)(isRegistered).to.eq(true);
|
|
@@ -1127,7 +1127,7 @@ describe("e2e tests", function test() {
|
|
|
1127
1127
|
// eslint-disable-next-line no-await-in-loop
|
|
1128
1128
|
await (0, sdk_1.joinPoll)({
|
|
1129
1129
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1130
|
-
privateKey: users[i].
|
|
1130
|
+
privateKey: users[i].privateKey.serialize(),
|
|
1131
1131
|
stateIndex: BigInt(i + 1),
|
|
1132
1132
|
pollId: 0n,
|
|
1133
1133
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -1143,7 +1143,7 @@ describe("e2e tests", function test() {
|
|
|
1143
1143
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
1144
1144
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1145
1145
|
pollId: 0n,
|
|
1146
|
-
|
|
1146
|
+
pollPublicKey: users[i].publicKey.serialize(),
|
|
1147
1147
|
signer,
|
|
1148
1148
|
startBlock: 0,
|
|
1149
1149
|
});
|
|
@@ -1152,7 +1152,7 @@ describe("e2e tests", function test() {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
// publish
|
|
1154
1154
|
await (0, sdk_1.publish)({
|
|
1155
|
-
|
|
1155
|
+
publicKey: users[0].publicKey.serialize(),
|
|
1156
1156
|
stateIndex: 1n,
|
|
1157
1157
|
voteOptionIndex: 0n,
|
|
1158
1158
|
nonce: 1n,
|
|
@@ -1160,7 +1160,7 @@ describe("e2e tests", function test() {
|
|
|
1160
1160
|
newVoteWeight: 9n,
|
|
1161
1161
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1162
1162
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1163
|
-
privateKey: users[0].
|
|
1163
|
+
privateKey: users[0].privateKey.serialize(),
|
|
1164
1164
|
signer,
|
|
1165
1165
|
});
|
|
1166
1166
|
const votes = [
|
|
@@ -1169,12 +1169,12 @@ describe("e2e tests", function test() {
|
|
|
1169
1169
|
voteOptionIndex: 0n,
|
|
1170
1170
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1171
1171
|
nonce: 1n,
|
|
1172
|
-
privateKey: users[0].
|
|
1172
|
+
privateKey: users[0].privateKey,
|
|
1173
1173
|
stateIndex: 1n,
|
|
1174
1174
|
voteWeight: 5n,
|
|
1175
|
-
|
|
1175
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1176
1176
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1177
|
-
|
|
1177
|
+
newPublicKey: users[0].publicKey,
|
|
1178
1178
|
},
|
|
1179
1179
|
];
|
|
1180
1180
|
const messages = votes
|
|
@@ -1183,8 +1183,8 @@ describe("e2e tests", function test() {
|
|
|
1183
1183
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1184
1184
|
poll: 0,
|
|
1185
1185
|
data: message.data.map(String),
|
|
1186
|
-
publicKey: ephemeralKeypair.
|
|
1187
|
-
hash: message.hash(ephemeralKeypair.
|
|
1186
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1187
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1188
1188
|
}));
|
|
1189
1189
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
1190
1190
|
const ipfsMessageBackupFiles = await (0, utils_1.getBackupFilenames)();
|
|
@@ -1246,7 +1246,7 @@ describe("e2e tests", function test() {
|
|
|
1246
1246
|
// eslint-disable-next-line no-await-in-loop
|
|
1247
1247
|
await (0, sdk_1.joinPoll)({
|
|
1248
1248
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1249
|
-
privateKey: users[i].
|
|
1249
|
+
privateKey: users[i].privateKey.serialize(),
|
|
1250
1250
|
stateIndex: BigInt(i + 1),
|
|
1251
1251
|
pollId: BigInt(p),
|
|
1252
1252
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -1262,7 +1262,7 @@ describe("e2e tests", function test() {
|
|
|
1262
1262
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
1263
1263
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1264
1264
|
pollId: BigInt(p),
|
|
1265
|
-
|
|
1265
|
+
pollPublicKey: users[i].publicKey.serialize(),
|
|
1266
1266
|
signer,
|
|
1267
1267
|
startBlock: 0,
|
|
1268
1268
|
});
|
|
@@ -1273,7 +1273,7 @@ describe("e2e tests", function test() {
|
|
|
1273
1273
|
});
|
|
1274
1274
|
it("should publish messages to the second poll", async () => {
|
|
1275
1275
|
await (0, sdk_1.publish)({
|
|
1276
|
-
|
|
1276
|
+
publicKey: users[0].publicKey.serialize(),
|
|
1277
1277
|
stateIndex: 1n,
|
|
1278
1278
|
voteOptionIndex: 0n,
|
|
1279
1279
|
nonce: 1n,
|
|
@@ -1281,11 +1281,11 @@ describe("e2e tests", function test() {
|
|
|
1281
1281
|
newVoteWeight: 9n,
|
|
1282
1282
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1283
1283
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1284
|
-
privateKey: users[0].
|
|
1284
|
+
privateKey: users[0].privateKey.serialize(),
|
|
1285
1285
|
signer,
|
|
1286
1286
|
});
|
|
1287
1287
|
await (0, sdk_1.publish)({
|
|
1288
|
-
|
|
1288
|
+
publicKey: users[1].publicKey.serialize(),
|
|
1289
1289
|
stateIndex: 2n,
|
|
1290
1290
|
voteOptionIndex: 3n,
|
|
1291
1291
|
nonce: 1n,
|
|
@@ -1293,11 +1293,11 @@ describe("e2e tests", function test() {
|
|
|
1293
1293
|
newVoteWeight: 1n,
|
|
1294
1294
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1295
1295
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1296
|
-
privateKey: users[1].
|
|
1296
|
+
privateKey: users[1].privateKey.serialize(),
|
|
1297
1297
|
signer,
|
|
1298
1298
|
});
|
|
1299
1299
|
await (0, sdk_1.publish)({
|
|
1300
|
-
|
|
1300
|
+
publicKey: users[2].publicKey.serialize(),
|
|
1301
1301
|
stateIndex: 3n,
|
|
1302
1302
|
voteOptionIndex: 5n,
|
|
1303
1303
|
nonce: 1n,
|
|
@@ -1305,7 +1305,7 @@ describe("e2e tests", function test() {
|
|
|
1305
1305
|
newVoteWeight: 3n,
|
|
1306
1306
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1307
1307
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1308
|
-
privateKey: users[2].
|
|
1308
|
+
privateKey: users[2].privateKey.serialize(),
|
|
1309
1309
|
signer,
|
|
1310
1310
|
});
|
|
1311
1311
|
});
|
|
@@ -1316,12 +1316,12 @@ describe("e2e tests", function test() {
|
|
|
1316
1316
|
voteOptionIndex: 0n,
|
|
1317
1317
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1318
1318
|
nonce: 1n,
|
|
1319
|
-
privateKey: users[0].
|
|
1319
|
+
privateKey: users[0].privateKey,
|
|
1320
1320
|
stateIndex: 1n,
|
|
1321
1321
|
voteWeight: 3n,
|
|
1322
|
-
|
|
1322
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1323
1323
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1324
|
-
|
|
1324
|
+
newPublicKey: users[0].publicKey,
|
|
1325
1325
|
},
|
|
1326
1326
|
];
|
|
1327
1327
|
const messages = votes
|
|
@@ -1330,8 +1330,8 @@ describe("e2e tests", function test() {
|
|
|
1330
1330
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1331
1331
|
poll: 1,
|
|
1332
1332
|
data: message.data.map(String),
|
|
1333
|
-
publicKey: ephemeralKeypair.
|
|
1334
|
-
hash: message.hash(ephemeralKeypair.
|
|
1333
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1334
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1335
1335
|
}));
|
|
1336
1336
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 1, maciAddress: maciAddresses.maciContractAddress });
|
|
1337
1337
|
});
|
|
@@ -1342,24 +1342,24 @@ describe("e2e tests", function test() {
|
|
|
1342
1342
|
voteOptionIndex: 7n,
|
|
1343
1343
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1344
1344
|
nonce: 1n,
|
|
1345
|
-
privateKey: users[4].
|
|
1345
|
+
privateKey: users[4].privateKey,
|
|
1346
1346
|
stateIndex: 4n,
|
|
1347
1347
|
voteWeight: 3n,
|
|
1348
|
-
|
|
1348
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1349
1349
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1350
|
-
|
|
1350
|
+
newPublicKey: users[4].publicKey,
|
|
1351
1351
|
},
|
|
1352
1352
|
{
|
|
1353
1353
|
pollId: 2n,
|
|
1354
1354
|
voteOptionIndex: 5n,
|
|
1355
1355
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1356
1356
|
nonce: 1n,
|
|
1357
|
-
privateKey: users[5].
|
|
1357
|
+
privateKey: users[5].privateKey,
|
|
1358
1358
|
stateIndex: 5n,
|
|
1359
1359
|
voteWeight: 4n,
|
|
1360
|
-
|
|
1360
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1361
1361
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1362
|
-
|
|
1362
|
+
newPublicKey: users[5].publicKey,
|
|
1363
1363
|
},
|
|
1364
1364
|
];
|
|
1365
1365
|
const messages = votes
|
|
@@ -1368,14 +1368,14 @@ describe("e2e tests", function test() {
|
|
|
1368
1368
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1369
1369
|
poll: 2,
|
|
1370
1370
|
data: message.data.map(String),
|
|
1371
|
-
publicKey: ephemeralKeypair.
|
|
1372
|
-
hash: message.hash(ephemeralKeypair.
|
|
1371
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1372
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1373
1373
|
}));
|
|
1374
1374
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 2, maciAddress: maciAddresses.maciContractAddress });
|
|
1375
1375
|
});
|
|
1376
1376
|
it("should publish messages to the third poll", async () => {
|
|
1377
1377
|
await (0, sdk_1.publish)({
|
|
1378
|
-
|
|
1378
|
+
publicKey: users[3].publicKey.serialize(),
|
|
1379
1379
|
stateIndex: 3n,
|
|
1380
1380
|
voteOptionIndex: 5n,
|
|
1381
1381
|
nonce: 1n,
|
|
@@ -1383,11 +1383,11 @@ describe("e2e tests", function test() {
|
|
|
1383
1383
|
newVoteWeight: 3n,
|
|
1384
1384
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1385
1385
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1386
|
-
privateKey: users[3].
|
|
1386
|
+
privateKey: users[3].privateKey.serialize(),
|
|
1387
1387
|
signer,
|
|
1388
1388
|
});
|
|
1389
1389
|
await (0, sdk_1.publish)({
|
|
1390
|
-
|
|
1390
|
+
publicKey: users[4].publicKey.serialize(),
|
|
1391
1391
|
stateIndex: 4n,
|
|
1392
1392
|
voteOptionIndex: 7n,
|
|
1393
1393
|
nonce: 1n,
|
|
@@ -1395,11 +1395,11 @@ describe("e2e tests", function test() {
|
|
|
1395
1395
|
newVoteWeight: 2n,
|
|
1396
1396
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1397
1397
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1398
|
-
privateKey: users[4].
|
|
1398
|
+
privateKey: users[4].privateKey.serialize(),
|
|
1399
1399
|
signer,
|
|
1400
1400
|
});
|
|
1401
1401
|
await (0, sdk_1.publish)({
|
|
1402
|
-
|
|
1402
|
+
publicKey: users[5].publicKey.serialize(),
|
|
1403
1403
|
stateIndex: 5n,
|
|
1404
1404
|
voteOptionIndex: 5n,
|
|
1405
1405
|
nonce: 1n,
|
|
@@ -1407,7 +1407,7 @@ describe("e2e tests", function test() {
|
|
|
1407
1407
|
newVoteWeight: 9n,
|
|
1408
1408
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1409
1409
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1410
|
-
privateKey: users[5].
|
|
1410
|
+
privateKey: users[5].privateKey.serialize(),
|
|
1411
1411
|
signer,
|
|
1412
1412
|
});
|
|
1413
1413
|
});
|
|
@@ -1498,7 +1498,7 @@ describe("e2e tests", function test() {
|
|
|
1498
1498
|
it("should signup one user", async () => {
|
|
1499
1499
|
await (0, sdk_1.signup)({
|
|
1500
1500
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1501
|
-
|
|
1501
|
+
maciPublicKey: user.publicKey.serialize(),
|
|
1502
1502
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
1503
1503
|
signer,
|
|
1504
1504
|
});
|
|
@@ -1507,7 +1507,7 @@ describe("e2e tests", function test() {
|
|
|
1507
1507
|
// joinPoll
|
|
1508
1508
|
await (0, sdk_1.joinPoll)({
|
|
1509
1509
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1510
|
-
privateKey: user.
|
|
1510
|
+
privateKey: user.privateKey.serialize(),
|
|
1511
1511
|
stateIndex: 1n,
|
|
1512
1512
|
pollId: 0n,
|
|
1513
1513
|
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
@@ -1522,7 +1522,7 @@ describe("e2e tests", function test() {
|
|
|
1522
1522
|
});
|
|
1523
1523
|
it("should publish one message", async () => {
|
|
1524
1524
|
await (0, sdk_1.publish)({
|
|
1525
|
-
|
|
1525
|
+
publicKey: user.publicKey.serialize(),
|
|
1526
1526
|
stateIndex: 1n,
|
|
1527
1527
|
voteOptionIndex: 5n,
|
|
1528
1528
|
nonce: 1n,
|
|
@@ -1530,7 +1530,7 @@ describe("e2e tests", function test() {
|
|
|
1530
1530
|
newVoteWeight: 3n,
|
|
1531
1531
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1532
1532
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1533
|
-
privateKey: user.
|
|
1533
|
+
privateKey: user.privateKey.serialize(),
|
|
1534
1534
|
signer,
|
|
1535
1535
|
});
|
|
1536
1536
|
});
|
|
@@ -1541,12 +1541,12 @@ describe("e2e tests", function test() {
|
|
|
1541
1541
|
voteOptionIndex: 5n,
|
|
1542
1542
|
salt: (0, crypto_1.genRandomSalt)(),
|
|
1543
1543
|
nonce: 1n,
|
|
1544
|
-
privateKey: user.
|
|
1544
|
+
privateKey: user.privateKey,
|
|
1545
1545
|
stateIndex: 1n,
|
|
1546
1546
|
voteWeight: 5n,
|
|
1547
|
-
|
|
1547
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1548
1548
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1549
|
-
|
|
1549
|
+
newPublicKey: user.publicKey,
|
|
1550
1550
|
},
|
|
1551
1551
|
];
|
|
1552
1552
|
const messages = votes
|
|
@@ -1555,8 +1555,8 @@ describe("e2e tests", function test() {
|
|
|
1555
1555
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1556
1556
|
poll: 0,
|
|
1557
1557
|
data: message.data.map(String),
|
|
1558
|
-
publicKey: ephemeralKeypair.
|
|
1559
|
-
hash: message.hash(ephemeralKeypair.
|
|
1558
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1559
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1560
1560
|
}));
|
|
1561
1561
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
1562
1562
|
});
|
|
@@ -1567,7 +1567,7 @@ describe("e2e tests", function test() {
|
|
|
1567
1567
|
await (0, sdk_1.generateMaciState)({
|
|
1568
1568
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1569
1569
|
outputPath: stateOutPath,
|
|
1570
|
-
coordinatorPrivateKey: constants_1.
|
|
1570
|
+
coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
|
|
1571
1571
|
blockPerBatch: 50,
|
|
1572
1572
|
pollId: 0n,
|
|
1573
1573
|
signer,
|