@maci-protocol/testing 0.0.0-ci.f4bc8a6 → 0.0.0-ci.f4e2c46
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 +844 -0
- package/build/ts/__tests__/e2e.full.test.js.map +1 -0
- package/build/ts/__tests__/e2e.nonQv.test.js +424 -38
- package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
- package/build/ts/__tests__/e2e.test.js +269 -280
- package/build/ts/__tests__/e2e.test.js.map +1 -1
- package/build/ts/__tests__/integration.test.js +59 -55
- package/build/ts/__tests__/integration.test.js.map +1 -1
- package/build/ts/__tests__/keyChange.test.js +84 -78
- package/build/ts/__tests__/keyChange.test.js.map +1 -1
- package/build/ts/__tests__/maciKeys.test.d.ts +2 -0
- package/build/ts/__tests__/maciKeys.test.d.ts.map +1 -0
- package/build/ts/__tests__/maciKeys.test.js +78 -0
- package/build/ts/__tests__/maciKeys.test.js.map +1 -0
- package/build/ts/__tests__/unit/joinPoll.test.js +94 -27
- package/build/ts/__tests__/unit/joinPoll.test.js.map +1 -1
- package/build/ts/__tests__/unit/poll.test.js +7 -7
- package/build/ts/__tests__/unit/poll.test.js.map +1 -1
- package/build/ts/__tests__/unit/publish.test.js +13 -10
- package/build/ts/__tests__/unit/publish.test.js.map +1 -1
- package/build/ts/__tests__/unit/signup.test.js +9 -9
- 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 +52 -53
- package/build/ts/constants.d.ts.map +1 -1
- package/build/ts/constants.js +98 -74
- package/build/ts/constants.js.map +1 -1
- package/build/ts/testingClass.d.ts +7 -7
- package/build/ts/testingClass.d.ts.map +1 -1
- package/build/ts/testingClass.js +31 -27
- package/build/ts/testingClass.js.map +1 -1
- package/build/ts/types.d.ts +11 -11
- package/build/ts/types.d.ts.map +1 -1
- package/build/ts/user.d.ts +5 -9
- package/build/ts/user.d.ts.map +1 -1
- package/build/ts/user.js +5 -6
- package/build/ts/user.js.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 +14 -13
- package/build/ts/__tests__/maci-keys.test.d.ts +0 -2
- package/build/ts/__tests__/maci-keys.test.d.ts.map +0 -1
- package/build/ts/__tests__/maci-keys.test.js +0 -78
- package/build/ts/__tests__/maci-keys.test.js.map +0 -1
|
@@ -27,38 +27,38 @@ describe("e2e tests", function test() {
|
|
|
27
27
|
const useWasm = (0, sdk_1.isArm)();
|
|
28
28
|
this.timeout(900000);
|
|
29
29
|
let maciAddresses;
|
|
30
|
-
let
|
|
30
|
+
let verifyingKeysRegistryAddress;
|
|
31
31
|
let initialVoiceCreditProxyContractAddress;
|
|
32
32
|
let verifierContractAddress;
|
|
33
33
|
let signer;
|
|
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
|
-
|
|
45
|
-
coordinatorPrivateKey: constants_1.
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
messageProcessorWitnessGenerator: constants_1.testProcessMessagesWitnessPath,
|
|
42
|
+
messageProcessorWitnessDatFile: constants_1.testProcessMessagesWitnessDatPath,
|
|
43
|
+
voteTallyWitnessGenerator: constants_1.testTallyVotesWitnessPath,
|
|
44
|
+
voteTallyWitnessDatFile: constants_1.testTallyVotesWitnessDatPath,
|
|
45
|
+
coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
|
|
46
|
+
messageProcessorWasm: constants_1.testProcessMessagesWasmPath,
|
|
47
|
+
voteTallyWasm: constants_1.testTallyVotesWasmPath,
|
|
48
48
|
useWasm,
|
|
49
|
-
|
|
49
|
+
mode: core_1.EMode.QV,
|
|
50
50
|
};
|
|
51
|
-
// before all tests we deploy the
|
|
51
|
+
// before all tests we deploy the verifying keys registry contract and set the verifying keys
|
|
52
52
|
before(async () => {
|
|
53
53
|
signer = await (0, sdk_1.getDefaultSigner)();
|
|
54
|
-
// we deploy the
|
|
55
|
-
|
|
54
|
+
// we deploy the verifying keys registry contract
|
|
55
|
+
verifyingKeysRegistryAddress = await (0, sdk_1.deployVerifyingKeysRegistryContract)({ signer });
|
|
56
56
|
const [initialVoiceCreditProxy] = await (0, sdk_1.deployConstantInitialVoiceCreditProxy)({ amount: constants_1.DEFAULT_INITIAL_VOICE_CREDITS }, signer, undefined, true);
|
|
57
57
|
initialVoiceCreditProxyContractAddress = await initialVoiceCreditProxy.getAddress();
|
|
58
58
|
const verifier = await (0, sdk_1.deployVerifier)(signer, true);
|
|
59
59
|
verifierContractAddress = await verifier.getAddress();
|
|
60
60
|
// we set the verifying keys
|
|
61
|
-
await (0, sdk_1.setVerifyingKeys)({ ...(await (0, constants_1.verifyingKeysArgs)(signer)),
|
|
61
|
+
await (0, sdk_1.setVerifyingKeys)({ ...(await (0, constants_1.verifyingKeysArgs)(signer)), verifyingKeysRegistryAddress });
|
|
62
62
|
});
|
|
63
63
|
describe("2 signups (1 after stateAq is merged and logs are fetched), 1 message", () => {
|
|
64
64
|
after(async () => {
|
|
@@ -66,9 +66,9 @@ describe("e2e tests", function test() {
|
|
|
66
66
|
});
|
|
67
67
|
const user = new domainobjs_1.Keypair();
|
|
68
68
|
before(async () => {
|
|
69
|
-
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
69
|
+
const [signupPolicy, , signupPolicyFactory, signupCheckerFactory] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
70
70
|
const signupPolicyContractAddress = await signupPolicy.getAddress();
|
|
71
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
71
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({ policy: signupPolicyFactory, checker: signupCheckerFactory }, signer, true);
|
|
72
72
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
73
73
|
// deploy the smart contracts
|
|
74
74
|
maciAddresses = await (0, sdk_1.deployMaci)({
|
|
@@ -86,7 +86,7 @@ describe("e2e tests", function test() {
|
|
|
86
86
|
relayers: [await signer.getAddress()],
|
|
87
87
|
maciAddress: maciAddresses.maciContractAddress,
|
|
88
88
|
verifierContractAddress,
|
|
89
|
-
|
|
89
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
90
90
|
policyContractAddress: pollPolicyContractAddress,
|
|
91
91
|
initialVoiceCreditProxyContractAddress,
|
|
92
92
|
});
|
|
@@ -94,7 +94,7 @@ describe("e2e tests", function test() {
|
|
|
94
94
|
it("should signup one user", async () => {
|
|
95
95
|
await (0, sdk_1.signup)({
|
|
96
96
|
maciAddress: maciAddresses.maciContractAddress,
|
|
97
|
-
|
|
97
|
+
maciPublicKey: user.publicKey.serialize(),
|
|
98
98
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
99
99
|
signer,
|
|
100
100
|
});
|
|
@@ -102,13 +102,12 @@ describe("e2e tests", function test() {
|
|
|
102
102
|
it("should join one user", async () => {
|
|
103
103
|
await (0, sdk_1.joinPoll)({
|
|
104
104
|
maciAddress: maciAddresses.maciContractAddress,
|
|
105
|
-
privateKey: user.
|
|
106
|
-
stateIndex: 1n,
|
|
105
|
+
privateKey: user.privateKey.serialize(),
|
|
107
106
|
pollId: 0n,
|
|
108
|
-
pollJoiningZkey: constants_1.
|
|
107
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
109
108
|
useWasm: true,
|
|
110
109
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
111
|
-
|
|
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,
|
|
@@ -117,15 +116,15 @@ describe("e2e tests", function test() {
|
|
|
117
116
|
});
|
|
118
117
|
it("should publish one message", async () => {
|
|
119
118
|
await (0, sdk_1.publish)({
|
|
120
|
-
|
|
119
|
+
publicKey: user.publicKey.serialize(),
|
|
121
120
|
stateIndex: 1n,
|
|
122
121
|
voteOptionIndex: 0n,
|
|
123
122
|
nonce: 1n,
|
|
124
123
|
pollId: 0n,
|
|
125
124
|
newVoteWeight: 9n,
|
|
126
125
|
maciAddress: maciAddresses.maciContractAddress,
|
|
127
|
-
salt: (0, crypto_1.
|
|
128
|
-
privateKey: user.
|
|
126
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
127
|
+
privateKey: user.privateKey.serialize(),
|
|
129
128
|
signer,
|
|
130
129
|
});
|
|
131
130
|
});
|
|
@@ -139,7 +138,7 @@ describe("e2e tests", function test() {
|
|
|
139
138
|
});
|
|
140
139
|
await (0, sdk_1.signup)({
|
|
141
140
|
maciAddress: maciAddresses.maciContractAddress,
|
|
142
|
-
|
|
141
|
+
maciPublicKey: new domainobjs_1.Keypair().publicKey.serialize(),
|
|
143
142
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
144
143
|
signer,
|
|
145
144
|
});
|
|
@@ -157,9 +156,9 @@ describe("e2e tests", function test() {
|
|
|
157
156
|
});
|
|
158
157
|
const users = [new domainobjs_1.Keypair(), new domainobjs_1.Keypair(), new domainobjs_1.Keypair(), new domainobjs_1.Keypair()];
|
|
159
158
|
before(async () => {
|
|
160
|
-
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
159
|
+
const [signupPolicy, , signupPolicyFactory, signupCheckerFactory] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
161
160
|
const signupPolicyContractAddress = await signupPolicy.getAddress();
|
|
162
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
161
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({ policy: signupPolicyFactory, checker: signupCheckerFactory }, signer, true);
|
|
163
162
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
164
163
|
// deploy the smart contracts
|
|
165
164
|
maciAddresses = await (0, sdk_1.deployMaci)({
|
|
@@ -177,7 +176,7 @@ describe("e2e tests", function test() {
|
|
|
177
176
|
relayers: [await signer.getAddress()],
|
|
178
177
|
maciAddress: maciAddresses.maciContractAddress,
|
|
179
178
|
verifierContractAddress,
|
|
180
|
-
|
|
179
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
181
180
|
policyContractAddress: pollPolicyContractAddress,
|
|
182
181
|
initialVoiceCreditProxyContractAddress,
|
|
183
182
|
});
|
|
@@ -188,7 +187,7 @@ describe("e2e tests", function test() {
|
|
|
188
187
|
// eslint-disable-next-line no-await-in-loop
|
|
189
188
|
await (0, sdk_1.signup)({
|
|
190
189
|
maciAddress: maciAddresses.maciContractAddress,
|
|
191
|
-
|
|
190
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
192
191
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
193
192
|
signer,
|
|
194
193
|
});
|
|
@@ -200,13 +199,12 @@ describe("e2e tests", function test() {
|
|
|
200
199
|
// eslint-disable-next-line no-await-in-loop
|
|
201
200
|
await (0, sdk_1.joinPoll)({
|
|
202
201
|
maciAddress: maciAddresses.maciContractAddress,
|
|
203
|
-
privateKey: users[i].
|
|
204
|
-
stateIndex: BigInt(i + 1),
|
|
202
|
+
privateKey: users[i].privateKey.serialize(),
|
|
205
203
|
pollId: 0n,
|
|
206
|
-
pollJoiningZkey: constants_1.
|
|
204
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
207
205
|
useWasm: true,
|
|
208
206
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
209
|
-
|
|
207
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
210
208
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
211
209
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
212
210
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -216,99 +214,99 @@ describe("e2e tests", function test() {
|
|
|
216
214
|
});
|
|
217
215
|
it("should publish eight messages", async () => {
|
|
218
216
|
await (0, sdk_1.publish)({
|
|
219
|
-
|
|
217
|
+
publicKey: users[0].publicKey.serialize(),
|
|
220
218
|
stateIndex: 1n,
|
|
221
219
|
voteOptionIndex: 0n,
|
|
222
220
|
nonce: 2n,
|
|
223
221
|
pollId: 0n,
|
|
224
222
|
newVoteWeight: 4n,
|
|
225
223
|
maciAddress: maciAddresses.maciContractAddress,
|
|
226
|
-
salt: (0, crypto_1.
|
|
227
|
-
privateKey: users[0].
|
|
224
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
225
|
+
privateKey: users[0].privateKey.serialize(),
|
|
228
226
|
signer,
|
|
229
227
|
});
|
|
230
228
|
await (0, sdk_1.publish)({
|
|
231
|
-
|
|
229
|
+
publicKey: users[0].publicKey.serialize(),
|
|
232
230
|
stateIndex: 1n,
|
|
233
231
|
voteOptionIndex: 0n,
|
|
234
232
|
nonce: 2n,
|
|
235
233
|
pollId: 0n,
|
|
236
234
|
newVoteWeight: 3n,
|
|
237
235
|
maciAddress: maciAddresses.maciContractAddress,
|
|
238
|
-
salt: (0, crypto_1.
|
|
239
|
-
privateKey: users[0].
|
|
236
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
237
|
+
privateKey: users[0].privateKey.serialize(),
|
|
240
238
|
signer,
|
|
241
239
|
});
|
|
242
240
|
await (0, sdk_1.publish)({
|
|
243
|
-
|
|
241
|
+
publicKey: users[0].publicKey.serialize(),
|
|
244
242
|
stateIndex: 1n,
|
|
245
243
|
voteOptionIndex: 0n,
|
|
246
244
|
nonce: 1n,
|
|
247
245
|
pollId: 0n,
|
|
248
246
|
newVoteWeight: 9n,
|
|
249
247
|
maciAddress: maciAddresses.maciContractAddress,
|
|
250
|
-
salt: (0, crypto_1.
|
|
251
|
-
privateKey: users[0].
|
|
248
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
249
|
+
privateKey: users[0].privateKey.serialize(),
|
|
252
250
|
signer,
|
|
253
251
|
});
|
|
254
252
|
await (0, sdk_1.publish)({
|
|
255
|
-
|
|
253
|
+
publicKey: users[1].publicKey.serialize(),
|
|
256
254
|
stateIndex: 2n,
|
|
257
255
|
voteOptionIndex: 2n,
|
|
258
256
|
nonce: 1n,
|
|
259
257
|
pollId: 0n,
|
|
260
258
|
newVoteWeight: 9n,
|
|
261
259
|
maciAddress: maciAddresses.maciContractAddress,
|
|
262
|
-
salt: (0, crypto_1.
|
|
263
|
-
privateKey: users[1].
|
|
260
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
261
|
+
privateKey: users[1].privateKey.serialize(),
|
|
264
262
|
signer,
|
|
265
263
|
});
|
|
266
264
|
await (0, sdk_1.publish)({
|
|
267
|
-
|
|
265
|
+
publicKey: users[2].publicKey.serialize(),
|
|
268
266
|
stateIndex: 3n,
|
|
269
267
|
voteOptionIndex: 2n,
|
|
270
268
|
nonce: 1n,
|
|
271
269
|
pollId: 0n,
|
|
272
270
|
newVoteWeight: 9n,
|
|
273
271
|
maciAddress: maciAddresses.maciContractAddress,
|
|
274
|
-
salt: (0, crypto_1.
|
|
275
|
-
privateKey: users[2].
|
|
272
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
273
|
+
privateKey: users[2].privateKey.serialize(),
|
|
276
274
|
signer,
|
|
277
275
|
});
|
|
278
276
|
await (0, sdk_1.publish)({
|
|
279
|
-
|
|
277
|
+
publicKey: users[3].publicKey.serialize(),
|
|
280
278
|
stateIndex: 4n,
|
|
281
279
|
voteOptionIndex: 2n,
|
|
282
280
|
nonce: 3n,
|
|
283
281
|
pollId: 0n,
|
|
284
282
|
newVoteWeight: 3n,
|
|
285
283
|
maciAddress: maciAddresses.maciContractAddress,
|
|
286
|
-
salt: (0, crypto_1.
|
|
287
|
-
privateKey: users[3].
|
|
284
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
285
|
+
privateKey: users[3].privateKey.serialize(),
|
|
288
286
|
signer,
|
|
289
287
|
});
|
|
290
288
|
await (0, sdk_1.publish)({
|
|
291
|
-
|
|
289
|
+
publicKey: users[3].publicKey.serialize(),
|
|
292
290
|
stateIndex: 4n,
|
|
293
291
|
voteOptionIndex: 2n,
|
|
294
292
|
nonce: 2n,
|
|
295
293
|
pollId: 0n,
|
|
296
294
|
newVoteWeight: 2n,
|
|
297
295
|
maciAddress: maciAddresses.maciContractAddress,
|
|
298
|
-
salt: (0, crypto_1.
|
|
299
|
-
privateKey: users[3].
|
|
296
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
297
|
+
privateKey: users[3].privateKey.serialize(),
|
|
300
298
|
signer,
|
|
301
299
|
});
|
|
302
300
|
await (0, sdk_1.publish)({
|
|
303
|
-
|
|
301
|
+
publicKey: users[3].publicKey.serialize(),
|
|
304
302
|
stateIndex: 4n,
|
|
305
303
|
voteOptionIndex: 1n,
|
|
306
304
|
nonce: 1n,
|
|
307
305
|
pollId: 0n,
|
|
308
306
|
newVoteWeight: 9n,
|
|
309
307
|
maciAddress: maciAddresses.maciContractAddress,
|
|
310
|
-
salt: (0, crypto_1.
|
|
311
|
-
privateKey: users[3].
|
|
308
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
309
|
+
privateKey: users[3].privateKey.serialize(),
|
|
312
310
|
signer,
|
|
313
311
|
});
|
|
314
312
|
});
|
|
@@ -317,98 +315,98 @@ describe("e2e tests", function test() {
|
|
|
317
315
|
{
|
|
318
316
|
pollId: 0n,
|
|
319
317
|
voteOptionIndex: 1n,
|
|
320
|
-
salt: (0, crypto_1.
|
|
318
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
321
319
|
nonce: 2n,
|
|
322
|
-
privateKey: users[0].
|
|
320
|
+
privateKey: users[0].privateKey,
|
|
323
321
|
stateIndex: 1n,
|
|
324
322
|
voteWeight: 4n,
|
|
325
|
-
|
|
323
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
326
324
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
327
|
-
|
|
325
|
+
newPublicKey: users[0].publicKey,
|
|
328
326
|
},
|
|
329
327
|
{
|
|
330
328
|
pollId: 0n,
|
|
331
329
|
voteOptionIndex: 1n,
|
|
332
|
-
salt: (0, crypto_1.
|
|
330
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
333
331
|
nonce: 2n,
|
|
334
|
-
privateKey: users[0].
|
|
332
|
+
privateKey: users[0].privateKey,
|
|
335
333
|
stateIndex: 1n,
|
|
336
334
|
voteWeight: 3n,
|
|
337
|
-
|
|
335
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
338
336
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
339
|
-
|
|
337
|
+
newPublicKey: users[0].publicKey,
|
|
340
338
|
},
|
|
341
339
|
{
|
|
342
340
|
pollId: 0n,
|
|
343
341
|
voteOptionIndex: 1n,
|
|
344
|
-
salt: (0, crypto_1.
|
|
342
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
345
343
|
nonce: 1n,
|
|
346
|
-
privateKey: users[0].
|
|
344
|
+
privateKey: users[0].privateKey,
|
|
347
345
|
stateIndex: 1n,
|
|
348
346
|
voteWeight: 9n,
|
|
349
|
-
|
|
347
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
350
348
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
351
|
-
|
|
349
|
+
newPublicKey: users[0].publicKey,
|
|
352
350
|
},
|
|
353
351
|
{
|
|
354
352
|
pollId: 0n,
|
|
355
353
|
voteOptionIndex: 1n,
|
|
356
|
-
salt: (0, crypto_1.
|
|
354
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
357
355
|
nonce: 1n,
|
|
358
|
-
privateKey: users[1].
|
|
356
|
+
privateKey: users[1].privateKey,
|
|
359
357
|
stateIndex: 2n,
|
|
360
358
|
voteWeight: 9n,
|
|
361
|
-
|
|
359
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
362
360
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
363
|
-
|
|
361
|
+
newPublicKey: users[1].publicKey,
|
|
364
362
|
},
|
|
365
363
|
{
|
|
366
364
|
pollId: 0n,
|
|
367
365
|
voteOptionIndex: 1n,
|
|
368
|
-
salt: (0, crypto_1.
|
|
366
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
369
367
|
nonce: 1n,
|
|
370
|
-
privateKey: users[2].
|
|
368
|
+
privateKey: users[2].privateKey,
|
|
371
369
|
stateIndex: 3n,
|
|
372
370
|
voteWeight: 9n,
|
|
373
|
-
|
|
371
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
374
372
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
375
|
-
|
|
373
|
+
newPublicKey: users[2].publicKey,
|
|
376
374
|
},
|
|
377
375
|
{
|
|
378
376
|
pollId: 0n,
|
|
379
377
|
voteOptionIndex: 0n,
|
|
380
|
-
salt: (0, crypto_1.
|
|
378
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
381
379
|
nonce: 3n,
|
|
382
|
-
privateKey: users[3].
|
|
380
|
+
privateKey: users[3].privateKey,
|
|
383
381
|
stateIndex: 4n,
|
|
384
382
|
voteWeight: 3n,
|
|
385
|
-
|
|
383
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
386
384
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
387
|
-
|
|
385
|
+
newPublicKey: users[3].publicKey,
|
|
388
386
|
},
|
|
389
387
|
{
|
|
390
388
|
pollId: 0n,
|
|
391
389
|
voteOptionIndex: 0n,
|
|
392
|
-
salt: (0, crypto_1.
|
|
390
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
393
391
|
nonce: 2n,
|
|
394
|
-
privateKey: users[3].
|
|
392
|
+
privateKey: users[3].privateKey,
|
|
395
393
|
stateIndex: 4n,
|
|
396
394
|
voteWeight: 2n,
|
|
397
|
-
|
|
395
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
398
396
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
399
|
-
|
|
397
|
+
newPublicKey: users[3].publicKey,
|
|
400
398
|
},
|
|
401
399
|
{
|
|
402
400
|
pollId: 0n,
|
|
403
401
|
voteOptionIndex: 0n,
|
|
404
|
-
salt: (0, crypto_1.
|
|
402
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
405
403
|
nonce: 1n,
|
|
406
|
-
privateKey: users[3].
|
|
404
|
+
privateKey: users[3].privateKey,
|
|
407
405
|
stateIndex: 4n,
|
|
408
406
|
voteWeight: 9n,
|
|
409
|
-
|
|
407
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
410
408
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
411
|
-
|
|
409
|
+
newPublicKey: users[3].publicKey,
|
|
412
410
|
},
|
|
413
411
|
];
|
|
414
412
|
const messages = votes
|
|
@@ -417,8 +415,8 @@ describe("e2e tests", function test() {
|
|
|
417
415
|
maciAddress: maciAddresses.maciContractAddress,
|
|
418
416
|
poll: 0,
|
|
419
417
|
data: message.data.map(String),
|
|
420
|
-
publicKey: ephemeralKeypair.
|
|
421
|
-
hash: message.hash(ephemeralKeypair.
|
|
418
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
419
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
422
420
|
}));
|
|
423
421
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
424
422
|
});
|
|
@@ -442,9 +440,9 @@ describe("e2e tests", function test() {
|
|
|
442
440
|
});
|
|
443
441
|
const users = Array.from({ length: 30 }, () => new domainobjs_1.Keypair());
|
|
444
442
|
before(async () => {
|
|
445
|
-
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
443
|
+
const [signupPolicy, , signupPolicyFactory, signupCheckerFactory] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
446
444
|
const signupPolicyContractAddress = await signupPolicy.getAddress();
|
|
447
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
445
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({ policy: signupPolicyFactory, checker: signupCheckerFactory }, signer, true);
|
|
448
446
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
449
447
|
// deploy the smart contracts
|
|
450
448
|
maciAddresses = await (0, sdk_1.deployMaci)({
|
|
@@ -462,7 +460,7 @@ describe("e2e tests", function test() {
|
|
|
462
460
|
relayers: [await signer.getAddress()],
|
|
463
461
|
maciAddress: maciAddresses.maciContractAddress,
|
|
464
462
|
verifierContractAddress,
|
|
465
|
-
|
|
463
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
466
464
|
policyContractAddress: pollPolicyContractAddress,
|
|
467
465
|
initialVoiceCreditProxyContractAddress,
|
|
468
466
|
});
|
|
@@ -472,7 +470,7 @@ describe("e2e tests", function test() {
|
|
|
472
470
|
// eslint-disable-next-line no-await-in-loop
|
|
473
471
|
await (0, sdk_1.signup)({
|
|
474
472
|
maciAddress: maciAddresses.maciContractAddress,
|
|
475
|
-
|
|
473
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
476
474
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
477
475
|
signer,
|
|
478
476
|
});
|
|
@@ -482,13 +480,12 @@ describe("e2e tests", function test() {
|
|
|
482
480
|
// eslint-disable-next-line no-await-in-loop
|
|
483
481
|
await (0, sdk_1.joinPoll)({
|
|
484
482
|
maciAddress: maciAddresses.maciContractAddress,
|
|
485
|
-
privateKey: users[0].
|
|
486
|
-
stateIndex: 1n,
|
|
483
|
+
privateKey: users[0].privateKey.serialize(),
|
|
487
484
|
pollId: 0n,
|
|
488
|
-
pollJoiningZkey: constants_1.
|
|
485
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
489
486
|
useWasm: true,
|
|
490
487
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
491
|
-
|
|
488
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
492
489
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
493
490
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
494
491
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -501,35 +498,35 @@ describe("e2e tests", function test() {
|
|
|
501
498
|
.map(() => (0, sdk_1.generateVote)({
|
|
502
499
|
pollId: 0n,
|
|
503
500
|
voteOptionIndex: 0n,
|
|
504
|
-
salt: (0, crypto_1.
|
|
501
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
505
502
|
nonce: 1n,
|
|
506
|
-
privateKey: users[0].
|
|
503
|
+
privateKey: users[0].privateKey,
|
|
507
504
|
stateIndex: 1n,
|
|
508
505
|
voteWeight: 9n,
|
|
509
|
-
|
|
506
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
510
507
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
511
|
-
|
|
508
|
+
newPublicKey: users[0].publicKey,
|
|
512
509
|
}))
|
|
513
510
|
.map(({ message, ephemeralKeypair }) => ({
|
|
514
511
|
maciAddress: maciAddresses.maciContractAddress,
|
|
515
512
|
poll: 0,
|
|
516
513
|
data: message.data.map(String),
|
|
517
|
-
publicKey: ephemeralKeypair.
|
|
518
|
-
hash: message.hash(ephemeralKeypair.
|
|
514
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
515
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
519
516
|
}));
|
|
520
517
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
521
518
|
for (let i = 0; i < 12; i += 1) {
|
|
522
519
|
// eslint-disable-next-line no-await-in-loop
|
|
523
520
|
await (0, sdk_1.publish)({
|
|
524
|
-
|
|
521
|
+
publicKey: users[0].publicKey.serialize(),
|
|
525
522
|
stateIndex: 1n,
|
|
526
523
|
voteOptionIndex: 0n,
|
|
527
524
|
nonce: 1n,
|
|
528
525
|
pollId: 0n,
|
|
529
526
|
newVoteWeight: 9n,
|
|
530
527
|
maciAddress: maciAddresses.maciContractAddress,
|
|
531
|
-
salt: (0, crypto_1.
|
|
532
|
-
privateKey: users[0].
|
|
528
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
529
|
+
privateKey: users[0].privateKey.serialize(),
|
|
533
530
|
signer,
|
|
534
531
|
});
|
|
535
532
|
}
|
|
@@ -554,9 +551,9 @@ describe("e2e tests", function test() {
|
|
|
554
551
|
});
|
|
555
552
|
const users = Array.from({ length: 30 }, () => new domainobjs_1.Keypair());
|
|
556
553
|
before(async () => {
|
|
557
|
-
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
554
|
+
const [signupPolicy, , signupPolicyFactory, signupCheckerFactory] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
558
555
|
const signupPolicyContractAddress = await signupPolicy.getAddress();
|
|
559
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
556
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({ policy: signupPolicyFactory, checker: signupCheckerFactory }, signer, true);
|
|
560
557
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
561
558
|
// deploy the smart contracts
|
|
562
559
|
maciAddresses = await (0, sdk_1.deployMaci)({
|
|
@@ -574,7 +571,7 @@ describe("e2e tests", function test() {
|
|
|
574
571
|
relayers: [await signer.getAddress()],
|
|
575
572
|
maciAddress: maciAddresses.maciContractAddress,
|
|
576
573
|
verifierContractAddress,
|
|
577
|
-
|
|
574
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
578
575
|
policyContractAddress: pollPolicyContractAddress,
|
|
579
576
|
initialVoiceCreditProxyContractAddress,
|
|
580
577
|
});
|
|
@@ -585,7 +582,7 @@ describe("e2e tests", function test() {
|
|
|
585
582
|
// eslint-disable-next-line no-await-in-loop
|
|
586
583
|
await (0, sdk_1.signup)({
|
|
587
584
|
maciAddress: maciAddresses.maciContractAddress,
|
|
588
|
-
|
|
585
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
589
586
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
590
587
|
signer,
|
|
591
588
|
});
|
|
@@ -597,13 +594,12 @@ describe("e2e tests", function test() {
|
|
|
597
594
|
// eslint-disable-next-line no-await-in-loop
|
|
598
595
|
await (0, sdk_1.joinPoll)({
|
|
599
596
|
maciAddress: maciAddresses.maciContractAddress,
|
|
600
|
-
privateKey: users[i].
|
|
601
|
-
stateIndex: BigInt(i + 1),
|
|
597
|
+
privateKey: users[i].privateKey.serialize(),
|
|
602
598
|
pollId: 0n,
|
|
603
|
-
pollJoiningZkey: constants_1.
|
|
599
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
604
600
|
useWasm: true,
|
|
605
601
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
606
|
-
|
|
602
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
607
603
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
608
604
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
609
605
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -617,14 +613,14 @@ describe("e2e tests", function test() {
|
|
|
617
613
|
// eslint-disable-next-line no-await-in-loop
|
|
618
614
|
await (0, sdk_1.publish)({
|
|
619
615
|
maciAddress: maciAddresses.maciContractAddress,
|
|
620
|
-
|
|
616
|
+
publicKey: users[i].publicKey.serialize(),
|
|
621
617
|
stateIndex: BigInt(i + 1),
|
|
622
618
|
voteOptionIndex: 0n,
|
|
623
619
|
nonce: 1n,
|
|
624
620
|
pollId: 0n,
|
|
625
621
|
newVoteWeight: 9n,
|
|
626
|
-
salt: (0, crypto_1.
|
|
627
|
-
privateKey: users[i].
|
|
622
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
623
|
+
privateKey: users[i].privateKey.serialize(),
|
|
628
624
|
signer,
|
|
629
625
|
});
|
|
630
626
|
}
|
|
@@ -647,9 +643,9 @@ describe("e2e tests", function test() {
|
|
|
647
643
|
});
|
|
648
644
|
const users = Array.from({ length: 30 }, () => new domainobjs_1.Keypair());
|
|
649
645
|
before(async () => {
|
|
650
|
-
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
646
|
+
const [signupPolicy, , signupPolicyFactory, signupCheckerFactory] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
651
647
|
const signupPolicyContractAddress = await signupPolicy.getAddress();
|
|
652
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
648
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({ policy: signupPolicyFactory, checker: signupCheckerFactory }, signer, true);
|
|
653
649
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
654
650
|
// deploy the smart contracts
|
|
655
651
|
maciAddresses = await (0, sdk_1.deployMaci)({
|
|
@@ -667,7 +663,7 @@ describe("e2e tests", function test() {
|
|
|
667
663
|
relayers: [await signer.getAddress()],
|
|
668
664
|
maciAddress: maciAddresses.maciContractAddress,
|
|
669
665
|
verifierContractAddress,
|
|
670
|
-
|
|
666
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
671
667
|
policyContractAddress: pollPolicyContractAddress,
|
|
672
668
|
initialVoiceCreditProxyContractAddress,
|
|
673
669
|
});
|
|
@@ -678,7 +674,7 @@ describe("e2e tests", function test() {
|
|
|
678
674
|
// eslint-disable-next-line no-await-in-loop
|
|
679
675
|
await (0, sdk_1.signup)({
|
|
680
676
|
maciAddress: maciAddresses.maciContractAddress,
|
|
681
|
-
|
|
677
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
682
678
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
683
679
|
signer,
|
|
684
680
|
});
|
|
@@ -690,13 +686,12 @@ describe("e2e tests", function test() {
|
|
|
690
686
|
// eslint-disable-next-line no-await-in-loop
|
|
691
687
|
await (0, sdk_1.joinPoll)({
|
|
692
688
|
maciAddress: maciAddresses.maciContractAddress,
|
|
693
|
-
privateKey: users[i].
|
|
694
|
-
stateIndex: BigInt(i + 1),
|
|
689
|
+
privateKey: users[i].privateKey.serialize(),
|
|
695
690
|
pollId: 0n,
|
|
696
|
-
pollJoiningZkey: constants_1.
|
|
691
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
697
692
|
useWasm: true,
|
|
698
693
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
699
|
-
|
|
694
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
700
695
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
701
696
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
702
697
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -710,14 +705,14 @@ describe("e2e tests", function test() {
|
|
|
710
705
|
// eslint-disable-next-line no-await-in-loop
|
|
711
706
|
await (0, sdk_1.publish)({
|
|
712
707
|
maciAddress: maciAddresses.maciContractAddress,
|
|
713
|
-
|
|
708
|
+
publicKey: users[i].publicKey.serialize(),
|
|
714
709
|
stateIndex: 1n,
|
|
715
710
|
voteOptionIndex: 0n,
|
|
716
711
|
nonce: 1n,
|
|
717
712
|
pollId: 0n,
|
|
718
713
|
newVoteWeight: 9n,
|
|
719
|
-
salt: (0, crypto_1.
|
|
720
|
-
privateKey: users[i].
|
|
714
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
715
|
+
privateKey: users[i].privateKey.serialize(),
|
|
721
716
|
signer,
|
|
722
717
|
});
|
|
723
718
|
}
|
|
@@ -727,38 +722,38 @@ describe("e2e tests", function test() {
|
|
|
727
722
|
{
|
|
728
723
|
pollId: 0n,
|
|
729
724
|
voteOptionIndex: 1n,
|
|
730
|
-
salt: (0, crypto_1.
|
|
725
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
731
726
|
nonce: 2n,
|
|
732
|
-
privateKey: users[0].
|
|
727
|
+
privateKey: users[0].privateKey,
|
|
733
728
|
stateIndex: 1n,
|
|
734
729
|
voteWeight: 5n,
|
|
735
|
-
|
|
730
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
736
731
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
737
|
-
|
|
732
|
+
newPublicKey: users[0].publicKey,
|
|
738
733
|
},
|
|
739
734
|
{
|
|
740
735
|
pollId: 0n,
|
|
741
736
|
voteOptionIndex: 2n,
|
|
742
|
-
salt: (0, crypto_1.
|
|
737
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
743
738
|
nonce: 3n,
|
|
744
|
-
privateKey: users[2].
|
|
739
|
+
privateKey: users[2].privateKey,
|
|
745
740
|
stateIndex: 3n,
|
|
746
741
|
voteWeight: 9n,
|
|
747
|
-
|
|
742
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
748
743
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
749
|
-
|
|
744
|
+
newPublicKey: users[2].publicKey,
|
|
750
745
|
},
|
|
751
746
|
{
|
|
752
747
|
pollId: 0n,
|
|
753
748
|
voteOptionIndex: 3n,
|
|
754
|
-
salt: (0, crypto_1.
|
|
749
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
755
750
|
nonce: 3n,
|
|
756
|
-
privateKey: users[3].
|
|
751
|
+
privateKey: users[3].privateKey,
|
|
757
752
|
stateIndex: 4n,
|
|
758
753
|
voteWeight: 7n,
|
|
759
|
-
|
|
754
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
760
755
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
761
|
-
|
|
756
|
+
newPublicKey: users[3].publicKey,
|
|
762
757
|
},
|
|
763
758
|
];
|
|
764
759
|
const messages = votes
|
|
@@ -767,8 +762,8 @@ describe("e2e tests", function test() {
|
|
|
767
762
|
maciAddress: maciAddresses.maciContractAddress,
|
|
768
763
|
poll: 0,
|
|
769
764
|
data: message.data.map(String),
|
|
770
|
-
publicKey: ephemeralKeypair.
|
|
771
|
-
hash: message.hash(ephemeralKeypair.
|
|
765
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
766
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
772
767
|
}));
|
|
773
768
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
774
769
|
});
|
|
@@ -792,9 +787,9 @@ describe("e2e tests", function test() {
|
|
|
792
787
|
});
|
|
793
788
|
const users = Array.from({ length: 5 }, () => new domainobjs_1.Keypair());
|
|
794
789
|
before(async () => {
|
|
795
|
-
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
790
|
+
const [signupPolicy, , signupPolicyFactory, signupCheckerFactory] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
796
791
|
const signupPolicyContractAddress = await signupPolicy.getAddress();
|
|
797
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
792
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({ policy: signupPolicyFactory, checker: signupCheckerFactory }, signer, true);
|
|
798
793
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
799
794
|
// deploy the smart contracts
|
|
800
795
|
maciAddresses = await (0, sdk_1.deployMaci)({
|
|
@@ -812,27 +807,26 @@ describe("e2e tests", function test() {
|
|
|
812
807
|
relayers: [await signer.getAddress()],
|
|
813
808
|
maciAddress: maciAddresses.maciContractAddress,
|
|
814
809
|
verifierContractAddress,
|
|
815
|
-
|
|
810
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
816
811
|
policyContractAddress: pollPolicyContractAddress,
|
|
817
812
|
initialVoiceCreditProxyContractAddress,
|
|
818
813
|
});
|
|
819
814
|
// signup
|
|
820
815
|
await (0, sdk_1.signup)({
|
|
821
816
|
maciAddress: maciAddresses.maciContractAddress,
|
|
822
|
-
|
|
817
|
+
maciPublicKey: users[0].publicKey.serialize(),
|
|
823
818
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
824
819
|
signer,
|
|
825
820
|
});
|
|
826
821
|
// joinPoll
|
|
827
822
|
await (0, sdk_1.joinPoll)({
|
|
828
823
|
maciAddress: maciAddresses.maciContractAddress,
|
|
829
|
-
privateKey: users[0].
|
|
830
|
-
stateIndex: 1n,
|
|
824
|
+
privateKey: users[0].privateKey.serialize(),
|
|
831
825
|
pollId: 0n,
|
|
832
|
-
pollJoiningZkey: constants_1.
|
|
826
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
833
827
|
useWasm: true,
|
|
834
828
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
835
|
-
|
|
829
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
836
830
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
837
831
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
838
832
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -840,39 +834,38 @@ describe("e2e tests", function test() {
|
|
|
840
834
|
});
|
|
841
835
|
// publish
|
|
842
836
|
await (0, sdk_1.publish)({
|
|
843
|
-
|
|
837
|
+
publicKey: users[0].publicKey.serialize(),
|
|
844
838
|
stateIndex: 1n,
|
|
845
839
|
voteOptionIndex: 0n,
|
|
846
840
|
nonce: 1n,
|
|
847
841
|
pollId: 0n,
|
|
848
842
|
newVoteWeight: 9n,
|
|
849
843
|
maciAddress: maciAddresses.maciContractAddress,
|
|
850
|
-
salt: (0, crypto_1.
|
|
851
|
-
privateKey: users[0].
|
|
844
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
845
|
+
privateKey: users[0].privateKey.serialize(),
|
|
852
846
|
signer,
|
|
853
847
|
});
|
|
854
848
|
await (0, sdk_1.signup)({
|
|
855
849
|
maciAddress: maciAddresses.maciContractAddress,
|
|
856
|
-
|
|
850
|
+
maciPublicKey: users[1].publicKey.serialize(),
|
|
857
851
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
858
852
|
signer,
|
|
859
853
|
});
|
|
860
854
|
await (0, sdk_1.signup)({
|
|
861
855
|
maciAddress: maciAddresses.maciContractAddress,
|
|
862
|
-
|
|
856
|
+
maciPublicKey: users[2].publicKey.serialize(),
|
|
863
857
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
864
858
|
signer,
|
|
865
859
|
});
|
|
866
860
|
// joinPoll
|
|
867
861
|
await (0, sdk_1.joinPoll)({
|
|
868
862
|
maciAddress: maciAddresses.maciContractAddress,
|
|
869
|
-
privateKey: users[1].
|
|
870
|
-
stateIndex: 2n,
|
|
863
|
+
privateKey: users[1].privateKey.serialize(),
|
|
871
864
|
pollId: 0n,
|
|
872
|
-
pollJoiningZkey: constants_1.
|
|
865
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
873
866
|
useWasm: true,
|
|
874
867
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
875
|
-
|
|
868
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
876
869
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
877
870
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
878
871
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -882,14 +875,14 @@ describe("e2e tests", function test() {
|
|
|
882
875
|
{
|
|
883
876
|
pollId: 0n,
|
|
884
877
|
voteOptionIndex: 0n,
|
|
885
|
-
salt: (0, crypto_1.
|
|
878
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
886
879
|
nonce: 1n,
|
|
887
|
-
privateKey: users[1].
|
|
880
|
+
privateKey: users[1].privateKey,
|
|
888
881
|
stateIndex: 2n,
|
|
889
882
|
voteWeight: 2n,
|
|
890
|
-
|
|
883
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
891
884
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
892
|
-
|
|
885
|
+
newPublicKey: users[1].publicKey,
|
|
893
886
|
},
|
|
894
887
|
];
|
|
895
888
|
const messages = votes
|
|
@@ -898,8 +891,8 @@ describe("e2e tests", function test() {
|
|
|
898
891
|
maciAddress: maciAddresses.maciContractAddress,
|
|
899
892
|
poll: 0,
|
|
900
893
|
data: message.data.map(String),
|
|
901
|
-
publicKey: ephemeralKeypair.
|
|
902
|
-
hash: message.hash(ephemeralKeypair.
|
|
894
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
895
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
903
896
|
}));
|
|
904
897
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
905
898
|
const ipfsMessageBackupFiles = await (0, utils_1.getBackupFilenames)();
|
|
@@ -918,7 +911,7 @@ describe("e2e tests", function test() {
|
|
|
918
911
|
await (0, utils_1.clean)();
|
|
919
912
|
});
|
|
920
913
|
it("should deploy a new poll", async () => {
|
|
921
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
914
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
922
915
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
923
916
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
924
917
|
// deploy a poll contract
|
|
@@ -930,7 +923,7 @@ describe("e2e tests", function test() {
|
|
|
930
923
|
relayers: [await signer.getAddress()],
|
|
931
924
|
maciAddress: maciAddresses.maciContractAddress,
|
|
932
925
|
verifierContractAddress,
|
|
933
|
-
|
|
926
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
934
927
|
policyContractAddress: pollPolicyContractAddress,
|
|
935
928
|
initialVoiceCreditProxyContractAddress,
|
|
936
929
|
});
|
|
@@ -938,13 +931,13 @@ describe("e2e tests", function test() {
|
|
|
938
931
|
it("should signup two new users", async () => {
|
|
939
932
|
await (0, sdk_1.signup)({
|
|
940
933
|
maciAddress: maciAddresses.maciContractAddress,
|
|
941
|
-
|
|
934
|
+
maciPublicKey: users[3].publicKey.serialize(),
|
|
942
935
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
943
936
|
signer,
|
|
944
937
|
});
|
|
945
938
|
await (0, sdk_1.signup)({
|
|
946
939
|
maciAddress: maciAddresses.maciContractAddress,
|
|
947
|
-
|
|
940
|
+
maciPublicKey: users[4].publicKey.serialize(),
|
|
948
941
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
949
942
|
signer,
|
|
950
943
|
});
|
|
@@ -953,13 +946,12 @@ describe("e2e tests", function test() {
|
|
|
953
946
|
// joinPoll
|
|
954
947
|
await (0, sdk_1.joinPoll)({
|
|
955
948
|
maciAddress: maciAddresses.maciContractAddress,
|
|
956
|
-
privateKey: users[3].
|
|
957
|
-
stateIndex: 4n,
|
|
949
|
+
privateKey: users[3].privateKey.serialize(),
|
|
958
950
|
pollId: 1n,
|
|
959
|
-
pollJoiningZkey: constants_1.
|
|
951
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
960
952
|
useWasm: true,
|
|
961
953
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
962
|
-
|
|
954
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
963
955
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
964
956
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
965
957
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -968,13 +960,12 @@ describe("e2e tests", function test() {
|
|
|
968
960
|
// joinPoll
|
|
969
961
|
await (0, sdk_1.joinPoll)({
|
|
970
962
|
maciAddress: maciAddresses.maciContractAddress,
|
|
971
|
-
privateKey: users[4].
|
|
972
|
-
stateIndex: 5n,
|
|
963
|
+
privateKey: users[4].privateKey.serialize(),
|
|
973
964
|
pollId: 1n,
|
|
974
|
-
pollJoiningZkey: constants_1.
|
|
965
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
975
966
|
useWasm: true,
|
|
976
967
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
977
|
-
|
|
968
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
978
969
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
979
970
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
980
971
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -986,26 +977,26 @@ describe("e2e tests", function test() {
|
|
|
986
977
|
{
|
|
987
978
|
pollId: 1n,
|
|
988
979
|
voteOptionIndex: 1n,
|
|
989
|
-
salt: (0, crypto_1.
|
|
980
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
990
981
|
nonce: 1n,
|
|
991
|
-
privateKey: users[0].
|
|
982
|
+
privateKey: users[0].privateKey,
|
|
992
983
|
stateIndex: 1n,
|
|
993
984
|
voteWeight: 9n,
|
|
994
|
-
|
|
985
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
995
986
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
996
|
-
|
|
987
|
+
newPublicKey: users[0].publicKey,
|
|
997
988
|
},
|
|
998
989
|
{
|
|
999
990
|
pollId: 1n,
|
|
1000
991
|
voteOptionIndex: 0n,
|
|
1001
|
-
salt: (0, crypto_1.
|
|
992
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1002
993
|
nonce: 1n,
|
|
1003
|
-
privateKey: users[1].
|
|
994
|
+
privateKey: users[1].privateKey,
|
|
1004
995
|
stateIndex: 1n,
|
|
1005
996
|
voteWeight: 5n,
|
|
1006
|
-
|
|
997
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1007
998
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1008
|
-
|
|
999
|
+
newPublicKey: users[1].publicKey,
|
|
1009
1000
|
},
|
|
1010
1001
|
];
|
|
1011
1002
|
const messages = votes
|
|
@@ -1014,36 +1005,36 @@ describe("e2e tests", function test() {
|
|
|
1014
1005
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1015
1006
|
poll: 1,
|
|
1016
1007
|
data: message.data.map(String),
|
|
1017
|
-
publicKey: ephemeralKeypair.
|
|
1018
|
-
hash: message.hash(ephemeralKeypair.
|
|
1008
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1009
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1019
1010
|
}));
|
|
1020
1011
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 1, maciAddress: maciAddresses.maciContractAddress });
|
|
1021
1012
|
});
|
|
1022
1013
|
it("should publish a new message from the first poll voter", async () => {
|
|
1023
1014
|
await (0, sdk_1.publish)({
|
|
1024
|
-
|
|
1015
|
+
publicKey: users[0].publicKey.serialize(),
|
|
1025
1016
|
stateIndex: 1n,
|
|
1026
1017
|
voteOptionIndex: 0n,
|
|
1027
1018
|
nonce: 1n,
|
|
1028
1019
|
pollId: 1n,
|
|
1029
1020
|
newVoteWeight: 7n,
|
|
1030
1021
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1031
|
-
salt: (0, crypto_1.
|
|
1032
|
-
privateKey: users[0].
|
|
1022
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1023
|
+
privateKey: users[0].privateKey.serialize(),
|
|
1033
1024
|
signer,
|
|
1034
1025
|
});
|
|
1035
1026
|
});
|
|
1036
1027
|
it("should publish a new message by the new poll voters", async () => {
|
|
1037
1028
|
await (0, sdk_1.publish)({
|
|
1038
|
-
|
|
1029
|
+
publicKey: users[1].publicKey.serialize(),
|
|
1039
1030
|
stateIndex: 1n,
|
|
1040
1031
|
voteOptionIndex: 0n,
|
|
1041
1032
|
nonce: 1n,
|
|
1042
1033
|
pollId: 1n,
|
|
1043
1034
|
newVoteWeight: 7n,
|
|
1044
1035
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1045
|
-
salt: (0, crypto_1.
|
|
1046
|
-
privateKey: users[1].
|
|
1036
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1037
|
+
privateKey: users[1].privateKey.serialize(),
|
|
1047
1038
|
signer,
|
|
1048
1039
|
});
|
|
1049
1040
|
});
|
|
@@ -1076,7 +1067,7 @@ describe("e2e tests", function test() {
|
|
|
1076
1067
|
await (0, utils_1.clean)();
|
|
1077
1068
|
});
|
|
1078
1069
|
before(async () => {
|
|
1079
|
-
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
1070
|
+
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
1080
1071
|
const signupPolicyContractAddress = await signupPolicy.getAddress();
|
|
1081
1072
|
// deploy the smart contracts
|
|
1082
1073
|
maciAddresses = await (0, sdk_1.deployMaci)({
|
|
@@ -1086,7 +1077,7 @@ describe("e2e tests", function test() {
|
|
|
1086
1077
|
});
|
|
1087
1078
|
});
|
|
1088
1079
|
it("should run the first poll", async () => {
|
|
1089
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
1080
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
1090
1081
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
1091
1082
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
1092
1083
|
// deploy a poll contract
|
|
@@ -1098,7 +1089,7 @@ describe("e2e tests", function test() {
|
|
|
1098
1089
|
relayers: [await signer.getAddress()],
|
|
1099
1090
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1100
1091
|
verifierContractAddress,
|
|
1101
|
-
|
|
1092
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1102
1093
|
policyContractAddress: pollPolicyContractAddress,
|
|
1103
1094
|
initialVoiceCreditProxyContractAddress,
|
|
1104
1095
|
});
|
|
@@ -1108,14 +1099,14 @@ describe("e2e tests", function test() {
|
|
|
1108
1099
|
// eslint-disable-next-line no-await-in-loop
|
|
1109
1100
|
await (0, sdk_1.signup)({
|
|
1110
1101
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1111
|
-
|
|
1102
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
1112
1103
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
1113
1104
|
signer,
|
|
1114
1105
|
});
|
|
1115
1106
|
// eslint-disable-next-line no-await-in-loop
|
|
1116
1107
|
const { isRegistered, stateIndex } = await (0, sdk_1.getSignedupUserData)({
|
|
1117
1108
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1118
|
-
|
|
1109
|
+
maciPublicKey: users[i].publicKey.serialize(),
|
|
1119
1110
|
signer,
|
|
1120
1111
|
});
|
|
1121
1112
|
(0, chai_1.expect)(isRegistered).to.eq(true);
|
|
@@ -1127,13 +1118,12 @@ describe("e2e tests", function test() {
|
|
|
1127
1118
|
// eslint-disable-next-line no-await-in-loop
|
|
1128
1119
|
await (0, sdk_1.joinPoll)({
|
|
1129
1120
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1130
|
-
privateKey: users[i].
|
|
1131
|
-
stateIndex: BigInt(i + 1),
|
|
1121
|
+
privateKey: users[i].privateKey.serialize(),
|
|
1132
1122
|
pollId: 0n,
|
|
1133
|
-
pollJoiningZkey: constants_1.
|
|
1123
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1134
1124
|
useWasm: true,
|
|
1135
1125
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
1136
|
-
|
|
1126
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1137
1127
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1138
1128
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1139
1129
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -1143,7 +1133,7 @@ describe("e2e tests", function test() {
|
|
|
1143
1133
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
1144
1134
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1145
1135
|
pollId: 0n,
|
|
1146
|
-
|
|
1136
|
+
pollPublicKey: users[i].publicKey.serialize(),
|
|
1147
1137
|
signer,
|
|
1148
1138
|
startBlock: 0,
|
|
1149
1139
|
});
|
|
@@ -1152,29 +1142,29 @@ describe("e2e tests", function test() {
|
|
|
1152
1142
|
}
|
|
1153
1143
|
// publish
|
|
1154
1144
|
await (0, sdk_1.publish)({
|
|
1155
|
-
|
|
1145
|
+
publicKey: users[0].publicKey.serialize(),
|
|
1156
1146
|
stateIndex: 1n,
|
|
1157
1147
|
voteOptionIndex: 0n,
|
|
1158
1148
|
nonce: 1n,
|
|
1159
1149
|
pollId: 0n,
|
|
1160
1150
|
newVoteWeight: 9n,
|
|
1161
1151
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1162
|
-
salt: (0, crypto_1.
|
|
1163
|
-
privateKey: users[0].
|
|
1152
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1153
|
+
privateKey: users[0].privateKey.serialize(),
|
|
1164
1154
|
signer,
|
|
1165
1155
|
});
|
|
1166
1156
|
const votes = [
|
|
1167
1157
|
{
|
|
1168
1158
|
pollId: 0n,
|
|
1169
1159
|
voteOptionIndex: 0n,
|
|
1170
|
-
salt: (0, crypto_1.
|
|
1160
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1171
1161
|
nonce: 1n,
|
|
1172
|
-
privateKey: users[0].
|
|
1162
|
+
privateKey: users[0].privateKey,
|
|
1173
1163
|
stateIndex: 1n,
|
|
1174
1164
|
voteWeight: 5n,
|
|
1175
|
-
|
|
1165
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1176
1166
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1177
|
-
|
|
1167
|
+
newPublicKey: users[0].publicKey,
|
|
1178
1168
|
},
|
|
1179
1169
|
];
|
|
1180
1170
|
const messages = votes
|
|
@@ -1183,8 +1173,8 @@ describe("e2e tests", function test() {
|
|
|
1183
1173
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1184
1174
|
poll: 0,
|
|
1185
1175
|
data: message.data.map(String),
|
|
1186
|
-
publicKey: ephemeralKeypair.
|
|
1187
|
-
hash: message.hash(ephemeralKeypair.
|
|
1176
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1177
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1188
1178
|
}));
|
|
1189
1179
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
1190
1180
|
const ipfsMessageBackupFiles = await (0, utils_1.getBackupFilenames)();
|
|
@@ -1205,7 +1195,7 @@ describe("e2e tests", function test() {
|
|
|
1205
1195
|
it("should deploy two more polls", async () => {
|
|
1206
1196
|
const startDate = await (0, sdk_1.getBlockTimestamp)(signer);
|
|
1207
1197
|
{
|
|
1208
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
1198
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
1209
1199
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
1210
1200
|
// deploy a poll contract
|
|
1211
1201
|
await (0, sdk_1.deployPoll)({
|
|
@@ -1216,13 +1206,13 @@ describe("e2e tests", function test() {
|
|
|
1216
1206
|
relayers: [await signer.getAddress()],
|
|
1217
1207
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1218
1208
|
verifierContractAddress,
|
|
1219
|
-
|
|
1209
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1220
1210
|
policyContractAddress: pollPolicyContractAddress,
|
|
1221
1211
|
initialVoiceCreditProxyContractAddress,
|
|
1222
1212
|
});
|
|
1223
1213
|
}
|
|
1224
1214
|
{
|
|
1225
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
1215
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
1226
1216
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
1227
1217
|
// deploy a poll contract
|
|
1228
1218
|
await (0, sdk_1.deployPoll)({
|
|
@@ -1233,7 +1223,7 @@ describe("e2e tests", function test() {
|
|
|
1233
1223
|
relayers: [await signer.getAddress()],
|
|
1234
1224
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1235
1225
|
verifierContractAddress,
|
|
1236
|
-
|
|
1226
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1237
1227
|
policyContractAddress: pollPolicyContractAddress,
|
|
1238
1228
|
initialVoiceCreditProxyContractAddress,
|
|
1239
1229
|
});
|
|
@@ -1241,18 +1231,18 @@ describe("e2e tests", function test() {
|
|
|
1241
1231
|
});
|
|
1242
1232
|
it("join the second and third polls", async () => {
|
|
1243
1233
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
1244
|
-
for (let
|
|
1234
|
+
for (let pollId = 1; pollId <= 2; pollId += 1) {
|
|
1235
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
1245
1236
|
for (let i = 0; i < users.length; i += 1) {
|
|
1246
1237
|
// eslint-disable-next-line no-await-in-loop
|
|
1247
1238
|
await (0, sdk_1.joinPoll)({
|
|
1248
1239
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1249
|
-
privateKey: users[i].
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
pollJoiningZkey: constants_1.pollJoiningTestZkeyPath,
|
|
1240
|
+
privateKey: users[i].privateKey.serialize(),
|
|
1241
|
+
pollId: BigInt(pollId),
|
|
1242
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1253
1243
|
useWasm: true,
|
|
1254
1244
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
1255
|
-
|
|
1245
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1256
1246
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1257
1247
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1258
1248
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -1261,8 +1251,8 @@ describe("e2e tests", function test() {
|
|
|
1261
1251
|
// eslint-disable-next-line no-await-in-loop
|
|
1262
1252
|
const { isJoined, pollStateIndex } = await (0, sdk_1.getJoinedUserData)({
|
|
1263
1253
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1264
|
-
pollId: BigInt(
|
|
1265
|
-
|
|
1254
|
+
pollId: BigInt(pollId),
|
|
1255
|
+
pollPublicKey: users[i].publicKey.serialize(),
|
|
1266
1256
|
signer,
|
|
1267
1257
|
startBlock: 0,
|
|
1268
1258
|
});
|
|
@@ -1273,39 +1263,39 @@ describe("e2e tests", function test() {
|
|
|
1273
1263
|
});
|
|
1274
1264
|
it("should publish messages to the second poll", async () => {
|
|
1275
1265
|
await (0, sdk_1.publish)({
|
|
1276
|
-
|
|
1266
|
+
publicKey: users[0].publicKey.serialize(),
|
|
1277
1267
|
stateIndex: 1n,
|
|
1278
1268
|
voteOptionIndex: 0n,
|
|
1279
1269
|
nonce: 1n,
|
|
1280
1270
|
pollId: 1n,
|
|
1281
1271
|
newVoteWeight: 9n,
|
|
1282
1272
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1283
|
-
salt: (0, crypto_1.
|
|
1284
|
-
privateKey: users[0].
|
|
1273
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1274
|
+
privateKey: users[0].privateKey.serialize(),
|
|
1285
1275
|
signer,
|
|
1286
1276
|
});
|
|
1287
1277
|
await (0, sdk_1.publish)({
|
|
1288
|
-
|
|
1278
|
+
publicKey: users[1].publicKey.serialize(),
|
|
1289
1279
|
stateIndex: 2n,
|
|
1290
1280
|
voteOptionIndex: 3n,
|
|
1291
1281
|
nonce: 1n,
|
|
1292
1282
|
pollId: 1n,
|
|
1293
1283
|
newVoteWeight: 1n,
|
|
1294
1284
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1295
|
-
salt: (0, crypto_1.
|
|
1296
|
-
privateKey: users[1].
|
|
1285
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1286
|
+
privateKey: users[1].privateKey.serialize(),
|
|
1297
1287
|
signer,
|
|
1298
1288
|
});
|
|
1299
1289
|
await (0, sdk_1.publish)({
|
|
1300
|
-
|
|
1290
|
+
publicKey: users[2].publicKey.serialize(),
|
|
1301
1291
|
stateIndex: 3n,
|
|
1302
1292
|
voteOptionIndex: 5n,
|
|
1303
1293
|
nonce: 1n,
|
|
1304
1294
|
pollId: 1n,
|
|
1305
1295
|
newVoteWeight: 3n,
|
|
1306
1296
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1307
|
-
salt: (0, crypto_1.
|
|
1308
|
-
privateKey: users[2].
|
|
1297
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1298
|
+
privateKey: users[2].privateKey.serialize(),
|
|
1309
1299
|
signer,
|
|
1310
1300
|
});
|
|
1311
1301
|
});
|
|
@@ -1314,14 +1304,14 @@ describe("e2e tests", function test() {
|
|
|
1314
1304
|
{
|
|
1315
1305
|
pollId: 1n,
|
|
1316
1306
|
voteOptionIndex: 0n,
|
|
1317
|
-
salt: (0, crypto_1.
|
|
1307
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1318
1308
|
nonce: 1n,
|
|
1319
|
-
privateKey: users[0].
|
|
1309
|
+
privateKey: users[0].privateKey,
|
|
1320
1310
|
stateIndex: 1n,
|
|
1321
1311
|
voteWeight: 3n,
|
|
1322
|
-
|
|
1312
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1323
1313
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1324
|
-
|
|
1314
|
+
newPublicKey: users[0].publicKey,
|
|
1325
1315
|
},
|
|
1326
1316
|
];
|
|
1327
1317
|
const messages = votes
|
|
@@ -1330,8 +1320,8 @@ describe("e2e tests", function test() {
|
|
|
1330
1320
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1331
1321
|
poll: 1,
|
|
1332
1322
|
data: message.data.map(String),
|
|
1333
|
-
publicKey: ephemeralKeypair.
|
|
1334
|
-
hash: message.hash(ephemeralKeypair.
|
|
1323
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1324
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1335
1325
|
}));
|
|
1336
1326
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 1, maciAddress: maciAddresses.maciContractAddress });
|
|
1337
1327
|
});
|
|
@@ -1340,26 +1330,26 @@ describe("e2e tests", function test() {
|
|
|
1340
1330
|
{
|
|
1341
1331
|
pollId: 2n,
|
|
1342
1332
|
voteOptionIndex: 7n,
|
|
1343
|
-
salt: (0, crypto_1.
|
|
1333
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1344
1334
|
nonce: 1n,
|
|
1345
|
-
privateKey: users[4].
|
|
1335
|
+
privateKey: users[4].privateKey,
|
|
1346
1336
|
stateIndex: 4n,
|
|
1347
1337
|
voteWeight: 3n,
|
|
1348
|
-
|
|
1338
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1349
1339
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1350
|
-
|
|
1340
|
+
newPublicKey: users[4].publicKey,
|
|
1351
1341
|
},
|
|
1352
1342
|
{
|
|
1353
1343
|
pollId: 2n,
|
|
1354
1344
|
voteOptionIndex: 5n,
|
|
1355
|
-
salt: (0, crypto_1.
|
|
1345
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1356
1346
|
nonce: 1n,
|
|
1357
|
-
privateKey: users[5].
|
|
1347
|
+
privateKey: users[5].privateKey,
|
|
1358
1348
|
stateIndex: 5n,
|
|
1359
1349
|
voteWeight: 4n,
|
|
1360
|
-
|
|
1350
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1361
1351
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1362
|
-
|
|
1352
|
+
newPublicKey: users[5].publicKey,
|
|
1363
1353
|
},
|
|
1364
1354
|
];
|
|
1365
1355
|
const messages = votes
|
|
@@ -1368,46 +1358,46 @@ describe("e2e tests", function test() {
|
|
|
1368
1358
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1369
1359
|
poll: 2,
|
|
1370
1360
|
data: message.data.map(String),
|
|
1371
|
-
publicKey: ephemeralKeypair.
|
|
1372
|
-
hash: message.hash(ephemeralKeypair.
|
|
1361
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1362
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1373
1363
|
}));
|
|
1374
1364
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 2, maciAddress: maciAddresses.maciContractAddress });
|
|
1375
1365
|
});
|
|
1376
1366
|
it("should publish messages to the third poll", async () => {
|
|
1377
1367
|
await (0, sdk_1.publish)({
|
|
1378
|
-
|
|
1368
|
+
publicKey: users[3].publicKey.serialize(),
|
|
1379
1369
|
stateIndex: 3n,
|
|
1380
1370
|
voteOptionIndex: 5n,
|
|
1381
1371
|
nonce: 1n,
|
|
1382
1372
|
pollId: 2n,
|
|
1383
1373
|
newVoteWeight: 3n,
|
|
1384
1374
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1385
|
-
salt: (0, crypto_1.
|
|
1386
|
-
privateKey: users[3].
|
|
1375
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1376
|
+
privateKey: users[3].privateKey.serialize(),
|
|
1387
1377
|
signer,
|
|
1388
1378
|
});
|
|
1389
1379
|
await (0, sdk_1.publish)({
|
|
1390
|
-
|
|
1380
|
+
publicKey: users[4].publicKey.serialize(),
|
|
1391
1381
|
stateIndex: 4n,
|
|
1392
1382
|
voteOptionIndex: 7n,
|
|
1393
1383
|
nonce: 1n,
|
|
1394
1384
|
pollId: 2n,
|
|
1395
1385
|
newVoteWeight: 2n,
|
|
1396
1386
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1397
|
-
salt: (0, crypto_1.
|
|
1398
|
-
privateKey: users[4].
|
|
1387
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1388
|
+
privateKey: users[4].privateKey.serialize(),
|
|
1399
1389
|
signer,
|
|
1400
1390
|
});
|
|
1401
1391
|
await (0, sdk_1.publish)({
|
|
1402
|
-
|
|
1392
|
+
publicKey: users[5].publicKey.serialize(),
|
|
1403
1393
|
stateIndex: 5n,
|
|
1404
1394
|
voteOptionIndex: 5n,
|
|
1405
1395
|
nonce: 1n,
|
|
1406
1396
|
pollId: 2n,
|
|
1407
1397
|
newVoteWeight: 9n,
|
|
1408
1398
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1409
|
-
salt: (0, crypto_1.
|
|
1410
|
-
privateKey: users[5].
|
|
1399
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1400
|
+
privateKey: users[5].privateKey.serialize(),
|
|
1411
1401
|
signer,
|
|
1412
1402
|
});
|
|
1413
1403
|
});
|
|
@@ -1470,9 +1460,9 @@ describe("e2e tests", function test() {
|
|
|
1470
1460
|
}
|
|
1471
1461
|
});
|
|
1472
1462
|
before(async () => {
|
|
1473
|
-
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
1463
|
+
const [signupPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
1474
1464
|
const signupPolicyContractAddress = await signupPolicy.getAddress();
|
|
1475
|
-
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)(signer, true);
|
|
1465
|
+
const [pollPolicy] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({}, signer, true);
|
|
1476
1466
|
const pollPolicyContractAddress = await pollPolicy.getAddress();
|
|
1477
1467
|
// deploy the smart contracts
|
|
1478
1468
|
maciAddresses = await (0, sdk_1.deployMaci)({
|
|
@@ -1490,7 +1480,7 @@ describe("e2e tests", function test() {
|
|
|
1490
1480
|
relayers: [await signer.getAddress()],
|
|
1491
1481
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1492
1482
|
verifierContractAddress,
|
|
1493
|
-
|
|
1483
|
+
verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
|
|
1494
1484
|
policyContractAddress: pollPolicyContractAddress,
|
|
1495
1485
|
initialVoiceCreditProxyContractAddress,
|
|
1496
1486
|
});
|
|
@@ -1498,7 +1488,7 @@ describe("e2e tests", function test() {
|
|
|
1498
1488
|
it("should signup one user", async () => {
|
|
1499
1489
|
await (0, sdk_1.signup)({
|
|
1500
1490
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1501
|
-
|
|
1491
|
+
maciPublicKey: user.publicKey.serialize(),
|
|
1502
1492
|
sgData: constants_1.DEFAULT_SG_DATA,
|
|
1503
1493
|
signer,
|
|
1504
1494
|
});
|
|
@@ -1507,13 +1497,12 @@ describe("e2e tests", function test() {
|
|
|
1507
1497
|
// joinPoll
|
|
1508
1498
|
await (0, sdk_1.joinPoll)({
|
|
1509
1499
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1510
|
-
privateKey: user.
|
|
1511
|
-
stateIndex: 1n,
|
|
1500
|
+
privateKey: user.privateKey.serialize(),
|
|
1512
1501
|
pollId: 0n,
|
|
1513
|
-
pollJoiningZkey: constants_1.
|
|
1502
|
+
pollJoiningZkey: constants_1.testPollJoiningZkeyPath,
|
|
1514
1503
|
useWasm: true,
|
|
1515
1504
|
pollWasm: constants_1.testPollJoiningWasmPath,
|
|
1516
|
-
|
|
1505
|
+
pollWitnessGenerator: constants_1.testPollJoiningWitnessPath,
|
|
1517
1506
|
rapidsnark: constants_1.testRapidsnarkPath,
|
|
1518
1507
|
sgDataArg: constants_1.DEFAULT_SG_DATA,
|
|
1519
1508
|
ivcpDataArg: constants_1.DEFAULT_IVCP_DATA,
|
|
@@ -1522,15 +1511,15 @@ describe("e2e tests", function test() {
|
|
|
1522
1511
|
});
|
|
1523
1512
|
it("should publish one message", async () => {
|
|
1524
1513
|
await (0, sdk_1.publish)({
|
|
1525
|
-
|
|
1514
|
+
publicKey: user.publicKey.serialize(),
|
|
1526
1515
|
stateIndex: 1n,
|
|
1527
1516
|
voteOptionIndex: 5n,
|
|
1528
1517
|
nonce: 1n,
|
|
1529
1518
|
pollId: 0n,
|
|
1530
1519
|
newVoteWeight: 3n,
|
|
1531
1520
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1532
|
-
salt: (0, crypto_1.
|
|
1533
|
-
privateKey: user.
|
|
1521
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1522
|
+
privateKey: user.privateKey.serialize(),
|
|
1534
1523
|
signer,
|
|
1535
1524
|
});
|
|
1536
1525
|
});
|
|
@@ -1539,14 +1528,14 @@ describe("e2e tests", function test() {
|
|
|
1539
1528
|
{
|
|
1540
1529
|
pollId: 0n,
|
|
1541
1530
|
voteOptionIndex: 5n,
|
|
1542
|
-
salt: (0, crypto_1.
|
|
1531
|
+
salt: (0, crypto_1.generateRandomSalt)(),
|
|
1543
1532
|
nonce: 1n,
|
|
1544
|
-
privateKey: user.
|
|
1533
|
+
privateKey: user.privateKey,
|
|
1545
1534
|
stateIndex: 1n,
|
|
1546
1535
|
voteWeight: 5n,
|
|
1547
|
-
|
|
1536
|
+
coordinatorPublicKey: constants_1.coordinatorKeypair.publicKey,
|
|
1548
1537
|
maxVoteOption: BigInt(core_1.VOTE_OPTION_TREE_ARITY ** constants_1.deployPollArgs.voteOptionTreeDepth),
|
|
1549
|
-
|
|
1538
|
+
newPublicKey: user.publicKey,
|
|
1550
1539
|
},
|
|
1551
1540
|
];
|
|
1552
1541
|
const messages = votes
|
|
@@ -1555,8 +1544,8 @@ describe("e2e tests", function test() {
|
|
|
1555
1544
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1556
1545
|
poll: 0,
|
|
1557
1546
|
data: message.data.map(String),
|
|
1558
|
-
publicKey: ephemeralKeypair.
|
|
1559
|
-
hash: message.hash(ephemeralKeypair.
|
|
1547
|
+
publicKey: ephemeralKeypair.publicKey.asArray().map(String),
|
|
1548
|
+
hash: message.hash(ephemeralKeypair.publicKey).toString(),
|
|
1560
1549
|
}));
|
|
1561
1550
|
await (0, utils_1.relayTestMessages)({ messages, signer, pollId: 0, maciAddress: maciAddresses.maciContractAddress });
|
|
1562
1551
|
});
|
|
@@ -1567,7 +1556,7 @@ describe("e2e tests", function test() {
|
|
|
1567
1556
|
await (0, sdk_1.generateMaciState)({
|
|
1568
1557
|
maciAddress: maciAddresses.maciContractAddress,
|
|
1569
1558
|
outputPath: stateOutPath,
|
|
1570
|
-
coordinatorPrivateKey: constants_1.
|
|
1559
|
+
coordinatorPrivateKey: constants_1.coordinatorPrivateKey,
|
|
1571
1560
|
blockPerBatch: 50,
|
|
1572
1561
|
pollId: 0n,
|
|
1573
1562
|
signer,
|