@maci-protocol/testing 0.0.0-ci.3ff6873 → 0.0.0-ci.4019d90
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/LICENSE +1 -2
- package/build/ts/__tests__/e2e.full.test.d.ts +2 -0
- package/build/ts/__tests__/e2e.full.test.d.ts.map +1 -0
- package/build/ts/__tests__/e2e.full.test.js +839 -0
- package/build/ts/__tests__/e2e.full.test.js.map +1 -0
- package/build/ts/__tests__/e2e.nonQv.test.js +428 -31
- package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
- package/build/ts/__tests__/e2e.test.js +155 -147
- package/build/ts/__tests__/e2e.test.js.map +1 -1
- package/build/ts/__tests__/integration.test.js +49 -54
- package/build/ts/__tests__/integration.test.js.map +1 -1
- package/build/ts/__tests__/keyChange.test.js +55 -53
- package/build/ts/__tests__/keyChange.test.js.map +1 -1
- package/build/ts/__tests__/maciKeys.test.js +39 -39
- package/build/ts/__tests__/maciKeys.test.js.map +1 -1
- package/build/ts/__tests__/stress/stress.full.test.d.ts +2 -0
- package/build/ts/__tests__/stress/stress.full.test.d.ts.map +1 -0
- package/build/ts/__tests__/stress/stress.full.test.js +186 -0
- package/build/ts/__tests__/stress/stress.full.test.js.map +1 -0
- package/build/ts/__tests__/unit/joinPoll.test.js +67 -32
- package/build/ts/__tests__/unit/joinPoll.test.js.map +1 -1
- package/build/ts/__tests__/unit/poll.test.js +9 -11
- package/build/ts/__tests__/unit/poll.test.js.map +1 -1
- package/build/ts/__tests__/unit/publish.test.js +9 -11
- package/build/ts/__tests__/unit/publish.test.js.map +1 -1
- package/build/ts/__tests__/unit/setVerifyingKeys.test.d.ts +2 -0
- package/build/ts/__tests__/unit/setVerifyingKeys.test.d.ts.map +1 -0
- package/build/ts/__tests__/unit/setVerifyingKeys.test.js +52 -0
- package/build/ts/__tests__/unit/setVerifyingKeys.test.js.map +1 -0
- package/build/ts/__tests__/unit/signup.test.js +7 -5
- package/build/ts/__tests__/unit/signup.test.js.map +1 -1
- package/build/ts/__tests__/unit/utils.test.js +12 -12
- package/build/ts/__tests__/unit/utils.test.js.map +1 -1
- package/build/ts/constants.d.ts +51 -53
- package/build/ts/constants.d.ts.map +1 -1
- package/build/ts/constants.js +110 -71
- package/build/ts/constants.js.map +1 -1
- package/build/ts/testingClass.d.ts +9 -9
- package/build/ts/testingClass.d.ts.map +1 -1
- package/build/ts/testingClass.js +36 -35
- package/build/ts/testingClass.js.map +1 -1
- package/build/ts/types.d.ts +12 -13
- package/build/ts/types.d.ts.map +1 -1
- package/build/ts/utils.d.ts +3 -3
- package/build/ts/utils.d.ts.map +1 -1
- package/build/ts/utils.js +12 -12
- package/build/ts/utils.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -18
|
@@ -27,38 +27,31 @@ describe("e2e tests", function test() {
|
|
|
27
27
|
const useWasm = (0, sdk_1.isArm)();
|
|
28
28
|
this.timeout(900000);
|
|
29
29
|
let maciAddresses;
|
|
30
|
-
let vkRegistryAddress;
|
|
31
30
|
let initialVoiceCreditProxyContractAddress;
|
|
32
|
-
let verifierContractAddress;
|
|
33
31
|
let signer;
|
|
34
32
|
const generateProofsArgs = {
|
|
35
33
|
outputDir: constants_1.testProofsDirPath,
|
|
36
34
|
tallyFile: constants_1.testTallyFilePath,
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
voteTallyZkey: constants_1.testTallyVotesZkeyPath,
|
|
36
|
+
messageProcessorZkey: constants_1.testProcessMessageZkeyPath,
|
|
39
37
|
pollId: 0n,
|
|
40
38
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
messageProcessorWitnessGenerator: constants_1.testProcessMessagesWitnessPath,
|
|
40
|
+
messageProcessorWitnessDatFile: constants_1.testProcessMessagesWitnessDatPath,
|
|
41
|
+
voteTallyWitnessGenerator: constants_1.testTallyVotesWitnessPath,
|
|
42
|
+
voteTallyWitnessDatFile: constants_1.testTallyVotesWitnessDatPath,
|
|
45
43
|
coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
messageProcessorWasm: constants_1.testProcessMessagesWasmPath,
|
|
45
|
+
voteTallyWasm: constants_1.testTallyVotesWasmPath,
|
|
48
46
|
useWasm,
|
|
49
|
-
|
|
47
|
+
mode: core_1.EMode.QV,
|
|
50
48
|
};
|
|
51
|
-
// before all tests we deploy the
|
|
49
|
+
// before all tests we deploy the verifying keys registry contract and set the verifying keys
|
|
52
50
|
before(async () => {
|
|
53
51
|
signer = await (0, sdk_1.getDefaultSigner)();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const [initialVoiceCreditProxy] = await (0, sdk_1.deployConstantInitialVoiceCreditProxy)({ amount: constants_1.DEFAULT_INITIAL_VOICE_CREDITS }, signer, undefined, true);
|
|
52
|
+
const constantInitialVoiceCreditProxyFactory = await (0, sdk_1.deployConstantInitialVoiceCreditProxyFactory)(signer, true);
|
|
53
|
+
const initialVoiceCreditProxy = await (0, sdk_1.deployConstantInitialVoiceCreditProxy)({ amount: constants_1.DEFAULT_INITIAL_VOICE_CREDITS }, constantInitialVoiceCreditProxyFactory, signer);
|
|
57
54
|
initialVoiceCreditProxyContractAddress = await initialVoiceCreditProxy.getAddress();
|
|
58
|
-
const verifier = await (0, sdk_1.deployVerifier)(signer, true);
|
|
59
|
-
verifierContractAddress = await verifier.getAddress();
|
|
60
|
-
// we set the verifying keys
|
|
61
|
-
await (0, sdk_1.setVerifyingKeys)({ ...(await (0, constants_1.verifyingKeysArgs)(signer)), vkRegistryAddress });
|
|
62
55
|
});
|
|
63
56
|
describe("2 signups (1 after stateAq is merged and logs are fetched), 1 message", () => {
|
|
64
57
|
after(async () => {
|
|
@@ -76,6 +69,12 @@ describe("e2e tests", function test() {
|
|
|
76
69
|
signer,
|
|
77
70
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
78
71
|
});
|
|
72
|
+
// we set the verifying keys
|
|
73
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
74
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
75
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
76
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
77
|
+
});
|
|
79
78
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
80
79
|
// deploy a poll contract
|
|
81
80
|
await (0, sdk_1.deployPoll)({
|
|
@@ -85,8 +84,6 @@ describe("e2e tests", function test() {
|
|
|
85
84
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
86
85
|
relayers: [await signer.getAddress()],
|
|
87
86
|
maciAddress: maciAddresses.maciContractAddress,
|
|
88
|
-
verifierContractAddress,
|
|
89
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
90
87
|
policyContractAddress: pollPolicyContractAddress,
|
|
91
88
|
initialVoiceCreditProxyContractAddress,
|
|
92
89
|
});
|
|
@@ -103,12 +100,11 @@ describe("e2e tests", function test() {
|
|
|
103
100
|
await (0, sdk_1.joinPoll)({
|
|
104
101
|
maciAddress: maciAddresses.maciContractAddress,
|
|
105
102
|
privateKey: user.privateKey.serialize(),
|
|
106
|
-
stateIndex: 1n,
|
|
107
103
|
pollId: 0n,
|
|
108
|
-
pollJoiningZkey: constants_1.
|
|
109
|
-
useWasm
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
105
|
+
useWasm,
|
|
106
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
107
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
112
108
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
113
109
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
114
110
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -124,7 +120,7 @@ describe("e2e tests", function test() {
|
|
|
124
120
|
pollId: 0n,
|
|
125
121
|
newVoteWeight: 9n,
|
|
126
122
|
maciAddress: maciAddresses.maciContractAddress,
|
|
127
|
-
salt: (0, crypto_1.
|
|
123
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
128
124
|
privateKey: user.privateKey.serialize(),
|
|
129
125
|
signer,
|
|
130
126
|
});
|
|
@@ -167,6 +163,12 @@ describe("e2e tests", function test() {
|
|
|
167
163
|
signer,
|
|
168
164
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
169
165
|
});
|
|
166
|
+
// we set the verifying keys
|
|
167
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
168
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
169
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
170
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
171
|
+
});
|
|
170
172
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
171
173
|
// deploy a poll contract
|
|
172
174
|
await (0, sdk_1.deployPoll)({
|
|
@@ -176,8 +178,6 @@ describe("e2e tests", function test() {
|
|
|
176
178
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
177
179
|
relayers: [await signer.getAddress()],
|
|
178
180
|
maciAddress: maciAddresses.maciContractAddress,
|
|
179
|
-
verifierContractAddress,
|
|
180
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
181
181
|
policyContractAddress: pollPolicyContractAddress,
|
|
182
182
|
initialVoiceCreditProxyContractAddress,
|
|
183
183
|
});
|
|
@@ -201,12 +201,11 @@ describe("e2e tests", function test() {
|
|
|
201
201
|
await (0, sdk_1.joinPoll)({
|
|
202
202
|
maciAddress: maciAddresses.maciContractAddress,
|
|
203
203
|
privateKey: users[i].privateKey.serialize(),
|
|
204
|
-
stateIndex: BigInt(i + 1),
|
|
205
204
|
pollId: 0n,
|
|
206
|
-
pollJoiningZkey: constants_1.
|
|
207
|
-
useWasm
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
206
|
+
useWasm,
|
|
207
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
208
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
210
209
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
211
210
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
212
211
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -223,7 +222,7 @@ describe("e2e tests", function test() {
|
|
|
223
222
|
pollId: 0n,
|
|
224
223
|
newVoteWeight: 4n,
|
|
225
224
|
maciAddress: maciAddresses.maciContractAddress,
|
|
226
|
-
salt: (0, crypto_1.
|
|
225
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
227
226
|
privateKey: users[0].privateKey.serialize(),
|
|
228
227
|
signer,
|
|
229
228
|
});
|
|
@@ -235,7 +234,7 @@ describe("e2e tests", function test() {
|
|
|
235
234
|
pollId: 0n,
|
|
236
235
|
newVoteWeight: 3n,
|
|
237
236
|
maciAddress: maciAddresses.maciContractAddress,
|
|
238
|
-
salt: (0, crypto_1.
|
|
237
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
239
238
|
privateKey: users[0].privateKey.serialize(),
|
|
240
239
|
signer,
|
|
241
240
|
});
|
|
@@ -247,7 +246,7 @@ describe("e2e tests", function test() {
|
|
|
247
246
|
pollId: 0n,
|
|
248
247
|
newVoteWeight: 9n,
|
|
249
248
|
maciAddress: maciAddresses.maciContractAddress,
|
|
250
|
-
salt: (0, crypto_1.
|
|
249
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
251
250
|
privateKey: users[0].privateKey.serialize(),
|
|
252
251
|
signer,
|
|
253
252
|
});
|
|
@@ -259,7 +258,7 @@ describe("e2e tests", function test() {
|
|
|
259
258
|
pollId: 0n,
|
|
260
259
|
newVoteWeight: 9n,
|
|
261
260
|
maciAddress: maciAddresses.maciContractAddress,
|
|
262
|
-
salt: (0, crypto_1.
|
|
261
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
263
262
|
privateKey: users[1].privateKey.serialize(),
|
|
264
263
|
signer,
|
|
265
264
|
});
|
|
@@ -271,7 +270,7 @@ describe("e2e tests", function test() {
|
|
|
271
270
|
pollId: 0n,
|
|
272
271
|
newVoteWeight: 9n,
|
|
273
272
|
maciAddress: maciAddresses.maciContractAddress,
|
|
274
|
-
salt: (0, crypto_1.
|
|
273
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
275
274
|
privateKey: users[2].privateKey.serialize(),
|
|
276
275
|
signer,
|
|
277
276
|
});
|
|
@@ -283,7 +282,7 @@ describe("e2e tests", function test() {
|
|
|
283
282
|
pollId: 0n,
|
|
284
283
|
newVoteWeight: 3n,
|
|
285
284
|
maciAddress: maciAddresses.maciContractAddress,
|
|
286
|
-
salt: (0, crypto_1.
|
|
285
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
287
286
|
privateKey: users[3].privateKey.serialize(),
|
|
288
287
|
signer,
|
|
289
288
|
});
|
|
@@ -295,7 +294,7 @@ describe("e2e tests", function test() {
|
|
|
295
294
|
pollId: 0n,
|
|
296
295
|
newVoteWeight: 2n,
|
|
297
296
|
maciAddress: maciAddresses.maciContractAddress,
|
|
298
|
-
salt: (0, crypto_1.
|
|
297
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
299
298
|
privateKey: users[3].privateKey.serialize(),
|
|
300
299
|
signer,
|
|
301
300
|
});
|
|
@@ -307,7 +306,7 @@ describe("e2e tests", function test() {
|
|
|
307
306
|
pollId: 0n,
|
|
308
307
|
newVoteWeight: 9n,
|
|
309
308
|
maciAddress: maciAddresses.maciContractAddress,
|
|
310
|
-
salt: (0, crypto_1.
|
|
309
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
311
310
|
privateKey: users[3].privateKey.serialize(),
|
|
312
311
|
signer,
|
|
313
312
|
});
|
|
@@ -317,7 +316,7 @@ describe("e2e tests", function test() {
|
|
|
317
316
|
{
|
|
318
317
|
pollId: 0n,
|
|
319
318
|
voteOptionIndex: 1n,
|
|
320
|
-
salt: (0, crypto_1.
|
|
319
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
321
320
|
nonce: 2n,
|
|
322
321
|
privateKey: users[0].privateKey,
|
|
323
322
|
stateIndex: 1n,
|
|
@@ -329,7 +328,7 @@ describe("e2e tests", function test() {
|
|
|
329
328
|
{
|
|
330
329
|
pollId: 0n,
|
|
331
330
|
voteOptionIndex: 1n,
|
|
332
|
-
salt: (0, crypto_1.
|
|
331
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
333
332
|
nonce: 2n,
|
|
334
333
|
privateKey: users[0].privateKey,
|
|
335
334
|
stateIndex: 1n,
|
|
@@ -341,7 +340,7 @@ describe("e2e tests", function test() {
|
|
|
341
340
|
{
|
|
342
341
|
pollId: 0n,
|
|
343
342
|
voteOptionIndex: 1n,
|
|
344
|
-
salt: (0, crypto_1.
|
|
343
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
345
344
|
nonce: 1n,
|
|
346
345
|
privateKey: users[0].privateKey,
|
|
347
346
|
stateIndex: 1n,
|
|
@@ -353,7 +352,7 @@ describe("e2e tests", function test() {
|
|
|
353
352
|
{
|
|
354
353
|
pollId: 0n,
|
|
355
354
|
voteOptionIndex: 1n,
|
|
356
|
-
salt: (0, crypto_1.
|
|
355
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
357
356
|
nonce: 1n,
|
|
358
357
|
privateKey: users[1].privateKey,
|
|
359
358
|
stateIndex: 2n,
|
|
@@ -365,7 +364,7 @@ describe("e2e tests", function test() {
|
|
|
365
364
|
{
|
|
366
365
|
pollId: 0n,
|
|
367
366
|
voteOptionIndex: 1n,
|
|
368
|
-
salt: (0, crypto_1.
|
|
367
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
369
368
|
nonce: 1n,
|
|
370
369
|
privateKey: users[2].privateKey,
|
|
371
370
|
stateIndex: 3n,
|
|
@@ -377,7 +376,7 @@ describe("e2e tests", function test() {
|
|
|
377
376
|
{
|
|
378
377
|
pollId: 0n,
|
|
379
378
|
voteOptionIndex: 0n,
|
|
380
|
-
salt: (0, crypto_1.
|
|
379
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
381
380
|
nonce: 3n,
|
|
382
381
|
privateKey: users[3].privateKey,
|
|
383
382
|
stateIndex: 4n,
|
|
@@ -389,7 +388,7 @@ describe("e2e tests", function test() {
|
|
|
389
388
|
{
|
|
390
389
|
pollId: 0n,
|
|
391
390
|
voteOptionIndex: 0n,
|
|
392
|
-
salt: (0, crypto_1.
|
|
391
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
393
392
|
nonce: 2n,
|
|
394
393
|
privateKey: users[3].privateKey,
|
|
395
394
|
stateIndex: 4n,
|
|
@@ -401,7 +400,7 @@ describe("e2e tests", function test() {
|
|
|
401
400
|
{
|
|
402
401
|
pollId: 0n,
|
|
403
402
|
voteOptionIndex: 0n,
|
|
404
|
-
salt: (0, crypto_1.
|
|
403
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
405
404
|
nonce: 1n,
|
|
406
405
|
privateKey: users[3].privateKey,
|
|
407
406
|
stateIndex: 4n,
|
|
@@ -452,6 +451,12 @@ describe("e2e tests", function test() {
|
|
|
452
451
|
signer,
|
|
453
452
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
454
453
|
});
|
|
454
|
+
// we set the verifying keys
|
|
455
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
456
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
457
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
458
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
459
|
+
});
|
|
455
460
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
456
461
|
// deploy a poll contract
|
|
457
462
|
await (0, sdk_1.deployPoll)({
|
|
@@ -461,8 +466,6 @@ describe("e2e tests", function test() {
|
|
|
461
466
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
462
467
|
relayers: [await signer.getAddress()],
|
|
463
468
|
maciAddress: maciAddresses.maciContractAddress,
|
|
464
|
-
verifierContractAddress,
|
|
465
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
466
469
|
policyContractAddress: pollPolicyContractAddress,
|
|
467
470
|
initialVoiceCreditProxyContractAddress,
|
|
468
471
|
});
|
|
@@ -483,12 +486,11 @@ describe("e2e tests", function test() {
|
|
|
483
486
|
await (0, sdk_1.joinPoll)({
|
|
484
487
|
maciAddress: maciAddresses.maciContractAddress,
|
|
485
488
|
privateKey: users[0].privateKey.serialize(),
|
|
486
|
-
stateIndex: 1n,
|
|
487
489
|
pollId: 0n,
|
|
488
|
-
pollJoiningZkey: constants_1.
|
|
489
|
-
useWasm
|
|
490
|
-
|
|
491
|
-
|
|
490
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
491
|
+
useWasm,
|
|
492
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
493
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
492
494
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
493
495
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
494
496
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -501,7 +503,7 @@ describe("e2e tests", function test() {
|
|
|
501
503
|
.map(() => (0, sdk_1.generateVote)({
|
|
502
504
|
pollId: 0n,
|
|
503
505
|
voteOptionIndex: 0n,
|
|
504
|
-
salt: (0, crypto_1.
|
|
506
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
505
507
|
nonce: 1n,
|
|
506
508
|
privateKey: users[0].privateKey,
|
|
507
509
|
stateIndex: 1n,
|
|
@@ -528,7 +530,7 @@ describe("e2e tests", function test() {
|
|
|
528
530
|
pollId: 0n,
|
|
529
531
|
newVoteWeight: 9n,
|
|
530
532
|
maciAddress: maciAddresses.maciContractAddress,
|
|
531
|
-
salt: (0, crypto_1.
|
|
533
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
532
534
|
privateKey: users[0].privateKey.serialize(),
|
|
533
535
|
signer,
|
|
534
536
|
});
|
|
@@ -564,6 +566,12 @@ describe("e2e tests", function test() {
|
|
|
564
566
|
signer,
|
|
565
567
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
566
568
|
});
|
|
569
|
+
// we set the verifying keys
|
|
570
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
571
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
572
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
573
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
574
|
+
});
|
|
567
575
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
568
576
|
// deploy a poll contract
|
|
569
577
|
await (0, sdk_1.deployPoll)({
|
|
@@ -573,8 +581,6 @@ describe("e2e tests", function test() {
|
|
|
573
581
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
574
582
|
relayers: [await signer.getAddress()],
|
|
575
583
|
maciAddress: maciAddresses.maciContractAddress,
|
|
576
|
-
verifierContractAddress,
|
|
577
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
578
584
|
policyContractAddress: pollPolicyContractAddress,
|
|
579
585
|
initialVoiceCreditProxyContractAddress,
|
|
580
586
|
});
|
|
@@ -598,12 +604,11 @@ describe("e2e tests", function test() {
|
|
|
598
604
|
await (0, sdk_1.joinPoll)({
|
|
599
605
|
maciAddress: maciAddresses.maciContractAddress,
|
|
600
606
|
privateKey: users[i].privateKey.serialize(),
|
|
601
|
-
stateIndex: BigInt(i + 1),
|
|
602
607
|
pollId: 0n,
|
|
603
|
-
pollJoiningZkey: constants_1.
|
|
604
|
-
useWasm
|
|
605
|
-
|
|
606
|
-
|
|
608
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
609
|
+
useWasm,
|
|
610
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
611
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
607
612
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
608
613
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
609
614
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -623,7 +628,7 @@ describe("e2e tests", function test() {
|
|
|
623
628
|
nonce: 1n,
|
|
624
629
|
pollId: 0n,
|
|
625
630
|
newVoteWeight: 9n,
|
|
626
|
-
salt: (0, crypto_1.
|
|
631
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
627
632
|
privateKey: users[i].privateKey.serialize(),
|
|
628
633
|
signer,
|
|
629
634
|
});
|
|
@@ -657,6 +662,12 @@ describe("e2e tests", function test() {
|
|
|
657
662
|
signer,
|
|
658
663
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
659
664
|
});
|
|
665
|
+
// we set the verifying keys
|
|
666
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
667
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
668
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
669
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
670
|
+
});
|
|
660
671
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
661
672
|
// deploy a poll contract
|
|
662
673
|
await (0, sdk_1.deployPoll)({
|
|
@@ -666,8 +677,6 @@ describe("e2e tests", function test() {
|
|
|
666
677
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
667
678
|
relayers: [await signer.getAddress()],
|
|
668
679
|
maciAddress: maciAddresses.maciContractAddress,
|
|
669
|
-
verifierContractAddress,
|
|
670
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
671
680
|
policyContractAddress: pollPolicyContractAddress,
|
|
672
681
|
initialVoiceCreditProxyContractAddress,
|
|
673
682
|
});
|
|
@@ -691,12 +700,11 @@ describe("e2e tests", function test() {
|
|
|
691
700
|
await (0, sdk_1.joinPoll)({
|
|
692
701
|
maciAddress: maciAddresses.maciContractAddress,
|
|
693
702
|
privateKey: users[i].privateKey.serialize(),
|
|
694
|
-
stateIndex: BigInt(i + 1),
|
|
695
703
|
pollId: 0n,
|
|
696
|
-
pollJoiningZkey: constants_1.
|
|
697
|
-
useWasm
|
|
698
|
-
|
|
699
|
-
|
|
704
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
705
|
+
useWasm,
|
|
706
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
707
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
700
708
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
701
709
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
702
710
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -716,7 +724,7 @@ describe("e2e tests", function test() {
|
|
|
716
724
|
nonce: 1n,
|
|
717
725
|
pollId: 0n,
|
|
718
726
|
newVoteWeight: 9n,
|
|
719
|
-
salt: (0, crypto_1.
|
|
727
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
720
728
|
privateKey: users[i].privateKey.serialize(),
|
|
721
729
|
signer,
|
|
722
730
|
});
|
|
@@ -727,7 +735,7 @@ describe("e2e tests", function test() {
|
|
|
727
735
|
{
|
|
728
736
|
pollId: 0n,
|
|
729
737
|
voteOptionIndex: 1n,
|
|
730
|
-
salt: (0, crypto_1.
|
|
738
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
731
739
|
nonce: 2n,
|
|
732
740
|
privateKey: users[0].privateKey,
|
|
733
741
|
stateIndex: 1n,
|
|
@@ -739,7 +747,7 @@ describe("e2e tests", function test() {
|
|
|
739
747
|
{
|
|
740
748
|
pollId: 0n,
|
|
741
749
|
voteOptionIndex: 2n,
|
|
742
|
-
salt: (0, crypto_1.
|
|
750
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
743
751
|
nonce: 3n,
|
|
744
752
|
privateKey: users[2].privateKey,
|
|
745
753
|
stateIndex: 3n,
|
|
@@ -751,7 +759,7 @@ describe("e2e tests", function test() {
|
|
|
751
759
|
{
|
|
752
760
|
pollId: 0n,
|
|
753
761
|
voteOptionIndex: 3n,
|
|
754
|
-
salt: (0, crypto_1.
|
|
762
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
755
763
|
nonce: 3n,
|
|
756
764
|
privateKey: users[3].privateKey,
|
|
757
765
|
stateIndex: 4n,
|
|
@@ -802,6 +810,12 @@ describe("e2e tests", function test() {
|
|
|
802
810
|
signer,
|
|
803
811
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
804
812
|
});
|
|
813
|
+
// we set the verifying keys
|
|
814
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
815
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
816
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
817
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
818
|
+
});
|
|
805
819
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
806
820
|
// deploy a poll contract
|
|
807
821
|
await (0, sdk_1.deployPoll)({
|
|
@@ -811,8 +825,6 @@ describe("e2e tests", function test() {
|
|
|
811
825
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
812
826
|
relayers: [await signer.getAddress()],
|
|
813
827
|
maciAddress: maciAddresses.maciContractAddress,
|
|
814
|
-
verifierContractAddress,
|
|
815
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
816
828
|
policyContractAddress: pollPolicyContractAddress,
|
|
817
829
|
initialVoiceCreditProxyContractAddress,
|
|
818
830
|
});
|
|
@@ -827,12 +839,11 @@ describe("e2e tests", function test() {
|
|
|
827
839
|
await (0, sdk_1.joinPoll)({
|
|
828
840
|
maciAddress: maciAddresses.maciContractAddress,
|
|
829
841
|
privateKey: users[0].privateKey.serialize(),
|
|
830
|
-
stateIndex: 1n,
|
|
831
842
|
pollId: 0n,
|
|
832
|
-
pollJoiningZkey: constants_1.
|
|
833
|
-
useWasm
|
|
834
|
-
|
|
835
|
-
|
|
843
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
844
|
+
useWasm,
|
|
845
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
846
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
836
847
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
837
848
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
838
849
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -847,7 +858,7 @@ describe("e2e tests", function test() {
|
|
|
847
858
|
pollId: 0n,
|
|
848
859
|
newVoteWeight: 9n,
|
|
849
860
|
maciAddress: maciAddresses.maciContractAddress,
|
|
850
|
-
salt: (0, crypto_1.
|
|
861
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
851
862
|
privateKey: users[0].privateKey.serialize(),
|
|
852
863
|
signer,
|
|
853
864
|
});
|
|
@@ -867,12 +878,11 @@ describe("e2e tests", function test() {
|
|
|
867
878
|
await (0, sdk_1.joinPoll)({
|
|
868
879
|
maciAddress: maciAddresses.maciContractAddress,
|
|
869
880
|
privateKey: users[1].privateKey.serialize(),
|
|
870
|
-
stateIndex: 2n,
|
|
871
881
|
pollId: 0n,
|
|
872
|
-
pollJoiningZkey: constants_1.
|
|
873
|
-
useWasm
|
|
874
|
-
|
|
875
|
-
|
|
882
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
883
|
+
useWasm,
|
|
884
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
885
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
876
886
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
877
887
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
878
888
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -882,7 +892,7 @@ describe("e2e tests", function test() {
|
|
|
882
892
|
{
|
|
883
893
|
pollId: 0n,
|
|
884
894
|
voteOptionIndex: 0n,
|
|
885
|
-
salt: (0, crypto_1.
|
|
895
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
886
896
|
nonce: 1n,
|
|
887
897
|
privateKey: users[1].privateKey,
|
|
888
898
|
stateIndex: 2n,
|
|
@@ -929,8 +939,6 @@ describe("e2e tests", function test() {
|
|
|
929
939
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
930
940
|
relayers: [await signer.getAddress()],
|
|
931
941
|
maciAddress: maciAddresses.maciContractAddress,
|
|
932
|
-
verifierContractAddress,
|
|
933
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
934
942
|
policyContractAddress: pollPolicyContractAddress,
|
|
935
943
|
initialVoiceCreditProxyContractAddress,
|
|
936
944
|
});
|
|
@@ -954,12 +962,11 @@ describe("e2e tests", function test() {
|
|
|
954
962
|
await (0, sdk_1.joinPoll)({
|
|
955
963
|
maciAddress: maciAddresses.maciContractAddress,
|
|
956
964
|
privateKey: users[3].privateKey.serialize(),
|
|
957
|
-
stateIndex: 4n,
|
|
958
965
|
pollId: 1n,
|
|
959
|
-
pollJoiningZkey: constants_1.
|
|
960
|
-
useWasm
|
|
961
|
-
|
|
962
|
-
|
|
966
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
967
|
+
useWasm,
|
|
968
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
969
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
963
970
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
964
971
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
965
972
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -969,12 +976,11 @@ describe("e2e tests", function test() {
|
|
|
969
976
|
await (0, sdk_1.joinPoll)({
|
|
970
977
|
maciAddress: maciAddresses.maciContractAddress,
|
|
971
978
|
privateKey: users[4].privateKey.serialize(),
|
|
972
|
-
stateIndex: 5n,
|
|
973
979
|
pollId: 1n,
|
|
974
|
-
pollJoiningZkey: constants_1.
|
|
975
|
-
useWasm
|
|
976
|
-
|
|
977
|
-
|
|
980
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
981
|
+
useWasm,
|
|
982
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
983
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
978
984
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
979
985
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
980
986
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -986,7 +992,7 @@ describe("e2e tests", function test() {
|
|
|
986
992
|
{
|
|
987
993
|
pollId: 1n,
|
|
988
994
|
voteOptionIndex: 1n,
|
|
989
|
-
salt: (0, crypto_1.
|
|
995
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
990
996
|
nonce: 1n,
|
|
991
997
|
privateKey: users[0].privateKey,
|
|
992
998
|
stateIndex: 1n,
|
|
@@ -998,7 +1004,7 @@ describe("e2e tests", function test() {
|
|
|
998
1004
|
{
|
|
999
1005
|
pollId: 1n,
|
|
1000
1006
|
voteOptionIndex: 0n,
|
|
1001
|
-
salt: (0, crypto_1.
|
|
1007
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1002
1008
|
nonce: 1n,
|
|
1003
1009
|
privateKey: users[1].privateKey,
|
|
1004
1010
|
stateIndex: 1n,
|
|
@@ -1028,7 +1034,7 @@ describe("e2e tests", function test() {
|
|
|
1028
1034
|
pollId: 1n,
|
|
1029
1035
|
newVoteWeight: 7n,
|
|
1030
1036
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1031
|
-
salt: (0, crypto_1.
|
|
1037
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1032
1038
|
privateKey: users[0].privateKey.serialize(),
|
|
1033
1039
|
signer,
|
|
1034
1040
|
});
|
|
@@ -1042,7 +1048,7 @@ describe("e2e tests", function test() {
|
|
|
1042
1048
|
pollId: 1n,
|
|
1043
1049
|
newVoteWeight: 7n,
|
|
1044
1050
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1045
|
-
salt: (0, crypto_1.
|
|
1051
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1046
1052
|
privateKey: users[1].privateKey.serialize(),
|
|
1047
1053
|
signer,
|
|
1048
1054
|
});
|
|
@@ -1084,6 +1090,12 @@ describe("e2e tests", function test() {
|
|
|
1084
1090
|
signer,
|
|
1085
1091
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
1086
1092
|
});
|
|
1093
|
+
// we set the verifying keys
|
|
1094
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
1095
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
1096
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
1097
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
1098
|
+
});
|
|
1087
1099
|
});
|
|
1088
1100
|
it("should run the first poll", async () => {
|
|
1089
1101
|
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
@@ -1097,8 +1109,6 @@ describe("e2e tests", function test() {
|
|
|
1097
1109
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1098
1110
|
relayers: [await signer.getAddress()],
|
|
1099
1111
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1100
|
-
verifierContractAddress,
|
|
1101
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
1102
1112
|
policyContractAddress: pollPolicyContractAddress,
|
|
1103
1113
|
initialVoiceCreditProxyContractAddress,
|
|
1104
1114
|
});
|
|
@@ -1128,12 +1138,11 @@ describe("e2e tests", function test() {
|
|
|
1128
1138
|
await (0, sdk_1.joinPoll)({
|
|
1129
1139
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1130
1140
|
privateKey: users[i].privateKey.serialize(),
|
|
1131
|
-
stateIndex: BigInt(i + 1),
|
|
1132
1141
|
pollId: 0n,
|
|
1133
|
-
pollJoiningZkey: constants_1.
|
|
1134
|
-
useWasm
|
|
1135
|
-
|
|
1136
|
-
|
|
1142
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1143
|
+
useWasm,
|
|
1144
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1145
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1137
1146
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1138
1147
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1139
1148
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -1159,7 +1168,7 @@ describe("e2e tests", function test() {
|
|
|
1159
1168
|
pollId: 0n,
|
|
1160
1169
|
newVoteWeight: 9n,
|
|
1161
1170
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1162
|
-
salt: (0, crypto_1.
|
|
1171
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1163
1172
|
privateKey: users[0].privateKey.serialize(),
|
|
1164
1173
|
signer,
|
|
1165
1174
|
});
|
|
@@ -1167,7 +1176,7 @@ describe("e2e tests", function test() {
|
|
|
1167
1176
|
{
|
|
1168
1177
|
pollId: 0n,
|
|
1169
1178
|
voteOptionIndex: 0n,
|
|
1170
|
-
salt: (0, crypto_1.
|
|
1179
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1171
1180
|
nonce: 1n,
|
|
1172
1181
|
privateKey: users[0].privateKey,
|
|
1173
1182
|
stateIndex: 1n,
|
|
@@ -1215,8 +1224,6 @@ describe("e2e tests", function test() {
|
|
|
1215
1224
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1216
1225
|
relayers: [await signer.getAddress()],
|
|
1217
1226
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1218
|
-
verifierContractAddress,
|
|
1219
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
1220
1227
|
policyContractAddress: pollPolicyContractAddress,
|
|
1221
1228
|
initialVoiceCreditProxyContractAddress,
|
|
1222
1229
|
});
|
|
@@ -1232,8 +1239,6 @@ describe("e2e tests", function test() {
|
|
|
1232
1239
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1233
1240
|
relayers: [await signer.getAddress()],
|
|
1234
1241
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1235
|
-
verifierContractAddress,
|
|
1236
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
1237
1242
|
policyContractAddress: pollPolicyContractAddress,
|
|
1238
1243
|
initialVoiceCreditProxyContractAddress,
|
|
1239
1244
|
});
|
|
@@ -1241,18 +1246,18 @@ describe("e2e tests", function test() {
|
|
|
1241
1246
|
});
|
|
1242
1247
|
it("join the second and third polls", async () => {
|
|
1243
1248
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
1244
|
-
for (let
|
|
1249
|
+
for (let pollId = 1; pollId <= 2; pollId += 1) {
|
|
1250
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
1245
1251
|
for (let i = 0; i < users.length; i += 1) {
|
|
1246
1252
|
// eslint-disable-next-line no-await-in-loop
|
|
1247
1253
|
await (0, sdk_1.joinPoll)({
|
|
1248
1254
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1249
1255
|
privateKey: users[i].privateKey.serialize(),
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
pollWitgen: constants_1.testPollJoiningWitnessPath,
|
|
1256
|
+
pollId: BigInt(pollId),
|
|
1257
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1258
|
+
useWasm,
|
|
1259
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1260
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1256
1261
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1257
1262
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1258
1263
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -1261,7 +1266,7 @@ describe("e2e tests", function test() {
|
|
|
1261
1266
|
// eslint-disable-next-line no-await-in-loop
|
|
1262
1267
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
1263
1268
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1264
|
-
pollId: BigInt(
|
|
1269
|
+
pollId: BigInt(pollId),
|
|
1265
1270
|
pollPublicKey: users[i].publicKey.serialize(),
|
|
1266
1271
|
signer,
|
|
1267
1272
|
startBlock: 0,
|
|
@@ -1280,7 +1285,7 @@ describe("e2e tests", function test() {
|
|
|
1280
1285
|
pollId: 1n,
|
|
1281
1286
|
newVoteWeight: 9n,
|
|
1282
1287
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1283
|
-
salt: (0, crypto_1.
|
|
1288
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1284
1289
|
privateKey: users[0].privateKey.serialize(),
|
|
1285
1290
|
signer,
|
|
1286
1291
|
});
|
|
@@ -1292,7 +1297,7 @@ describe("e2e tests", function test() {
|
|
|
1292
1297
|
pollId: 1n,
|
|
1293
1298
|
newVoteWeight: 1n,
|
|
1294
1299
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1295
|
-
salt: (0, crypto_1.
|
|
1300
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1296
1301
|
privateKey: users[1].privateKey.serialize(),
|
|
1297
1302
|
signer,
|
|
1298
1303
|
});
|
|
@@ -1304,7 +1309,7 @@ describe("e2e tests", function test() {
|
|
|
1304
1309
|
pollId: 1n,
|
|
1305
1310
|
newVoteWeight: 3n,
|
|
1306
1311
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1307
|
-
salt: (0, crypto_1.
|
|
1312
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1308
1313
|
privateKey: users[2].privateKey.serialize(),
|
|
1309
1314
|
signer,
|
|
1310
1315
|
});
|
|
@@ -1314,7 +1319,7 @@ describe("e2e tests", function test() {
|
|
|
1314
1319
|
{
|
|
1315
1320
|
pollId: 1n,
|
|
1316
1321
|
voteOptionIndex: 0n,
|
|
1317
|
-
salt: (0, crypto_1.
|
|
1322
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1318
1323
|
nonce: 1n,
|
|
1319
1324
|
privateKey: users[0].privateKey,
|
|
1320
1325
|
stateIndex: 1n,
|
|
@@ -1340,7 +1345,7 @@ describe("e2e tests", function test() {
|
|
|
1340
1345
|
{
|
|
1341
1346
|
pollId: 2n,
|
|
1342
1347
|
voteOptionIndex: 7n,
|
|
1343
|
-
salt: (0, crypto_1.
|
|
1348
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1344
1349
|
nonce: 1n,
|
|
1345
1350
|
privateKey: users[4].privateKey,
|
|
1346
1351
|
stateIndex: 4n,
|
|
@@ -1352,7 +1357,7 @@ describe("e2e tests", function test() {
|
|
|
1352
1357
|
{
|
|
1353
1358
|
pollId: 2n,
|
|
1354
1359
|
voteOptionIndex: 5n,
|
|
1355
|
-
salt: (0, crypto_1.
|
|
1360
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1356
1361
|
nonce: 1n,
|
|
1357
1362
|
privateKey: users[5].privateKey,
|
|
1358
1363
|
stateIndex: 5n,
|
|
@@ -1382,7 +1387,7 @@ describe("e2e tests", function test() {
|
|
|
1382
1387
|
pollId: 2n,
|
|
1383
1388
|
newVoteWeight: 3n,
|
|
1384
1389
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1385
|
-
salt: (0, crypto_1.
|
|
1390
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1386
1391
|
privateKey: users[3].privateKey.serialize(),
|
|
1387
1392
|
signer,
|
|
1388
1393
|
});
|
|
@@ -1394,7 +1399,7 @@ describe("e2e tests", function test() {
|
|
|
1394
1399
|
pollId: 2n,
|
|
1395
1400
|
newVoteWeight: 2n,
|
|
1396
1401
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1397
|
-
salt: (0, crypto_1.
|
|
1402
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1398
1403
|
privateKey: users[4].privateKey.serialize(),
|
|
1399
1404
|
signer,
|
|
1400
1405
|
});
|
|
@@ -1406,7 +1411,7 @@ describe("e2e tests", function test() {
|
|
|
1406
1411
|
pollId: 2n,
|
|
1407
1412
|
newVoteWeight: 9n,
|
|
1408
1413
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1409
|
-
salt: (0, crypto_1.
|
|
1414
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1410
1415
|
privateKey: users[5].privateKey.serialize(),
|
|
1411
1416
|
signer,
|
|
1412
1417
|
});
|
|
@@ -1480,6 +1485,12 @@ describe("e2e tests", function test() {
|
|
|
1480
1485
|
signer,
|
|
1481
1486
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
1482
1487
|
});
|
|
1488
|
+
// we set the verifying keys
|
|
1489
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
1490
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
1491
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
1492
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
1493
|
+
});
|
|
1483
1494
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
1484
1495
|
// deploy a poll contract
|
|
1485
1496
|
await (0, sdk_1.deployPoll)({
|
|
@@ -1489,8 +1500,6 @@ describe("e2e tests", function test() {
|
|
|
1489
1500
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1490
1501
|
relayers: [await signer.getAddress()],
|
|
1491
1502
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1492
|
-
verifierContractAddress,
|
|
1493
|
-
vkRegistryContractAddress: vkRegistryAddress,
|
|
1494
1503
|
policyContractAddress: pollPolicyContractAddress,
|
|
1495
1504
|
initialVoiceCreditProxyContractAddress,
|
|
1496
1505
|
});
|
|
@@ -1508,12 +1517,11 @@ describe("e2e tests", function test() {
|
|
|
1508
1517
|
await (0, sdk_1.joinPoll)({
|
|
1509
1518
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1510
1519
|
privateKey: user.privateKey.serialize(),
|
|
1511
|
-
stateIndex: 1n,
|
|
1512
1520
|
pollId: 0n,
|
|
1513
|
-
pollJoiningZkey: constants_1.
|
|
1514
|
-
useWasm
|
|
1515
|
-
|
|
1516
|
-
|
|
1521
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1522
|
+
useWasm,
|
|
1523
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1524
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1517
1525
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1518
1526
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1519
1527
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -1529,7 +1537,7 @@ describe("e2e tests", function test() {
|
|
|
1529
1537
|
pollId: 0n,
|
|
1530
1538
|
newVoteWeight: 3n,
|
|
1531
1539
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1532
|
-
salt: (0, crypto_1.
|
|
1540
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1533
1541
|
privateKey: user.privateKey.serialize(),
|
|
1534
1542
|
signer,
|
|
1535
1543
|
});
|
|
@@ -1539,7 +1547,7 @@ describe("e2e tests", function test() {
|
|
|
1539
1547
|
{
|
|
1540
1548
|
pollId: 0n,
|
|
1541
1549
|
voteOptionIndex: 5n,
|
|
1542
|
-
salt: (0, crypto_1.
|
|
1550
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1543
1551
|
nonce: 1n,
|
|
1544
1552
|
privateKey: user.privateKey,
|
|
1545
1553
|
stateIndex: 1n,
|