@maci-protocol/testing 0.0.0-ci.f433bba → 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.
Files changed (51) hide show
  1. package/LICENSE +1 -2
  2. package/build/ts/__tests__/e2e.full.test.d.ts +2 -0
  3. package/build/ts/__tests__/e2e.full.test.d.ts.map +1 -0
  4. package/build/ts/__tests__/e2e.full.test.js +844 -0
  5. package/build/ts/__tests__/e2e.full.test.js.map +1 -0
  6. package/build/ts/__tests__/e2e.nonQv.test.js +420 -34
  7. package/build/ts/__tests__/e2e.nonQv.test.js.map +1 -1
  8. package/build/ts/__tests__/e2e.test.js +250 -261
  9. package/build/ts/__tests__/e2e.test.js.map +1 -1
  10. package/build/ts/__tests__/integration.test.js +53 -52
  11. package/build/ts/__tests__/integration.test.js.map +1 -1
  12. package/build/ts/__tests__/keyChange.test.js +69 -72
  13. package/build/ts/__tests__/keyChange.test.js.map +1 -1
  14. package/build/ts/__tests__/maciKeys.test.d.ts +2 -0
  15. package/build/ts/__tests__/maciKeys.test.d.ts.map +1 -0
  16. package/build/ts/__tests__/maciKeys.test.js +78 -0
  17. package/build/ts/__tests__/maciKeys.test.js.map +1 -0
  18. package/build/ts/__tests__/unit/joinPoll.test.js +92 -25
  19. package/build/ts/__tests__/unit/joinPoll.test.js.map +1 -1
  20. package/build/ts/__tests__/unit/poll.test.js +5 -5
  21. package/build/ts/__tests__/unit/poll.test.js.map +1 -1
  22. package/build/ts/__tests__/unit/publish.test.js +8 -8
  23. package/build/ts/__tests__/unit/publish.test.js.map +1 -1
  24. package/build/ts/__tests__/unit/signup.test.js +8 -8
  25. package/build/ts/__tests__/unit/signup.test.js.map +1 -1
  26. package/build/ts/__tests__/unit/utils.test.js +12 -12
  27. package/build/ts/__tests__/unit/utils.test.js.map +1 -1
  28. package/build/ts/constants.d.ts +52 -53
  29. package/build/ts/constants.d.ts.map +1 -1
  30. package/build/ts/constants.js +98 -74
  31. package/build/ts/constants.js.map +1 -1
  32. package/build/ts/testingClass.d.ts +7 -7
  33. package/build/ts/testingClass.d.ts.map +1 -1
  34. package/build/ts/testingClass.js +26 -25
  35. package/build/ts/testingClass.js.map +1 -1
  36. package/build/ts/types.d.ts +11 -11
  37. package/build/ts/types.d.ts.map +1 -1
  38. package/build/ts/user.d.ts +5 -9
  39. package/build/ts/user.d.ts.map +1 -1
  40. package/build/ts/user.js +5 -6
  41. package/build/ts/user.js.map +1 -1
  42. package/build/ts/utils.d.ts +3 -3
  43. package/build/ts/utils.d.ts.map +1 -1
  44. package/build/ts/utils.js +12 -12
  45. package/build/ts/utils.js.map +1 -1
  46. package/build/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +13 -12
  48. package/build/ts/__tests__/maci-keys.test.d.ts +0 -2
  49. package/build/ts/__tests__/maci-keys.test.d.ts.map +0 -1
  50. package/build/ts/__tests__/maci-keys.test.js +0 -78
  51. package/build/ts/__tests__/maci-keys.test.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maci-protocol/testing",
3
- "version": "0.0.0-ci.f433bba",
3
+ "version": "0.0.0-ci.f4e2c46",
4
4
  "private": false,
5
5
  "description": "A package with testing utilities for MACI",
6
6
  "main": "build/ts/index.js",
@@ -22,32 +22,33 @@
22
22
  "test:e2e": "NODE_ENV=test ts-mocha --exit ./ts/__tests__/e2e*.test.ts",
23
23
  "test:e2e-qv": "NODE_ENV=test ts-mocha --exit ./ts/__tests__/e2e.test.ts",
24
24
  "test:e2e-non-qv": "NODE_ENV=test ts-mocha --exit ./ts/__tests__/e2e.nonQv.test.ts",
25
+ "test:e2e-full": "NODE_ENV=test ts-mocha --exit ./ts/__tests__/e2e.full.test.ts",
25
26
  "test:keyChange": "NODE_ENV=test ts-mocha --exit ./ts/__tests__/keyChange.test.ts",
26
27
  "test:unit": "NODE_ENV=test ts-mocha --exit ./ts/__tests__/unit/*.test.ts"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/chai-as-promised": "^7.1.8",
30
31
  "@types/mocha": "^10.0.10",
31
- "@types/node": "^22.14.0",
32
+ "@types/node": "^22.15.17",
32
33
  "chai": "^4.3.10",
33
34
  "chai-as-promised": "^7.1.2",
34
35
  "hardhat-artifactor": "^0.2.0",
35
36
  "hardhat-contract-sizer": "^2.0.3",
36
- "mocha": "^11.1.0",
37
+ "mocha": "^11.4.0",
37
38
  "ts-mocha": "^11.1.0",
38
39
  "typescript": "^5.8.3"
39
40
  },
40
41
  "dependencies": {
41
- "@maci-protocol/circuits": "0.0.0-ci.f433bba",
42
- "@maci-protocol/cli": "0.0.0-ci.f433bba",
43
- "@maci-protocol/core": "0.0.0-ci.f433bba",
44
- "@maci-protocol/crypto": "0.0.0-ci.f433bba",
45
- "@maci-protocol/domainobjs": "0.0.0-ci.f433bba",
46
- "@maci-protocol/sdk": "0.0.0-ci.f433bba",
42
+ "@maci-protocol/circuits": "0.0.0-ci.f4e2c46",
43
+ "@maci-protocol/cli": "0.0.0-ci.f4e2c46",
44
+ "@maci-protocol/core": "0.0.0-ci.f4e2c46",
45
+ "@maci-protocol/crypto": "0.0.0-ci.f4e2c46",
46
+ "@maci-protocol/domainobjs": "0.0.0-ci.f4e2c46",
47
+ "@maci-protocol/sdk": "0.0.0-ci.f4e2c46",
47
48
  "@nomicfoundation/hardhat-toolbox": "^5.0.0",
48
49
  "@types/chai": "^4.3.11",
49
- "ethers": "^6.13.5",
50
- "hardhat": "^2.22.19"
50
+ "ethers": "^6.14.3",
51
+ "hardhat": "^2.24.1"
51
52
  },
52
- "gitHead": "19dddc7fd79cc2d375fe8e7d540906f9b4f0c3ac"
53
+ "gitHead": "cc33cae35b8c11371af766d221e2e94d0348c34c"
53
54
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=maci-keys.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"maci-keys.test.d.ts","sourceRoot":"","sources":["../../../ts/__tests__/maci-keys.test.ts"],"names":[],"mappings":""}
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const crypto_1 = require("@maci-protocol/crypto");
4
- const domainobjs_1 = require("@maci-protocol/domainobjs");
5
- const sdk_1 = require("@maci-protocol/sdk");
6
- const chai_1 = require("chai");
7
- const constants_1 = require("../constants");
8
- const testingClass_1 = require("../testingClass");
9
- describe("integration tests private/public/keypair", () => {
10
- describe("crypto/domainobjs", () => {
11
- it("should serialize and deserialize a private key correctly", () => {
12
- const privateKeyCrypto = (0, crypto_1.genPrivKey)();
13
- const privKeyDomainobjs = new domainobjs_1.PrivKey(privateKeyCrypto);
14
- const privKeyDomainobjsSerialized = privKeyDomainobjs.serialize();
15
- const privKeyDomainobjsDeserialized = domainobjs_1.PrivKey.deserialize(privKeyDomainobjsSerialized);
16
- (0, chai_1.expect)(privKeyDomainobjsDeserialized.rawPrivKey.toString()).to.eq(privateKeyCrypto.toString());
17
- });
18
- it("should serialize and deserialize a public key correctly", () => {
19
- const privateKeyCrypto = (0, crypto_1.genPrivKey)();
20
- const publicKeyCrypto = (0, crypto_1.genPubKey)(privateKeyCrypto);
21
- const pubKeyDomainobjs = new domainobjs_1.PubKey(publicKeyCrypto);
22
- const pubKeyDomainobjsSerialized = pubKeyDomainobjs.serialize();
23
- const pubKeyDomainobjsDeserialized = domainobjs_1.PubKey.deserialize(pubKeyDomainobjsSerialized);
24
- (0, chai_1.expect)(pubKeyDomainobjsDeserialized.rawPubKey[0].toString()).to.eq(publicKeyCrypto[0].toString());
25
- (0, chai_1.expect)(pubKeyDomainobjsDeserialized.rawPubKey[1].toString()).to.eq(publicKeyCrypto[1].toString());
26
- });
27
- it("should serialize and deserialize a private key correct after serializing as contract params", () => {
28
- const privateKeyCrypto = (0, crypto_1.genPrivKey)();
29
- const privKeyDomainobjs = new domainobjs_1.PrivKey(privateKeyCrypto);
30
- const keypairDomainobjs = new domainobjs_1.Keypair(privKeyDomainobjs);
31
- const pubKeyDomainobjsAsContractParam = keypairDomainobjs.pubKey.asContractParam();
32
- const privKeyDomainobjsSerialized = privKeyDomainobjs.serialize();
33
- const privKeyDomainobjsDeserialized = domainobjs_1.PrivKey.deserialize(privKeyDomainobjsSerialized);
34
- const keypairDomainobjsDeserialized = new domainobjs_1.Keypair(privKeyDomainobjsDeserialized);
35
- (0, chai_1.expect)(keypairDomainobjsDeserialized.pubKey.rawPubKey[0].toString()).to.eq(pubKeyDomainobjsAsContractParam.x.toString());
36
- (0, chai_1.expect)(keypairDomainobjsDeserialized.pubKey.rawPubKey[1].toString()).to.eq(pubKeyDomainobjsAsContractParam.y.toString());
37
- });
38
- });
39
- describe("crypto/domainobjs/contracts", () => {
40
- let pollContract;
41
- let testingClass;
42
- let signer;
43
- const coordinatorKeypair = new domainobjs_1.Keypair();
44
- before(async () => {
45
- signer = await (0, sdk_1.getDefaultSigner)();
46
- testingClass = await testingClass_1.TestingClass.getInstance({
47
- pollJoiningZkeyPath: constants_1.pollJoiningZkey,
48
- pollJoinedZkeyPath: constants_1.pollJoinedZkey,
49
- processMessagesZkeyPath: constants_1.processMessagesZkeyPathNonQv,
50
- tallyVotesZkeyPath: constants_1.tallyVotesZkeyPathNonQv,
51
- pollWasm: constants_1.pollWasm,
52
- pollWitgen: constants_1.pollWitgen,
53
- rapidsnark: constants_1.rapidsnark,
54
- });
55
- const pollContractAddress = testingClass.contractsData.polls[0];
56
- pollContract = sdk_1.Poll__factory.connect(pollContractAddress, signer);
57
- });
58
- it("should have the correct coordinator pub key set on chain", async () => {
59
- const onChainKey = await pollContract.coordinatorPubKey();
60
- (0, chai_1.expect)(onChainKey.x.toString()).to.eq(coordinatorKeypair.pubKey.rawPubKey[0].toString());
61
- (0, chai_1.expect)(onChainKey.y.toString()).to.eq(coordinatorKeypair.pubKey.rawPubKey[1].toString());
62
- });
63
- it("should serialize and deserialize the coordinator private key to match the on chain key", async () => {
64
- const onChainKey = await pollContract.coordinatorPubKey();
65
- const coordinatorPrivKeySerialized = coordinatorKeypair.privKey.serialize();
66
- const coordinatorPrivKeyDeserialized = domainobjs_1.PrivKey.deserialize(coordinatorPrivKeySerialized);
67
- const coordinatorKeypairDeserialized = new domainobjs_1.Keypair(coordinatorPrivKeyDeserialized);
68
- (0, chai_1.expect)(coordinatorKeypairDeserialized.pubKey.rawPubKey[0].toString()).to.eq(onChainKey.x.toString());
69
- (0, chai_1.expect)(coordinatorKeypairDeserialized.pubKey.rawPubKey[1].toString()).to.eq(onChainKey.y.toString());
70
- });
71
- it("should have a matching coordinator public key hash", async () => {
72
- const onChainKeyHash = await pollContract.coordinatorPubKeyHash();
73
- const coordinatorPubKeyHash = coordinatorKeypair.pubKey.hash();
74
- (0, chai_1.expect)(onChainKeyHash.toString()).to.eq(coordinatorPubKeyHash.toString());
75
- });
76
- });
77
- });
78
- //# sourceMappingURL=maci-keys.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"maci-keys.test.js","sourceRoot":"","sources":["../../../ts/__tests__/maci-keys.test.ts"],"names":[],"mappings":";;AAAA,kDAA8D;AAC9D,0DAAqE;AACrE,4CAA+F;AAC/F,+BAA8B;AAI9B,4CAQsB;AACtB,kDAA+C;AAE/C,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EAAE;IACxD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;YAClE,MAAM,gBAAgB,GAAG,IAAA,mBAAU,GAAE,CAAC;YAEtC,MAAM,iBAAiB,GAAG,IAAI,oBAAO,CAAC,gBAAgB,CAAC,CAAC;YACxD,MAAM,2BAA2B,GAAG,iBAAiB,CAAC,SAAS,EAAE,CAAC;YAElE,MAAM,6BAA6B,GAAG,oBAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;YAEvF,IAAA,aAAM,EAAC,6BAA6B,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,gBAAgB,CA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