@maci-protocol/testing 0.0.0-ci.20c52c6 → 0.0.0-ci.22106c8
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/hardhat.config.js +1 -1
- package/build/hardhat.config.js.map +1 -1
- 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 +842 -0
- package/build/ts/__tests__/e2e.full.test.js.map +1 -0
- package/build/ts/__tests__/e2e.nonQv.test.js +426 -26
- package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
- package/build/ts/__tests__/e2e.test.js +135 -124
- package/build/ts/__tests__/e2e.test.js.map +1 -1
- package/build/ts/__tests__/integration.test.js +46 -48
- package/build/ts/__tests__/integration.test.js.map +1 -1
- package/build/ts/__tests__/keyChange.test.js +40 -38
- package/build/ts/__tests__/keyChange.test.js.map +1 -1
- package/build/ts/__tests__/maciKeys.test.js +7 -7
- 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 +38 -75
- 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 +48 -52
- package/build/ts/constants.d.ts.map +1 -1
- package/build/ts/constants.js +95 -73
- 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 +33 -32
- package/build/ts/testingClass.js.map +1 -1
- package/build/ts/types.d.ts +10 -11
- package/build/ts/types.d.ts.map +1 -1
- package/build/ts/utils.d.ts +1 -1
- package/build/ts/utils.d.ts.map +1 -1
- package/build/ts/utils.js +9 -9
- package/build/ts/utils.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -18
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const contracts_1 = require("@maci-protocol/contracts");
|
|
6
7
|
const core_1 = require("@maci-protocol/core");
|
|
7
8
|
const crypto_1 = require("@maci-protocol/crypto");
|
|
8
9
|
const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
@@ -27,38 +28,33 @@ describe("e2e tests", function test() {
|
|
|
27
28
|
const useWasm = (0, sdk_1.isArm)();
|
|
28
29
|
this.timeout(900000);
|
|
29
30
|
let maciAddresses;
|
|
30
|
-
let 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,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
voteTallyZkey: constants_1.testTallyVotesZkeyPath,
|
|
38
|
+
messageProcessorZkey: constants_1.testProcessMessageZkeyPath,
|
|
39
39
|
pollId: 0n,
|
|
40
40
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
messageProcessorWitnessGenerator: constants_1.testProcessMessagesWitnessPath,
|
|
42
|
+
messageProcessorWitnessDatFile: constants_1.testProcessMessagesWitnessDatPath,
|
|
43
|
+
voteTallyWitnessGenerator: constants_1.testTallyVotesWitnessPath,
|
|
44
|
+
voteTallyWitnessDatFile: constants_1.testTallyVotesWitnessDatPath,
|
|
45
45
|
coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
messageProcessorWasm: constants_1.testProcessMessagesWasmPath,
|
|
47
|
+
voteTallyWasm: constants_1.testTallyVotesWasmPath,
|
|
48
48
|
useWasm,
|
|
49
49
|
mode: core_1.EMode.QV,
|
|
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,23 +96,22 @@ describe("e2e tests", function test() {
|
|
|
96
96
|
maciAddress: maciAddresses.maciContractAddress,
|
|
97
97
|
maciPublicKey: user.publicKey.serialize(),
|
|
98
98
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
99
|
-
signer,
|
|
99
|
+
signer: userSigners[0],
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
it("should join one user", async () => {
|
|
103
103
|
await (0, sdk_1.joinPoll)({
|
|
104
104
|
maciAddress: maciAddresses.maciContractAddress,
|
|
105
105
|
privateKey: user.privateKey.serialize(),
|
|
106
|
-
stateIndex: 1n,
|
|
107
106
|
pollId: 0n,
|
|
108
|
-
pollJoiningZkey: constants_1.
|
|
109
|
-
useWasm
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
108
|
+
useWasm,
|
|
109
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
110
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
112
111
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
113
112
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
114
113
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
115
|
-
signer,
|
|
114
|
+
signer: userSigners[0],
|
|
116
115
|
});
|
|
117
116
|
});
|
|
118
117
|
it("should publish one message", async () => {
|
|
@@ -141,7 +140,7 @@ describe("e2e tests", function test() {
|
|
|
141
140
|
maciAddress: maciAddresses.maciContractAddress,
|
|
142
141
|
maciPublicKey: new domainobjs_1.Keypair().publicKey.serialize(),
|
|
143
142
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
144
|
-
signer,
|
|
143
|
+
signer: userSigners[1],
|
|
145
144
|
});
|
|
146
145
|
await (0, sdk_1.proveOnChain)({ ...constants_1.proveOnChainArgs, maciAddress: maciAddresses.maciContractAddress, signer });
|
|
147
146
|
await (0, sdk_1.verify)({
|
|
@@ -167,6 +166,12 @@ describe("e2e tests", function test() {
|
|
|
167
166
|
signer,
|
|
168
167
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
169
168
|
});
|
|
169
|
+
// we set the verifying keys
|
|
170
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
171
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
172
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
173
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
174
|
+
});
|
|
170
175
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
171
176
|
// deploy a poll contract
|
|
172
177
|
await (0, sdk_1.deployPoll)({
|
|
@@ -176,8 +181,6 @@ describe("e2e tests", function test() {
|
|
|
176
181
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
177
182
|
relayers: [await signer.getAddress()],
|
|
178
183
|
maciAddress: maciAddresses.maciContractAddress,
|
|
179
|
-
verifierContractAddress,
|
|
180
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
181
184
|
policyContractAddress: pollPolicyContractAddress,
|
|
182
185
|
initialVoiceCreditProxyContractAddress,
|
|
183
186
|
});
|
|
@@ -190,7 +193,7 @@ describe("e2e tests", function test() {
|
|
|
190
193
|
maciAddress: maciAddresses.maciContractAddress,
|
|
191
194
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
192
195
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
193
|
-
signer,
|
|
196
|
+
signer: userSigners[i],
|
|
194
197
|
});
|
|
195
198
|
}
|
|
196
199
|
});
|
|
@@ -201,16 +204,15 @@ describe("e2e tests", function test() {
|
|
|
201
204
|
await (0, sdk_1.joinPoll)({
|
|
202
205
|
maciAddress: maciAddresses.maciContractAddress,
|
|
203
206
|
privateKey: users[i].privateKey.serialize(),
|
|
204
|
-
stateIndex: BigInt(i + 1),
|
|
205
207
|
pollId: 0n,
|
|
206
|
-
pollJoiningZkey: constants_1.
|
|
207
|
-
useWasm
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
209
|
+
useWasm,
|
|
210
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
211
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
210
212
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
211
213
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
212
214
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
213
|
-
signer,
|
|
215
|
+
signer: userSigners[i],
|
|
214
216
|
});
|
|
215
217
|
}
|
|
216
218
|
});
|
|
@@ -452,6 +454,12 @@ describe("e2e tests", function test() {
|
|
|
452
454
|
signer,
|
|
453
455
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
454
456
|
});
|
|
457
|
+
// we set the verifying keys
|
|
458
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
459
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
460
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
461
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
462
|
+
});
|
|
455
463
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
456
464
|
// deploy a poll contract
|
|
457
465
|
await (0, sdk_1.deployPoll)({
|
|
@@ -461,8 +469,6 @@ describe("e2e tests", function test() {
|
|
|
461
469
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
462
470
|
relayers: [await signer.getAddress()],
|
|
463
471
|
maciAddress: maciAddresses.maciContractAddress,
|
|
464
|
-
verifierContractAddress,
|
|
465
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
466
472
|
policyContractAddress: pollPolicyContractAddress,
|
|
467
473
|
initialVoiceCreditProxyContractAddress,
|
|
468
474
|
});
|
|
@@ -474,7 +480,7 @@ describe("e2e tests", function test() {
|
|
|
474
480
|
maciAddress: maciAddresses.maciContractAddress,
|
|
475
481
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
476
482
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
477
|
-
signer,
|
|
483
|
+
signer: userSigners[i],
|
|
478
484
|
});
|
|
479
485
|
}
|
|
480
486
|
});
|
|
@@ -483,16 +489,15 @@ describe("e2e tests", function test() {
|
|
|
483
489
|
await (0, sdk_1.joinPoll)({
|
|
484
490
|
maciAddress: maciAddresses.maciContractAddress,
|
|
485
491
|
privateKey: users[0].privateKey.serialize(),
|
|
486
|
-
stateIndex: 1n,
|
|
487
492
|
pollId: 0n,
|
|
488
|
-
pollJoiningZkey: constants_1.
|
|
489
|
-
useWasm
|
|
490
|
-
|
|
491
|
-
|
|
493
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
494
|
+
useWasm,
|
|
495
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
496
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
492
497
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
493
498
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
494
499
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
495
|
-
signer,
|
|
500
|
+
signer: userSigners[0],
|
|
496
501
|
});
|
|
497
502
|
});
|
|
498
503
|
it("should publish and relay 12 messages with the same nonce", async () => {
|
|
@@ -564,6 +569,12 @@ describe("e2e tests", function test() {
|
|
|
564
569
|
signer,
|
|
565
570
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
566
571
|
});
|
|
572
|
+
// we set the verifying keys
|
|
573
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
574
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
575
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
576
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
577
|
+
});
|
|
567
578
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
568
579
|
// deploy a poll contract
|
|
569
580
|
await (0, sdk_1.deployPoll)({
|
|
@@ -573,8 +584,6 @@ describe("e2e tests", function test() {
|
|
|
573
584
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
574
585
|
relayers: [await signer.getAddress()],
|
|
575
586
|
maciAddress: maciAddresses.maciContractAddress,
|
|
576
|
-
verifierContractAddress,
|
|
577
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
578
587
|
policyContractAddress: pollPolicyContractAddress,
|
|
579
588
|
initialVoiceCreditProxyContractAddress,
|
|
580
589
|
});
|
|
@@ -587,7 +596,7 @@ describe("e2e tests", function test() {
|
|
|
587
596
|
maciAddress: maciAddresses.maciContractAddress,
|
|
588
597
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
589
598
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
590
|
-
signer,
|
|
599
|
+
signer: userSigners[i],
|
|
591
600
|
});
|
|
592
601
|
}
|
|
593
602
|
});
|
|
@@ -598,16 +607,15 @@ describe("e2e tests", function test() {
|
|
|
598
607
|
await (0, sdk_1.joinPoll)({
|
|
599
608
|
maciAddress: maciAddresses.maciContractAddress,
|
|
600
609
|
privateKey: users[i].privateKey.serialize(),
|
|
601
|
-
stateIndex: BigInt(i + 1),
|
|
602
610
|
pollId: 0n,
|
|
603
|
-
pollJoiningZkey: constants_1.
|
|
604
|
-
useWasm
|
|
605
|
-
|
|
606
|
-
|
|
611
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
612
|
+
useWasm,
|
|
613
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
614
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
607
615
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
608
616
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
609
617
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
610
|
-
signer,
|
|
618
|
+
signer: userSigners[i],
|
|
611
619
|
});
|
|
612
620
|
}
|
|
613
621
|
});
|
|
@@ -657,6 +665,12 @@ describe("e2e tests", function test() {
|
|
|
657
665
|
signer,
|
|
658
666
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
659
667
|
});
|
|
668
|
+
// we set the verifying keys
|
|
669
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
670
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
671
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
672
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
673
|
+
});
|
|
660
674
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
661
675
|
// deploy a poll contract
|
|
662
676
|
await (0, sdk_1.deployPoll)({
|
|
@@ -666,8 +680,6 @@ describe("e2e tests", function test() {
|
|
|
666
680
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
667
681
|
relayers: [await signer.getAddress()],
|
|
668
682
|
maciAddress: maciAddresses.maciContractAddress,
|
|
669
|
-
verifierContractAddress,
|
|
670
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
671
683
|
policyContractAddress: pollPolicyContractAddress,
|
|
672
684
|
initialVoiceCreditProxyContractAddress,
|
|
673
685
|
});
|
|
@@ -680,7 +692,7 @@ describe("e2e tests", function test() {
|
|
|
680
692
|
maciAddress: maciAddresses.maciContractAddress,
|
|
681
693
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
682
694
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
683
|
-
signer,
|
|
695
|
+
signer: userSigners[i],
|
|
684
696
|
});
|
|
685
697
|
}
|
|
686
698
|
});
|
|
@@ -691,16 +703,15 @@ describe("e2e tests", function test() {
|
|
|
691
703
|
await (0, sdk_1.joinPoll)({
|
|
692
704
|
maciAddress: maciAddresses.maciContractAddress,
|
|
693
705
|
privateKey: users[i].privateKey.serialize(),
|
|
694
|
-
stateIndex: BigInt(i + 1),
|
|
695
706
|
pollId: 0n,
|
|
696
|
-
pollJoiningZkey: constants_1.
|
|
697
|
-
useWasm
|
|
698
|
-
|
|
699
|
-
|
|
707
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
708
|
+
useWasm,
|
|
709
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
710
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
700
711
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
701
712
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
702
713
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
703
|
-
signer,
|
|
714
|
+
signer: userSigners[i],
|
|
704
715
|
});
|
|
705
716
|
}
|
|
706
717
|
});
|
|
@@ -711,7 +722,7 @@ describe("e2e tests", function test() {
|
|
|
711
722
|
await (0, sdk_1.publish)({
|
|
712
723
|
maciAddress: maciAddresses.maciContractAddress,
|
|
713
724
|
publicKey: users[i].publicKey.serialize(),
|
|
714
|
-
stateIndex:
|
|
725
|
+
stateIndex: BigInt(i + 1),
|
|
715
726
|
voteOptionIndex: 0n,
|
|
716
727
|
nonce: 1n,
|
|
717
728
|
pollId: 0n,
|
|
@@ -802,6 +813,12 @@ describe("e2e tests", function test() {
|
|
|
802
813
|
signer,
|
|
803
814
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
804
815
|
});
|
|
816
|
+
// we set the verifying keys
|
|
817
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
818
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
819
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
820
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
821
|
+
});
|
|
805
822
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
806
823
|
// deploy a poll contract
|
|
807
824
|
await (0, sdk_1.deployPoll)({
|
|
@@ -811,8 +828,6 @@ describe("e2e tests", function test() {
|
|
|
811
828
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
812
829
|
relayers: [await signer.getAddress()],
|
|
813
830
|
maciAddress: maciAddresses.maciContractAddress,
|
|
814
|
-
verifierContractAddress,
|
|
815
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
816
831
|
policyContractAddress: pollPolicyContractAddress,
|
|
817
832
|
initialVoiceCreditProxyContractAddress,
|
|
818
833
|
});
|
|
@@ -821,22 +836,21 @@ describe("e2e tests", function test() {
|
|
|
821
836
|
maciAddress: maciAddresses.maciContractAddress,
|
|
822
837
|
maciPublicKey: users[0].publicKey.serialize(),
|
|
823
838
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
824
|
-
signer,
|
|
839
|
+
signer: userSigners[0],
|
|
825
840
|
});
|
|
826
841
|
// joinPoll
|
|
827
842
|
await (0, sdk_1.joinPoll)({
|
|
828
843
|
maciAddress: maciAddresses.maciContractAddress,
|
|
829
844
|
privateKey: users[0].privateKey.serialize(),
|
|
830
|
-
stateIndex: 1n,
|
|
831
845
|
pollId: 0n,
|
|
832
|
-
pollJoiningZkey: constants_1.
|
|
833
|
-
useWasm
|
|
834
|
-
|
|
835
|
-
|
|
846
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
847
|
+
useWasm,
|
|
848
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
849
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
836
850
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
837
851
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
838
852
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
839
|
-
signer,
|
|
853
|
+
signer: userSigners[0],
|
|
840
854
|
});
|
|
841
855
|
// publish
|
|
842
856
|
await (0, sdk_1.publish)({
|
|
@@ -855,28 +869,27 @@ describe("e2e tests", function test() {
|
|
|
855
869
|
maciAddress: maciAddresses.maciContractAddress,
|
|
856
870
|
maciPublicKey: users[1].publicKey.serialize(),
|
|
857
871
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
858
|
-
signer,
|
|
872
|
+
signer: userSigners[1],
|
|
859
873
|
});
|
|
860
874
|
await (0, sdk_1.signup)({
|
|
861
875
|
maciAddress: maciAddresses.maciContractAddress,
|
|
862
876
|
maciPublicKey: users[2].publicKey.serialize(),
|
|
863
877
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
864
|
-
signer,
|
|
878
|
+
signer: userSigners[2],
|
|
865
879
|
});
|
|
866
880
|
// joinPoll
|
|
867
881
|
await (0, sdk_1.joinPoll)({
|
|
868
882
|
maciAddress: maciAddresses.maciContractAddress,
|
|
869
883
|
privateKey: users[1].privateKey.serialize(),
|
|
870
|
-
stateIndex: 2n,
|
|
871
884
|
pollId: 0n,
|
|
872
|
-
pollJoiningZkey: constants_1.
|
|
873
|
-
useWasm
|
|
874
|
-
|
|
875
|
-
|
|
885
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
886
|
+
useWasm,
|
|
887
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
888
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
876
889
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
877
890
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
878
891
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
879
|
-
signer,
|
|
892
|
+
signer: userSigners[1],
|
|
880
893
|
});
|
|
881
894
|
const votes = [
|
|
882
895
|
{
|
|
@@ -929,8 +942,6 @@ describe("e2e tests", function test() {
|
|
|
929
942
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
930
943
|
relayers: [await signer.getAddress()],
|
|
931
944
|
maciAddress: maciAddresses.maciContractAddress,
|
|
932
|
-
verifierContractAddress,
|
|
933
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
934
945
|
policyContractAddress: pollPolicyContractAddress,
|
|
935
946
|
initialVoiceCreditProxyContractAddress,
|
|
936
947
|
});
|
|
@@ -940,13 +951,13 @@ describe("e2e tests", function test() {
|
|
|
940
951
|
maciAddress: maciAddresses.maciContractAddress,
|
|
941
952
|
maciPublicKey: users[3].publicKey.serialize(),
|
|
942
953
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
943
|
-
signer,
|
|
954
|
+
signer: userSigners[3],
|
|
944
955
|
});
|
|
945
956
|
await (0, sdk_1.signup)({
|
|
946
957
|
maciAddress: maciAddresses.maciContractAddress,
|
|
947
958
|
maciPublicKey: users[4].publicKey.serialize(),
|
|
948
959
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
949
|
-
signer,
|
|
960
|
+
signer: userSigners[4],
|
|
950
961
|
});
|
|
951
962
|
});
|
|
952
963
|
it("should join users", async () => {
|
|
@@ -954,31 +965,29 @@ describe("e2e tests", function test() {
|
|
|
954
965
|
await (0, sdk_1.joinPoll)({
|
|
955
966
|
maciAddress: maciAddresses.maciContractAddress,
|
|
956
967
|
privateKey: users[3].privateKey.serialize(),
|
|
957
|
-
stateIndex: 4n,
|
|
958
968
|
pollId: 1n,
|
|
959
|
-
pollJoiningZkey: constants_1.
|
|
960
|
-
useWasm
|
|
961
|
-
|
|
962
|
-
|
|
969
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
970
|
+
useWasm,
|
|
971
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
972
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
963
973
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
964
974
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
965
975
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
966
|
-
signer,
|
|
976
|
+
signer: userSigners[3],
|
|
967
977
|
});
|
|
968
978
|
// joinPoll
|
|
969
979
|
await (0, sdk_1.joinPoll)({
|
|
970
980
|
maciAddress: maciAddresses.maciContractAddress,
|
|
971
981
|
privateKey: users[4].privateKey.serialize(),
|
|
972
|
-
stateIndex: 5n,
|
|
973
982
|
pollId: 1n,
|
|
974
|
-
pollJoiningZkey: constants_1.
|
|
975
|
-
useWasm
|
|
976
|
-
|
|
977
|
-
|
|
983
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
984
|
+
useWasm,
|
|
985
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
986
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
978
987
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
979
988
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
980
989
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
981
|
-
signer,
|
|
990
|
+
signer: userSigners[4],
|
|
982
991
|
});
|
|
983
992
|
});
|
|
984
993
|
it("should relay new messages", async () => {
|
|
@@ -1084,6 +1093,12 @@ describe("e2e tests", function test() {
|
|
|
1084
1093
|
signer,
|
|
1085
1094
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
1086
1095
|
});
|
|
1096
|
+
// we set the verifying keys
|
|
1097
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
1098
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
1099
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
1100
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
1101
|
+
});
|
|
1087
1102
|
});
|
|
1088
1103
|
it("should run the first poll", async () => {
|
|
1089
1104
|
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
@@ -1097,8 +1112,6 @@ describe("e2e tests", function test() {
|
|
|
1097
1112
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1098
1113
|
relayers: [await signer.getAddress()],
|
|
1099
1114
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1100
|
-
verifierContractAddress,
|
|
1101
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1102
1115
|
policyContractAddress: pollPolicyContractAddress,
|
|
1103
1116
|
initialVoiceCreditProxyContractAddress,
|
|
1104
1117
|
});
|
|
@@ -1110,7 +1123,7 @@ describe("e2e tests", function test() {
|
|
|
1110
1123
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1111
1124
|
maciPublicKey: users[i].publicKey.serialize(),
|
|
1112
1125
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
1113
|
-
signer,
|
|
1126
|
+
signer: userSigners[i],
|
|
1114
1127
|
});
|
|
1115
1128
|
// eslint-disable-next-line no-await-in-loop
|
|
1116
1129
|
const { isRegistered, stateIndex } = await (0, sdk_1.getSignedupUserData)({
|
|
@@ -1128,16 +1141,15 @@ describe("e2e tests", function test() {
|
|
|
1128
1141
|
await (0, sdk_1.joinPoll)({
|
|
1129
1142
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1130
1143
|
privateKey: users[i].privateKey.serialize(),
|
|
1131
|
-
stateIndex: BigInt(i + 1),
|
|
1132
1144
|
pollId: 0n,
|
|
1133
|
-
pollJoiningZkey: constants_1.
|
|
1134
|
-
useWasm
|
|
1135
|
-
|
|
1136
|
-
|
|
1145
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1146
|
+
useWasm,
|
|
1147
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1148
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1137
1149
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1138
1150
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1139
1151
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
1140
|
-
signer,
|
|
1152
|
+
signer: userSigners[i],
|
|
1141
1153
|
});
|
|
1142
1154
|
// eslint-disable-next-line no-await-in-loop
|
|
1143
1155
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
@@ -1215,8 +1227,6 @@ describe("e2e tests", function test() {
|
|
|
1215
1227
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1216
1228
|
relayers: [await signer.getAddress()],
|
|
1217
1229
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1218
|
-
verifierContractAddress,
|
|
1219
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1220
1230
|
policyContractAddress: pollPolicyContractAddress,
|
|
1221
1231
|
initialVoiceCreditProxyContractAddress,
|
|
1222
1232
|
});
|
|
@@ -1232,8 +1242,6 @@ describe("e2e tests", function test() {
|
|
|
1232
1242
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1233
1243
|
relayers: [await signer.getAddress()],
|
|
1234
1244
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1235
|
-
verifierContractAddress,
|
|
1236
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1237
1245
|
policyContractAddress: pollPolicyContractAddress,
|
|
1238
1246
|
initialVoiceCreditProxyContractAddress,
|
|
1239
1247
|
});
|
|
@@ -1242,21 +1250,21 @@ describe("e2e tests", function test() {
|
|
|
1242
1250
|
it("join the second and third polls", async () => {
|
|
1243
1251
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
1244
1252
|
for (let pollId = 1; pollId <= 2; pollId += 1) {
|
|
1253
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
1245
1254
|
for (let i = 0; i < users.length; i += 1) {
|
|
1246
1255
|
// eslint-disable-next-line no-await-in-loop
|
|
1247
1256
|
await (0, sdk_1.joinPoll)({
|
|
1248
1257
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1249
1258
|
privateKey: users[i].privateKey.serialize(),
|
|
1250
|
-
stateIndex: BigInt(i + 1),
|
|
1251
1259
|
pollId: BigInt(pollId),
|
|
1252
|
-
pollJoiningZkey: constants_1.
|
|
1253
|
-
useWasm
|
|
1254
|
-
|
|
1255
|
-
|
|
1260
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1261
|
+
useWasm,
|
|
1262
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1263
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1256
1264
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1257
1265
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1258
1266
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
1259
|
-
signer,
|
|
1267
|
+
signer: userSigners[i],
|
|
1260
1268
|
});
|
|
1261
1269
|
// eslint-disable-next-line no-await-in-loop
|
|
1262
1270
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
@@ -1480,6 +1488,12 @@ describe("e2e tests", function test() {
|
|
|
1480
1488
|
signer,
|
|
1481
1489
|
signupPolicyAddress: signupPolicyContractAddress,
|
|
1482
1490
|
});
|
|
1491
|
+
// we set the verifying keys
|
|
1492
|
+
const { verifyingKeysRegistryContractAddress } = maciAddresses;
|
|
1493
|
+
await (0, sdk_1.setVerifyingKeys)({
|
|
1494
|
+
...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
1495
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistryContractAddress,
|
|
1496
|
+
});
|
|
1483
1497
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
1484
1498
|
// deploy a poll contract
|
|
1485
1499
|
await (0, sdk_1.deployPoll)({
|
|
@@ -1489,8 +1503,6 @@ describe("e2e tests", function test() {
|
|
|
1489
1503
|
pollEndTimestamp: startDate + constants_1.pollDuration,
|
|
1490
1504
|
relayers: [await signer.getAddress()],
|
|
1491
1505
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1492
|
-
verifierContractAddress,
|
|
1493
|
-
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1494
1506
|
policyContractAddress: pollPolicyContractAddress,
|
|
1495
1507
|
initialVoiceCreditProxyContractAddress,
|
|
1496
1508
|
});
|
|
@@ -1508,12 +1520,11 @@ describe("e2e tests", function test() {
|
|
|
1508
1520
|
await (0, sdk_1.joinPoll)({
|
|
1509
1521
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1510
1522
|
privateKey: user.privateKey.serialize(),
|
|
1511
|
-
stateIndex: 1n,
|
|
1512
1523
|
pollId: 0n,
|
|
1513
|
-
pollJoiningZkey: constants_1.
|
|
1514
|
-
useWasm
|
|
1515
|
-
|
|
1516
|
-
|
|
1524
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1525
|
+
useWasm,
|
|
1526
|
+
pollJoiningWasm: constants_1.testPollJoiningWasmPath,
|
|
1527
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1517
1528
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1518
1529
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1519
1530
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|