@maci-protocol/testing 0.0.0-ci.ffb9e52 → 3.0.0
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/CHANGELOG.md +82 -0
- package/build/hardhat.config.js +1 -1
- package/build/hardhat.config.js.map +1 -1
- package/build/ts/__tests__/e2e.full.test.js +32 -34
- package/build/ts/__tests__/e2e.full.test.js.map +1 -1
- package/build/ts/__tests__/e2e.nonQv.test.js +49 -35
- package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
- package/build/ts/__tests__/e2e.test.js +102 -80
- package/build/ts/__tests__/e2e.test.js.map +1 -1
- package/build/ts/__tests__/integration.test.js +45 -46
- package/build/ts/__tests__/integration.test.js.map +1 -1
- package/build/ts/__tests__/keyChange.test.js +26 -21
- package/build/ts/__tests__/keyChange.test.js.map +1 -1
- package/build/ts/__tests__/maciKeys.test.js +1 -1
- 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 +189 -0
- package/build/ts/__tests__/stress/stress.full.test.js.map +1 -0
- package/build/ts/__tests__/unit/joinPoll.test.js +31 -60
- package/build/ts/__tests__/unit/joinPoll.test.js.map +1 -1
- package/build/ts/__tests__/unit/poll.test.js +8 -10
- package/build/ts/__tests__/unit/poll.test.js.map +1 -1
- package/build/ts/__tests__/unit/publish.test.js +8 -10
- 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 +6 -4
- package/build/ts/__tests__/unit/signup.test.js.map +1 -1
- package/build/ts/constants.d.ts +47 -47
- package/build/ts/constants.d.ts.map +1 -1
- package/build/ts/constants.js +72 -54
- package/build/ts/constants.js.map +1 -1
- package/build/ts/testingClass.d.ts +3 -3
- package/build/ts/testingClass.d.ts.map +1 -1
- package/build/ts/testingClass.js +26 -24
- package/build/ts/testingClass.js.map +1 -1
- package/build/ts/types.d.ts +3 -4
- package/build/ts/types.d.ts.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -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,10 +28,9 @@ describe("e2e tests", function test() {
|
|
|
27
28
|
const useWasm = (0, sdk_1.isArm)();
|
|
28
29
|
this.timeout(900000);
|
|
29
30
|
let maciAddresses;
|
|
30
|
-
let verifyingKeysRegistryAddress;
|
|
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,
|
|
@@ -50,15 +50,11 @@ describe("e2e tests", function test() {
|
|
|
50
50
|
};
|
|
51
51
|
// before all tests we deploy the verifying keys registry contract and set the verifying keys
|
|
52
52
|
before(async () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
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)), verifyingKeysRegistryAddress });
|
|
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
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
90
90
|
policyContractAddress: pollPolicyContractAddress,
|
|
91
91
|
initialVoiceCreditProxyContractAddress,
|
|
92
92
|
});
|
|
@@ -96,7 +96,7 @@ describe("e2e tests", function test() {
|
|
|
96
96
|
maciAddress: maciAddresses.maciContractAddress,
|
|
97
97
|
maciPublicKey: user.publicKey.serialize(),
|
|
98
98
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
99
|
-
signer,
|
|
99
|
+
signer: userSigners[0],
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
it("should join one user", async () => {
|
|
@@ -105,13 +105,13 @@ describe("e2e tests", function test() {
|
|
|
105
105
|
privateKey: user.privateKey.serialize(),
|
|
106
106
|
pollId: 0n,
|
|
107
107
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
108
|
-
useWasm
|
|
109
|
-
|
|
108
|
+
useWasm,
|
|
109
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
110
110
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
111
111
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
112
112
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
113
113
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
114
|
-
signer,
|
|
114
|
+
signer: userSigners[0],
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
it("should publish one message", async () => {
|
|
@@ -140,7 +140,7 @@ describe("e2e tests", function test() {
|
|
|
140
140
|
maciAddress: maciAddresses.maciContractAddress,
|
|
141
141
|
maciPublicKey: new domainobjs_1.Keypair().publicKey.serialize(),
|
|
142
142
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
143
|
-
signer,
|
|
143
|
+
signer: userSigners[1],
|
|
144
144
|
});
|
|
145
145
|
await (0, sdk_1.proveOnChain)({ ...constants_1.proveOnChainArgs, maciAddress: maciAddresses.maciContractAddress, signer });
|
|
146
146
|
await (0, sdk_1.verify)({
|
|
@@ -166,6 +166,12 @@ describe("e2e tests", function test() {
|
|
|
166
166
|
signer,
|
|
167
167
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
168
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
|
+
});
|
|
169
175
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
170
176
|
// deploy a poll contract
|
|
171
177
|
await (0, sdk_1.deployPoll)({
|
|
@@ -175,8 +181,6 @@ describe("e2e tests", function test() {
|
|
|
175
181
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
176
182
|
relayers: [await signer.getAddress()],
|
|
177
183
|
maciAddress: maciAddresses.maciContractAddress,
|
|
178
|
-
verifierContractAddress,
|
|
179
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
180
184
|
policyContractAddress: pollPolicyContractAddress,
|
|
181
185
|
initialVoiceCreditProxyContractAddress,
|
|
182
186
|
});
|
|
@@ -189,7 +193,7 @@ describe("e2e tests", function test() {
|
|
|
189
193
|
maciAddress: maciAddresses.maciContractAddress,
|
|
190
194
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
191
195
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
192
|
-
signer,
|
|
196
|
+
signer: userSigners[i],
|
|
193
197
|
});
|
|
194
198
|
}
|
|
195
199
|
});
|
|
@@ -202,13 +206,13 @@ describe("e2e tests", function test() {
|
|
|
202
206
|
privateKey: users[i].privateKey.serialize(),
|
|
203
207
|
pollId: 0n,
|
|
204
208
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
205
|
-
useWasm
|
|
206
|
-
|
|
209
|
+
useWasm,
|
|
210
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
207
211
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
208
212
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
209
213
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
210
214
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
211
|
-
signer,
|
|
215
|
+
signer: userSigners[i],
|
|
212
216
|
});
|
|
213
217
|
}
|
|
214
218
|
});
|
|
@@ -450,6 +454,12 @@ describe("e2e tests", function test() {
|
|
|
450
454
|
signer,
|
|
451
455
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
452
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
|
+
});
|
|
453
463
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
454
464
|
// deploy a poll contract
|
|
455
465
|
await (0, sdk_1.deployPoll)({
|
|
@@ -459,8 +469,6 @@ describe("e2e tests", function test() {
|
|
|
459
469
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
460
470
|
relayers: [await signer.getAddress()],
|
|
461
471
|
maciAddress: maciAddresses.maciContractAddress,
|
|
462
|
-
verifierContractAddress,
|
|
463
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
464
472
|
policyContractAddress: pollPolicyContractAddress,
|
|
465
473
|
initialVoiceCreditProxyContractAddress,
|
|
466
474
|
});
|
|
@@ -472,7 +480,7 @@ describe("e2e tests", function test() {
|
|
|
472
480
|
maciAddress: maciAddresses.maciContractAddress,
|
|
473
481
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
474
482
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
475
|
-
signer,
|
|
483
|
+
signer: userSigners[i],
|
|
476
484
|
});
|
|
477
485
|
}
|
|
478
486
|
});
|
|
@@ -483,13 +491,13 @@ describe("e2e tests", function test() {
|
|
|
483
491
|
privateKey: users[0].privateKey.serialize(),
|
|
484
492
|
pollId: 0n,
|
|
485
493
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
486
|
-
useWasm
|
|
487
|
-
|
|
494
|
+
useWasm,
|
|
495
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
488
496
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
489
497
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
490
498
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
491
499
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
492
|
-
signer,
|
|
500
|
+
signer: userSigners[0],
|
|
493
501
|
});
|
|
494
502
|
});
|
|
495
503
|
it("should publish and relay 12 messages with the same nonce", async () => {
|
|
@@ -561,6 +569,12 @@ describe("e2e tests", function test() {
|
|
|
561
569
|
signer,
|
|
562
570
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
563
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
|
+
});
|
|
564
578
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
565
579
|
// deploy a poll contract
|
|
566
580
|
await (0, sdk_1.deployPoll)({
|
|
@@ -570,8 +584,6 @@ describe("e2e tests", function test() {
|
|
|
570
584
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
571
585
|
relayers: [await signer.getAddress()],
|
|
572
586
|
maciAddress: maciAddresses.maciContractAddress,
|
|
573
|
-
verifierContractAddress,
|
|
574
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
575
587
|
policyContractAddress: pollPolicyContractAddress,
|
|
576
588
|
initialVoiceCreditProxyContractAddress,
|
|
577
589
|
});
|
|
@@ -584,7 +596,7 @@ describe("e2e tests", function test() {
|
|
|
584
596
|
maciAddress: maciAddresses.maciContractAddress,
|
|
585
597
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
586
598
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
587
|
-
signer,
|
|
599
|
+
signer: userSigners[i],
|
|
588
600
|
});
|
|
589
601
|
}
|
|
590
602
|
});
|
|
@@ -597,13 +609,13 @@ describe("e2e tests", function test() {
|
|
|
597
609
|
privateKey: users[i].privateKey.serialize(),
|
|
598
610
|
pollId: 0n,
|
|
599
611
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
600
|
-
useWasm
|
|
601
|
-
|
|
612
|
+
useWasm,
|
|
613
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
602
614
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
603
615
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
604
616
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
605
617
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
606
|
-
signer,
|
|
618
|
+
signer: userSigners[i],
|
|
607
619
|
});
|
|
608
620
|
}
|
|
609
621
|
});
|
|
@@ -653,6 +665,12 @@ describe("e2e tests", function test() {
|
|
|
653
665
|
signer,
|
|
654
666
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
655
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
|
+
});
|
|
656
674
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
657
675
|
// deploy a poll contract
|
|
658
676
|
await (0, sdk_1.deployPoll)({
|
|
@@ -662,8 +680,6 @@ describe("e2e tests", function test() {
|
|
|
662
680
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
663
681
|
relayers: [await signer.getAddress()],
|
|
664
682
|
maciAddress: maciAddresses.maciContractAddress,
|
|
665
|
-
verifierContractAddress,
|
|
666
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
667
683
|
policyContractAddress: pollPolicyContractAddress,
|
|
668
684
|
initialVoiceCreditProxyContractAddress,
|
|
669
685
|
});
|
|
@@ -676,7 +692,7 @@ describe("e2e tests", function test() {
|
|
|
676
692
|
maciAddress: maciAddresses.maciContractAddress,
|
|
677
693
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
678
694
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
679
|
-
signer,
|
|
695
|
+
signer: userSigners[i],
|
|
680
696
|
});
|
|
681
697
|
}
|
|
682
698
|
});
|
|
@@ -689,13 +705,13 @@ describe("e2e tests", function test() {
|
|
|
689
705
|
privateKey: users[i].privateKey.serialize(),
|
|
690
706
|
pollId: 0n,
|
|
691
707
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
692
|
-
useWasm
|
|
693
|
-
|
|
708
|
+
useWasm,
|
|
709
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
694
710
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
695
711
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
696
712
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
697
713
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
698
|
-
signer,
|
|
714
|
+
signer: userSigners[i],
|
|
699
715
|
});
|
|
700
716
|
}
|
|
701
717
|
});
|
|
@@ -706,7 +722,7 @@ describe("e2e tests", function test() {
|
|
|
706
722
|
await (0, sdk_1.publish)({
|
|
707
723
|
maciAddress: maciAddresses.maciContractAddress,
|
|
708
724
|
publicKey: users[i].publicKey.serialize(),
|
|
709
|
-
stateIndex:
|
|
725
|
+
stateIndex: BigInt(i + 1),
|
|
710
726
|
voteOptionIndex: 0n,
|
|
711
727
|
nonce: 1n,
|
|
712
728
|
pollId: 0n,
|
|
@@ -797,6 +813,12 @@ describe("e2e tests", function test() {
|
|
|
797
813
|
signer,
|
|
798
814
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
799
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
|
+
});
|
|
800
822
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
801
823
|
// deploy a poll contract
|
|
802
824
|
await (0, sdk_1.deployPoll)({
|
|
@@ -806,8 +828,6 @@ describe("e2e tests", function test() {
|
|
|
806
828
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
807
829
|
relayers: [await signer.getAddress()],
|
|
808
830
|
maciAddress: maciAddresses.maciContractAddress,
|
|
809
|
-
verifierContractAddress,
|
|
810
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
811
831
|
policyContractAddress: pollPolicyContractAddress,
|
|
812
832
|
initialVoiceCreditProxyContractAddress,
|
|
813
833
|
});
|
|
@@ -816,7 +836,7 @@ describe("e2e tests", function test() {
|
|
|
816
836
|
maciAddress: maciAddresses.maciContractAddress,
|
|
817
837
|
maciPublicKey: users[0].publicKey.serialize(),
|
|
818
838
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
819
|
-
signer,
|
|
839
|
+
signer: userSigners[0],
|
|
820
840
|
});
|
|
821
841
|
// joinPoll
|
|
822
842
|
await (0, sdk_1.joinPoll)({
|
|
@@ -824,13 +844,13 @@ describe("e2e tests", function test() {
|
|
|
824
844
|
privateKey: users[0].privateKey.serialize(),
|
|
825
845
|
pollId: 0n,
|
|
826
846
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
827
|
-
useWasm
|
|
828
|
-
|
|
847
|
+
useWasm,
|
|
848
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
829
849
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
830
850
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
831
851
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
832
852
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
833
|
-
signer,
|
|
853
|
+
signer: userSigners[0],
|
|
834
854
|
});
|
|
835
855
|
// publish
|
|
836
856
|
await (0, sdk_1.publish)({
|
|
@@ -849,13 +869,13 @@ describe("e2e tests", function test() {
|
|
|
849
869
|
maciAddress: maciAddresses.maciContractAddress,
|
|
850
870
|
maciPublicKey: users[1].publicKey.serialize(),
|
|
851
871
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
852
|
-
signer,
|
|
872
|
+
signer: userSigners[1],
|
|
853
873
|
});
|
|
854
874
|
await (0, sdk_1.signup)({
|
|
855
875
|
maciAddress: maciAddresses.maciContractAddress,
|
|
856
876
|
maciPublicKey: users[2].publicKey.serialize(),
|
|
857
877
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
858
|
-
signer,
|
|
878
|
+
signer: userSigners[2],
|
|
859
879
|
});
|
|
860
880
|
// joinPoll
|
|
861
881
|
await (0, sdk_1.joinPoll)({
|
|
@@ -863,13 +883,13 @@ describe("e2e tests", function test() {
|
|
|
863
883
|
privateKey: users[1].privateKey.serialize(),
|
|
864
884
|
pollId: 0n,
|
|
865
885
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
866
|
-
useWasm
|
|
867
|
-
|
|
886
|
+
useWasm,
|
|
887
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
868
888
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
869
889
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
870
890
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
871
891
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
872
|
-
signer,
|
|
892
|
+
signer: userSigners[1],
|
|
873
893
|
});
|
|
874
894
|
const votes = [
|
|
875
895
|
{
|
|
@@ -922,8 +942,6 @@ describe("e2e tests", function test() {
|
|
|
922
942
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
923
943
|
relayers: [await signer.getAddress()],
|
|
924
944
|
maciAddress: maciAddresses.maciContractAddress,
|
|
925
|
-
verifierContractAddress,
|
|
926
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
927
945
|
policyContractAddress: pollPolicyContractAddress,
|
|
928
946
|
initialVoiceCreditProxyContractAddress,
|
|
929
947
|
});
|
|
@@ -933,13 +951,13 @@ describe("e2e tests", function test() {
|
|
|
933
951
|
maciAddress: maciAddresses.maciContractAddress,
|
|
934
952
|
maciPublicKey: users[3].publicKey.serialize(),
|
|
935
953
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
936
|
-
signer,
|
|
954
|
+
signer: userSigners[3],
|
|
937
955
|
});
|
|
938
956
|
await (0, sdk_1.signup)({
|
|
939
957
|
maciAddress: maciAddresses.maciContractAddress,
|
|
940
958
|
maciPublicKey: users[4].publicKey.serialize(),
|
|
941
959
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
942
|
-
signer,
|
|
960
|
+
signer: userSigners[4],
|
|
943
961
|
});
|
|
944
962
|
});
|
|
945
963
|
it("should join users", async () => {
|
|
@@ -949,13 +967,13 @@ describe("e2e tests", function test() {
|
|
|
949
967
|
privateKey: users[3].privateKey.serialize(),
|
|
950
968
|
pollId: 1n,
|
|
951
969
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
952
|
-
useWasm
|
|
953
|
-
|
|
970
|
+
useWasm,
|
|
971
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
954
972
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
955
973
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
956
974
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
957
975
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
958
|
-
signer,
|
|
976
|
+
signer: userSigners[3],
|
|
959
977
|
});
|
|
960
978
|
// joinPoll
|
|
961
979
|
await (0, sdk_1.joinPoll)({
|
|
@@ -963,13 +981,13 @@ describe("e2e tests", function test() {
|
|
|
963
981
|
privateKey: users[4].privateKey.serialize(),
|
|
964
982
|
pollId: 1n,
|
|
965
983
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
966
|
-
useWasm
|
|
967
|
-
|
|
984
|
+
useWasm,
|
|
985
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
968
986
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
969
987
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
970
988
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
971
989
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
972
|
-
signer,
|
|
990
|
+
signer: userSigners[4],
|
|
973
991
|
});
|
|
974
992
|
});
|
|
975
993
|
it("should relay new messages", async () => {
|
|
@@ -1075,6 +1093,12 @@ describe("e2e tests", function test() {
|
|
|
1075
1093
|
signer,
|
|
1076
1094
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
1077
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
|
+
});
|
|
1078
1102
|
});
|
|
1079
1103
|
it("should run the first poll", async () => {
|
|
1080
1104
|
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
@@ -1088,8 +1112,6 @@ describe("e2e tests", function test() {
|
|
|
1088
1112
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1089
1113
|
relayers: [await signer.getAddress()],
|
|
1090
1114
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1091
|
-
verifierContractAddress,
|
|
1092
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1093
1115
|
policyContractAddress: pollPolicyContractAddress,
|
|
1094
1116
|
initialVoiceCreditProxyContractAddress,
|
|
1095
1117
|
});
|
|
@@ -1101,7 +1123,7 @@ describe("e2e tests", function test() {
|
|
|
1101
1123
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1102
1124
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
1103
1125
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
1104
|
-
signer,
|
|
1126
|
+
signer: userSigners[i],
|
|
1105
1127
|
});
|
|
1106
1128
|
// eslint-disable-next-line no-await-in-loop
|
|
1107
1129
|
const { isRegistered, stateIndex } = await (0, sdk_1.getSignedupUserData)({
|
|
@@ -1121,13 +1143,13 @@ describe("e2e tests", function test() {
|
|
|
1121
1143
|
privateKey: users[i].privateKey.serialize(),
|
|
1122
1144
|
pollId: 0n,
|
|
1123
1145
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1124
|
-
useWasm
|
|
1125
|
-
|
|
1146
|
+
useWasm,
|
|
1147
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1126
1148
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1127
1149
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1128
1150
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1129
1151
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
1130
|
-
signer,
|
|
1152
|
+
signer: userSigners[i],
|
|
1131
1153
|
});
|
|
1132
1154
|
// eslint-disable-next-line no-await-in-loop
|
|
1133
1155
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
@@ -1205,8 +1227,6 @@ describe("e2e tests", function test() {
|
|
|
1205
1227
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1206
1228
|
relayers: [await signer.getAddress()],
|
|
1207
1229
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1208
|
-
verifierContractAddress,
|
|
1209
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1210
1230
|
policyContractAddress: pollPolicyContractAddress,
|
|
1211
1231
|
initialVoiceCreditProxyContractAddress,
|
|
1212
1232
|
});
|
|
@@ -1222,8 +1242,6 @@ describe("e2e tests", function test() {
|
|
|
1222
1242
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1223
1243
|
relayers: [await signer.getAddress()],
|
|
1224
1244
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1225
|
-
verifierContractAddress,
|
|
1226
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1227
1245
|
policyContractAddress: pollPolicyContractAddress,
|
|
1228
1246
|
initialVoiceCreditProxyContractAddress,
|
|
1229
1247
|
});
|
|
@@ -1240,13 +1258,13 @@ describe("e2e tests", function test() {
|
|
|
1240
1258
|
privateKey: users[i].privateKey.serialize(),
|
|
1241
1259
|
pollId: BigInt(pollId),
|
|
1242
1260
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1243
|
-
useWasm
|
|
1244
|
-
|
|
1261
|
+
useWasm,
|
|
1262
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1245
1263
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1246
1264
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1247
1265
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1248
1266
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
1249
|
-
signer,
|
|
1267
|
+
signer: userSigners[i],
|
|
1250
1268
|
});
|
|
1251
1269
|
// eslint-disable-next-line no-await-in-loop
|
|
1252
1270
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
@@ -1470,6 +1488,12 @@ describe("e2e tests", function test() {
|
|
|
1470
1488
|
signer,
|
|
1471
1489
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
1472
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
|
+
});
|
|
1473
1497
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
1474
1498
|
// deploy a poll contract
|
|
1475
1499
|
await (0, sdk_1.deployPoll)({
|
|
@@ -1479,8 +1503,6 @@ describe("e2e tests", function test() {
|
|
|
1479
1503
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1480
1504
|
relayers: [await signer.getAddress()],
|
|
1481
1505
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1482
|
-
verifierContractAddress,
|
|
1483
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1484
1506
|
policyContractAddress: pollPolicyContractAddress,
|
|
1485
1507
|
initialVoiceCreditProxyContractAddress,
|
|
1486
1508
|
});
|
|
@@ -1500,8 +1522,8 @@ describe("e2e tests", function test() {
|
|
|
1500
1522
|
privateKey: user.privateKey.serialize(),
|
|
1501
1523
|
pollId: 0n,
|
|
1502
1524
|
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1503
|
-
useWasm
|
|
1504
|
-
|
|
1525
|
+
useWasm,
|
|
1526
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1505
1527
|
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1506
1528
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1507
1529
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|