@maci-protocol/sdk 0.0.0-ci.fb960ed → 0.0.0-ci.fc91dc9
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/package.json +10 -2
- package/build/ts/browser/joinPoll.d.ts.map +1 -1
- package/build/ts/browser/joinPoll.js +14 -10
- package/build/ts/browser/joinPoll.js.map +1 -1
- package/build/ts/browser/utils.d.ts +1 -1
- package/build/ts/browser/utils.d.ts.map +1 -1
- package/build/ts/browser/utils.js +3 -3
- package/build/ts/browser/utils.js.map +1 -1
- package/build/ts/deploy/index.d.ts +2 -2
- package/build/ts/deploy/index.d.ts.map +1 -1
- package/build/ts/deploy/index.js +3 -3
- package/build/ts/deploy/index.js.map +1 -1
- package/build/ts/deploy/maci.js +1 -1
- package/build/ts/deploy/maci.js.map +1 -1
- package/build/ts/deploy/poll.d.ts +1 -1
- package/build/ts/deploy/poll.d.ts.map +1 -1
- package/build/ts/deploy/poll.js +5 -5
- package/build/ts/deploy/poll.js.map +1 -1
- package/build/ts/deploy/types.d.ts +4 -4
- package/build/ts/deploy/types.d.ts.map +1 -1
- package/build/ts/deploy/utils.js +1 -1
- package/build/ts/deploy/utils.js.map +1 -1
- package/build/ts/deploy/verifyingKeysRegistry.d.ts +7 -0
- package/build/ts/deploy/verifyingKeysRegistry.d.ts.map +1 -0
- package/build/ts/deploy/verifyingKeysRegistry.js +14 -0
- package/build/ts/deploy/verifyingKeysRegistry.js.map +1 -0
- package/build/ts/index.d.ts +1 -1
- package/build/ts/index.d.ts.map +1 -1
- package/build/ts/index.js +11 -7
- package/build/ts/index.js.map +1 -1
- package/build/ts/maci/state.d.ts +1 -1
- package/build/ts/maci/state.js +8 -8
- package/build/ts/maci/state.js.map +1 -1
- package/build/ts/maci/types.d.ts +1 -1
- package/build/ts/maciKeys/__tests__/keypair.test.js +3 -3
- package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -1
- package/build/ts/maciKeys/__tests__/publicKeys.test.js +5 -5
- package/build/ts/maciKeys/__tests__/publicKeys.test.js.map +1 -1
- package/build/ts/maciKeys/publicKeys.js +2 -2
- package/build/ts/maciKeys/publicKeys.js.map +1 -1
- package/build/ts/poll/poll.js +4 -4
- package/build/ts/poll/poll.js.map +1 -1
- package/build/ts/poll/types.d.ts +2 -2
- package/build/ts/poll/types.d.ts.map +1 -1
- package/build/ts/proof/__tests__/download.test.js +1 -1
- package/build/ts/proof/__tests__/download.test.js.map +1 -1
- package/build/ts/proof/generate.d.ts +1 -1
- package/build/ts/proof/generate.js +3 -3
- package/build/ts/proof/generate.js.map +1 -1
- package/build/ts/proof/prove.js +10 -10
- package/build/ts/proof/prove.js.map +1 -1
- package/build/ts/proof/types.d.ts +3 -3
- package/build/ts/proof/types.d.ts.map +1 -1
- package/build/ts/relayer/messages.js +1 -1
- package/build/ts/tally/commitments.js +2 -2
- package/build/ts/tally/commitments.js.map +1 -1
- package/build/ts/tally/index.d.ts +2 -1
- package/build/ts/tally/index.d.ts.map +1 -1
- package/build/ts/tally/index.js +4 -1
- package/build/ts/tally/index.js.map +1 -1
- package/build/ts/tally/results.d.ts +14 -0
- package/build/ts/tally/results.d.ts.map +1 -0
- package/build/ts/tally/results.js +44 -0
- package/build/ts/tally/results.js.map +1 -0
- package/build/ts/tally/types.d.ts +33 -7
- package/build/ts/tally/types.d.ts.map +1 -1
- package/build/ts/tally/utils.js +3 -3
- package/build/ts/tally/utils.js.map +1 -1
- package/build/ts/tally/verification.d.ts +1 -1
- package/build/ts/tally/verification.d.ts.map +1 -1
- package/build/ts/tally/verification.js +4 -4
- package/build/ts/tally/verification.js.map +1 -1
- package/build/ts/trees/stateTree.js +7 -7
- package/build/ts/trees/stateTree.js.map +1 -1
- package/build/ts/trees/types.d.ts +1 -1
- package/build/ts/trees/types.d.ts.map +1 -1
- package/build/ts/user/joinPoll.js +9 -9
- package/build/ts/user/joinPoll.js.map +1 -1
- package/build/ts/user/signup.js +3 -3
- package/build/ts/user/signup.js.map +1 -1
- package/build/ts/user/types.d.ts +2 -2
- package/build/ts/user/types.d.ts.map +1 -1
- package/build/ts/user/utils.d.ts +9 -9
- package/build/ts/user/utils.d.ts.map +1 -1
- package/build/ts/user/utils.js +20 -20
- package/build/ts/user/utils.js.map +1 -1
- package/build/ts/utils/proofs.d.ts +2 -2
- package/build/ts/utils/proofs.d.ts.map +1 -1
- package/build/ts/utils/proofs.js +4 -4
- package/build/ts/utils/proofs.js.map +1 -1
- package/build/ts/utils/types.d.ts +1 -1
- package/build/ts/utils/types.d.ts.map +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts.map +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.js +13 -13
- package/build/ts/verifyingKeys/checkVerifyingKeys.js.map +1 -1
- package/build/ts/verifyingKeys/index.d.ts +2 -2
- package/build/ts/verifyingKeys/index.d.ts.map +1 -1
- package/build/ts/verifyingKeys/index.js +5 -5
- package/build/ts/verifyingKeys/index.js.map +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts.map +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.js +36 -37
- package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -1
- package/build/ts/verifyingKeys/types.d.ts +32 -32
- package/build/ts/verifyingKeys/types.d.ts.map +1 -1
- package/build/ts/verifyingKeys/utils.d.ts +10 -10
- package/build/ts/verifyingKeys/utils.d.ts.map +1 -1
- package/build/ts/verifyingKeys/utils.js +73 -60
- package/build/ts/verifyingKeys/utils.js.map +1 -1
- package/build/ts/vote/generate.d.ts.map +1 -1
- package/build/ts/vote/generate.js +2 -2
- package/build/ts/vote/generate.js.map +1 -1
- package/build/ts/vote/index.d.ts +1 -1
- package/build/ts/vote/index.d.ts.map +1 -1
- package/build/ts/vote/index.js +2 -2
- package/build/ts/vote/index.js.map +1 -1
- package/build/ts/vote/invalidate.js +1 -1
- package/build/ts/vote/invalidate.js.map +1 -1
- package/build/ts/vote/publish.js +12 -12
- package/build/ts/vote/publish.js.map +1 -1
- package/build/ts/vote/utils.d.ts +1 -1
- package/build/ts/vote/utils.d.ts.map +1 -1
- package/build/ts/vote/utils.js +3 -3
- package/build/ts/vote/utils.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +16 -8
- package/build/ts/deploy/vkRegistry.d.ts +0 -7
- package/build/ts/deploy/vkRegistry.d.ts.map +0 -1
- package/build/ts/deploy/vkRegistry.js +0 -14
- package/build/ts/deploy/vkRegistry.js.map +0 -1
|
@@ -15,13 +15,13 @@ const utils_2 = require("./utils");
|
|
|
15
15
|
* @param CheckVerifyingKeysArgs - The arguments for the checkVerifyingKeys command
|
|
16
16
|
* @returns Whether the verifying keys match or not
|
|
17
17
|
*/
|
|
18
|
-
const checkVerifyingKeys = async ({ stateTreeDepth, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize, processMessagesZkeyPath, tallyVotesZkeyPath, pollJoiningZkeyPath, pollJoinedZkeyPath,
|
|
19
|
-
if (!
|
|
20
|
-
throw new Error("Please provide a
|
|
18
|
+
const checkVerifyingKeys = async ({ stateTreeDepth, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize, processMessagesZkeyPath, tallyVotesZkeyPath, pollJoiningZkeyPath, pollJoinedZkeyPath, verifyingKeysRegistry, signer, useQuadraticVoting = true, }) => {
|
|
19
|
+
if (!verifyingKeysRegistry) {
|
|
20
|
+
throw new Error("Please provide a VerifyingKeysRegistry contract address");
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
24
|
-
throw new Error("The
|
|
22
|
+
const isVerifyingKeyExists = await (0, utils_1.contractExists)(signer.provider, verifyingKeysRegistry);
|
|
23
|
+
if (!isVerifyingKeyExists) {
|
|
24
|
+
throw new Error("The VerifyingKeysRegistry contract does not exist");
|
|
25
25
|
}
|
|
26
26
|
// we need to ensure that the zkey files exist
|
|
27
27
|
const isProcessMessagesZkeyPathExists = fs_1.default.existsSync(processMessagesZkeyPath);
|
|
@@ -33,15 +33,15 @@ const checkVerifyingKeys = async ({ stateTreeDepth, intStateTreeDepth, voteOptio
|
|
|
33
33
|
throw new Error("The provided Tally votes zkey does not exist");
|
|
34
34
|
}
|
|
35
35
|
// extract the verification keys from the zkey files
|
|
36
|
-
const {
|
|
36
|
+
const { pollJoiningVerifyingKey, pollJoinedVerifyingKey, processVerifyingKey, tallyVerifyingKey } = await (0, utils_2.extractAllVerifyingKeys)({
|
|
37
37
|
processMessagesZkeyPath,
|
|
38
38
|
tallyVotesZkeyPath,
|
|
39
39
|
pollJoiningZkeyPath,
|
|
40
40
|
pollJoinedZkeyPath,
|
|
41
41
|
});
|
|
42
42
|
const mode = useQuadraticVoting ? contracts_1.EMode.QV : contracts_1.EMode.NON_QV;
|
|
43
|
-
const {
|
|
44
|
-
|
|
43
|
+
const { pollJoiningVerifyingKeyOnChain, pollJoinedVerifyingKeyOnChain, processVerifyingKeyOnChain, tallyVerifyingKeyOnChain, } = await (0, utils_2.getAllOnChainVerifyingKeys)({
|
|
44
|
+
verifyingKeysRegistryAddress: verifyingKeysRegistry,
|
|
45
45
|
signer,
|
|
46
46
|
stateTreeDepth,
|
|
47
47
|
voteOptionTreeDepth,
|
|
@@ -49,16 +49,16 @@ const checkVerifyingKeys = async ({ stateTreeDepth, intStateTreeDepth, voteOptio
|
|
|
49
49
|
intStateTreeDepth,
|
|
50
50
|
mode,
|
|
51
51
|
});
|
|
52
|
-
if (!(0, utils_2.
|
|
52
|
+
if (!(0, utils_2.compareVerifyingKeys)(pollJoiningVerifyingKeyOnChain, pollJoiningVerifyingKey)) {
|
|
53
53
|
throw new Error("Poll verifying keys do not match");
|
|
54
54
|
}
|
|
55
|
-
if (!(0, utils_2.
|
|
55
|
+
if (!(0, utils_2.compareVerifyingKeys)(pollJoinedVerifyingKeyOnChain, pollJoinedVerifyingKey)) {
|
|
56
56
|
throw new Error("Poll verifying keys do not match");
|
|
57
57
|
}
|
|
58
|
-
if (!(0, utils_2.
|
|
58
|
+
if (!(0, utils_2.compareVerifyingKeys)(processVerifyingKeyOnChain, processVerifyingKey)) {
|
|
59
59
|
throw new Error("Process verifying keys do not match");
|
|
60
60
|
}
|
|
61
|
-
if (!(0, utils_2.
|
|
61
|
+
if (!(0, utils_2.compareVerifyingKeys)(tallyVerifyingKeyOnChain, tallyVerifyingKey)) {
|
|
62
62
|
throw new Error("Tally verifying keys do not match");
|
|
63
63
|
}
|
|
64
64
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkVerifyingKeys.js","sourceRoot":"","sources":["../../../ts/verifyingKeys/checkVerifyingKeys.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAiD;AAEjD,4CAAoB;AAIpB,oCAA0C;AAE1C,
|
|
1
|
+
{"version":3,"file":"checkVerifyingKeys.js","sourceRoot":"","sources":["../../../ts/verifyingKeys/checkVerifyingKeys.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAiD;AAEjD,4CAAoB;AAIpB,oCAA0C;AAE1C,mCAAoG;AAEpG;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,MAAM,EACN,kBAAkB,GAAG,IAAI,GACD,EAAoB,EAAE;IAC9C,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,oBAAoB,GAAG,MAAM,IAAA,sBAAc,EAAC,MAAM,CAAC,QAAS,EAAE,qBAAqB,CAAC,CAAC;IAE3F,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CA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AAI,CAAC,IAAA,4BAAoB,EAAC,0BAA0B,EAAE,mBAAmB,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,CAAC,IAAA,4BAAoB,EAAC,wBAAwB,EAAE,iBAAiB,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA/EW,QAAA,kBAAkB,sBA+E7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { checkVerifyingKeys } from "./checkVerifyingKeys";
|
|
2
2
|
export { setVerifyingKeys } from "./setVerifyingKeys";
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
3
|
+
export { getAllOnChainVerifyingKeys, compareVerifyingKeys, extractAllVerifyingKeys, extractVerifyingKeyToFile, } from "./utils";
|
|
4
|
+
export type { IGetAllVerifyingKeysArgs, IMaciVerifyingKeysOnchain, IExtractAllVerifyingKeysArgs, IMaciVerifyingKeys, ISetVerifyingKeysArgs, ICheckVerifyingKeysArgs, } from "./types";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,SAAS,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.extractVerifyingKeyToFile = exports.extractAllVerifyingKeys = exports.compareVerifyingKeys = exports.getAllOnChainVerifyingKeys = exports.setVerifyingKeys = exports.checkVerifyingKeys = void 0;
|
|
4
4
|
var checkVerifyingKeys_1 = require("./checkVerifyingKeys");
|
|
5
5
|
Object.defineProperty(exports, "checkVerifyingKeys", { enumerable: true, get: function () { return checkVerifyingKeys_1.checkVerifyingKeys; } });
|
|
6
6
|
var setVerifyingKeys_1 = require("./setVerifyingKeys");
|
|
7
7
|
Object.defineProperty(exports, "setVerifyingKeys", { enumerable: true, get: function () { return setVerifyingKeys_1.setVerifyingKeys; } });
|
|
8
8
|
var utils_1 = require("./utils");
|
|
9
|
-
Object.defineProperty(exports, "
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
-
Object.defineProperty(exports, "
|
|
12
|
-
Object.defineProperty(exports, "
|
|
9
|
+
Object.defineProperty(exports, "getAllOnChainVerifyingKeys", { enumerable: true, get: function () { return utils_1.getAllOnChainVerifyingKeys; } });
|
|
10
|
+
Object.defineProperty(exports, "compareVerifyingKeys", { enumerable: true, get: function () { return utils_1.compareVerifyingKeys; } });
|
|
11
|
+
Object.defineProperty(exports, "extractAllVerifyingKeys", { enumerable: true, get: function () { return utils_1.extractAllVerifyingKeys; } });
|
|
12
|
+
Object.defineProperty(exports, "extractVerifyingKeyToFile", { enumerable: true, get: function () { return utils_1.extractVerifyingKeyToFile; } });
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/verifyingKeys/index.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/verifyingKeys/index.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iCAKiB;AAJf,mHAAA,0BAA0B,OAAA;AAC1B,6GAAA,oBAAoB,OAAA;AACpB,gHAAA,uBAAuB,OAAA;AACvB,kHAAA,yBAAyB,OAAA"}
|
|
@@ -3,5 +3,5 @@ import type { ISetVerifyingKeysArgs } from "./types";
|
|
|
3
3
|
* Set the verifying keys on the contract
|
|
4
4
|
* @param args - The arguments for the setVerifyingKeys function
|
|
5
5
|
*/
|
|
6
|
-
export declare const setVerifyingKeys: ({
|
|
6
|
+
export declare const setVerifyingKeys: ({ pollJoiningVerifyingKey, pollJoinedVerifyingKey, processMessagesVerifyingKey, tallyVotesVerifyingKey, stateTreeDepth, pollStateTreeDepth, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize, verifyingKeysRegistryAddress, signer, mode, }: ISetVerifyingKeysArgs) => Promise<void>;
|
|
7
7
|
//# sourceMappingURL=setVerifyingKeys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setVerifyingKeys.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/setVerifyingKeys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setVerifyingKeys.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/setVerifyingKeys.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAMrD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAU,qPAapC,qBAAqB,KAAG,OAAO,CAAC,IAAI,CAsGtC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setVerifyingKeys = void 0;
|
|
4
|
-
const contracts_1 = require("@maci-protocol/contracts");
|
|
5
4
|
const typechain_types_1 = require("@maci-protocol/contracts/typechain-types");
|
|
6
5
|
const core_1 = require("@maci-protocol/core");
|
|
7
6
|
const utils_1 = require("../utils");
|
|
@@ -10,7 +9,7 @@ const utils_2 = require("./utils");
|
|
|
10
9
|
* Set the verifying keys on the contract
|
|
11
10
|
* @param args - The arguments for the setVerifyingKeys function
|
|
12
11
|
*/
|
|
13
|
-
const setVerifyingKeys = async ({
|
|
12
|
+
const setVerifyingKeys = async ({ pollJoiningVerifyingKey, pollJoinedVerifyingKey, processMessagesVerifyingKey, tallyVotesVerifyingKey, stateTreeDepth, pollStateTreeDepth, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize, verifyingKeysRegistryAddress, signer, mode, }) => {
|
|
14
13
|
// validate args
|
|
15
14
|
if (stateTreeDepth < 1 || intStateTreeDepth < 1 || voteOptionTreeDepth < 1 || messageBatchSize < 1) {
|
|
16
15
|
throw new Error("Invalid depth or batch size parameters");
|
|
@@ -18,67 +17,67 @@ const setVerifyingKeys = async ({ pollJoiningVk, pollJoinedVk, processMessagesVk
|
|
|
18
17
|
if (stateTreeDepth < intStateTreeDepth) {
|
|
19
18
|
throw new Error("Invalid state tree depth or intermediate state tree depth");
|
|
20
19
|
}
|
|
21
|
-
const
|
|
20
|
+
const isContractExists = await (0, utils_1.contractExists)(signer.provider, verifyingKeysRegistryAddress);
|
|
22
21
|
// ensure we have a contract deployed at the provided address
|
|
23
|
-
if (!
|
|
24
|
-
throw new Error(`A
|
|
22
|
+
if (!isContractExists) {
|
|
23
|
+
throw new Error(`A VerifyingKeysRegistry contract is not deployed at ${verifyingKeysRegistryAddress}`);
|
|
25
24
|
}
|
|
26
|
-
// connect to
|
|
27
|
-
const
|
|
28
|
-
// check if the poll
|
|
29
|
-
const
|
|
30
|
-
if (await
|
|
25
|
+
// connect to VerifyingKeysRegistry contract
|
|
26
|
+
const verifyingKeysRegistryContract = typechain_types_1.VerifyingKeysRegistry__factory.connect(verifyingKeysRegistryAddress, signer);
|
|
27
|
+
// check if the poll verifyingKey was already set
|
|
28
|
+
const pollJoiningVerifyingKeySignature = (0, core_1.generatePollJoiningVerifyingKeySignature)(stateTreeDepth);
|
|
29
|
+
if (await verifyingKeysRegistryContract.isPollJoiningVerifyingKeySet(pollJoiningVerifyingKeySignature)) {
|
|
31
30
|
throw new Error("This poll verifying key is already set in the contract");
|
|
32
31
|
}
|
|
33
|
-
// check if the poll
|
|
34
|
-
const
|
|
35
|
-
if (await
|
|
32
|
+
// check if the poll verifyingKey was already set
|
|
33
|
+
const pollJoinedVerifyingKeySignature = (0, core_1.generatePollJoinedVerifyingKeySignature)(stateTreeDepth);
|
|
34
|
+
if (await verifyingKeysRegistryContract.isPollJoinedVerifyingKeySet(pollJoinedVerifyingKeySignature)) {
|
|
36
35
|
throw new Error("This poll verifying key is already set in the contract");
|
|
37
36
|
}
|
|
38
|
-
// check if the process messages
|
|
39
|
-
const
|
|
40
|
-
if (await
|
|
37
|
+
// check if the process messages verifyingKey was already set
|
|
38
|
+
const processVerifyingKeySignature = (0, core_1.generateProcessVerifyingKeySignature)(stateTreeDepth, voteOptionTreeDepth, messageBatchSize);
|
|
39
|
+
if (await verifyingKeysRegistryContract.isProcessVerifyingKeySet(processVerifyingKeySignature, mode)) {
|
|
41
40
|
throw new Error("This process verifying key is already set in the contract");
|
|
42
41
|
}
|
|
43
|
-
// do the same for the tally votes
|
|
44
|
-
const
|
|
45
|
-
if (await
|
|
42
|
+
// do the same for the tally votes verifyingKey
|
|
43
|
+
const tallyVerifyingKeySignature = (0, core_1.generateTallyVerifyingKeySignature)(stateTreeDepth, intStateTreeDepth, voteOptionTreeDepth);
|
|
44
|
+
if (await verifyingKeysRegistryContract.isTallyVerifyingKeySet(tallyVerifyingKeySignature, mode)) {
|
|
46
45
|
throw new Error("This tally verifying key is already set in the contract");
|
|
47
46
|
}
|
|
48
47
|
// set them onchain
|
|
49
|
-
const tx = await
|
|
48
|
+
const tx = await verifyingKeysRegistryContract.setVerifyingKeysBatch({
|
|
50
49
|
stateTreeDepth,
|
|
51
50
|
pollStateTreeDepth,
|
|
52
51
|
intStateTreeDepth,
|
|
53
52
|
voteOptionTreeDepth,
|
|
54
53
|
messageBatchSize,
|
|
55
54
|
modes: [mode],
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
pollJoiningVerifyingKey: pollJoiningVerifyingKey.asContractParam(),
|
|
56
|
+
pollJoinedVerifyingKey: pollJoinedVerifyingKey.asContractParam(),
|
|
57
|
+
processVerifyingKeys: [processMessagesVerifyingKey.asContractParam()],
|
|
58
|
+
tallyVerifyingKeys: [tallyVotesVerifyingKey.asContractParam()],
|
|
60
59
|
});
|
|
61
60
|
const receipt = await tx.wait();
|
|
62
61
|
if (receipt?.status !== 1) {
|
|
63
62
|
throw new Error("Set verifying keys transaction failed");
|
|
64
63
|
}
|
|
65
|
-
const [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
const [pollJoiningVerifyingKeyOnChain, pollJoinedVerifyingKeyOnChain, processVerifyingKeyOnChain, tallyVerifyingKeyOnChain,] = await Promise.all([
|
|
65
|
+
verifyingKeysRegistryContract.getPollJoiningVerifyingKey(stateTreeDepth),
|
|
66
|
+
verifyingKeysRegistryContract.getPollJoinedVerifyingKey(stateTreeDepth),
|
|
67
|
+
verifyingKeysRegistryContract.getProcessVerifyingKey(stateTreeDepth, voteOptionTreeDepth, messageBatchSize, mode),
|
|
68
|
+
verifyingKeysRegistryContract.getTallyVerifyingKey(stateTreeDepth, intStateTreeDepth, voteOptionTreeDepth, mode),
|
|
70
69
|
]);
|
|
71
|
-
if (!(0, utils_2.
|
|
72
|
-
throw new Error("
|
|
70
|
+
if (!(0, utils_2.compareVerifyingKeys)(pollJoiningVerifyingKeyOnChain, pollJoiningVerifyingKey)) {
|
|
71
|
+
throw new Error("pollJoiningVerifyingKey mismatch");
|
|
73
72
|
}
|
|
74
|
-
if (!(0, utils_2.
|
|
75
|
-
throw new Error("
|
|
73
|
+
if (!(0, utils_2.compareVerifyingKeys)(pollJoinedVerifyingKeyOnChain, pollJoinedVerifyingKey)) {
|
|
74
|
+
throw new Error("pollJoinedVerifyingKey mismatch");
|
|
76
75
|
}
|
|
77
|
-
if (!(0, utils_2.
|
|
78
|
-
throw new Error("
|
|
76
|
+
if (!(0, utils_2.compareVerifyingKeys)(processVerifyingKeyOnChain, processMessagesVerifyingKey)) {
|
|
77
|
+
throw new Error("processVerifyingKey mismatch");
|
|
79
78
|
}
|
|
80
|
-
if (!(0, utils_2.
|
|
81
|
-
throw new Error("
|
|
79
|
+
if (!(0, utils_2.compareVerifyingKeys)(tallyVerifyingKeyOnChain, tallyVotesVerifyingKey)) {
|
|
80
|
+
throw new Error("tallyVerifyingKey mismatch");
|
|
82
81
|
}
|
|
83
82
|
};
|
|
84
83
|
exports.setVerifyingKeys = setVerifyingKeys;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setVerifyingKeys.js","sourceRoot":"","sources":["../../../ts/verifyingKeys/setVerifyingKeys.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"setVerifyingKeys.js","sourceRoot":"","sources":["../../../ts/verifyingKeys/setVerifyingKeys.ts"],"names":[],"mappings":";;;AACA,8EAA0H;AAC1H,8CAK6B;AAI7B,oCAA0C;AAE1C,mCAA+C;AAE/C;;;GAGG;AACI,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,m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E,6BAA6B,CAAC,sBAAsB,CAAC,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,IAAI,CAAC;QACjH,6BAA6B,CAAC,oBAAoB,CAAC,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,IAAI,CAAC;KACjH,CAAC,CAAC;IAEH,IAAI,CAAC,IAAA,4BAAoB,EAAC,8BAA8B,EAAE,uBAAuB,CAAC,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,CAAC,IAAA,4BAAoB,EAAC,6BAA6B,EAAE,sBAAsB,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,CAAC,IAAA,4BAAoB,EAAC,0BAA0B,EAAE,2BAA2B,CAAC,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,CAAC,IAAA,4BAAoB,EAAC,wBAAwB,EAAE,sBAAsB,CAAC,EAAE,CAAC;QAC5E,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;AACH,CAAC,CAAC;AAnHW,QAAA,gBAAgB,oBAmH3B"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { EMode } from "@maci-protocol/contracts";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IVerifyingKeyContractParams, VerifyingKey } from "@maci-protocol/domainobjs";
|
|
3
3
|
import type { Signer } from "ethers";
|
|
4
4
|
/**
|
|
5
|
-
* Arguments for the
|
|
5
|
+
* Arguments for the getAllVerifyingKeys function
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface IGetAllVerifyingKeysArgs {
|
|
8
8
|
/**
|
|
9
|
-
* The address of the
|
|
9
|
+
* The address of the VerifyingKeysRegistry contract
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
verifyingKeysRegistryAddress: string;
|
|
12
12
|
/**
|
|
13
13
|
* The signer to use for the contract calls
|
|
14
14
|
*/
|
|
@@ -37,28 +37,28 @@ export interface IGetAllVksArgs {
|
|
|
37
37
|
/**
|
|
38
38
|
* MACI's verifying keys
|
|
39
39
|
*/
|
|
40
|
-
export interface
|
|
40
|
+
export interface IMaciVerifyingKeysOnchain {
|
|
41
41
|
/**
|
|
42
42
|
* The verifying key for the poll joining circuit
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
pollJoiningVerifyingKeyOnChain: IVerifyingKeyContractParams;
|
|
45
45
|
/**
|
|
46
46
|
* The verifying key for the poll joined circuit
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
pollJoinedVerifyingKeyOnChain: IVerifyingKeyContractParams;
|
|
49
49
|
/**
|
|
50
50
|
* The verifying key for the process messages circuit
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
processVerifyingKeyOnChain: IVerifyingKeyContractParams;
|
|
53
53
|
/**
|
|
54
54
|
* The verifying key for the tally votes circuit
|
|
55
55
|
*/
|
|
56
|
-
|
|
56
|
+
tallyVerifyingKeyOnChain: IVerifyingKeyContractParams;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Arguments for the
|
|
59
|
+
* Arguments for the extractAllVerifyingKeys function
|
|
60
60
|
*/
|
|
61
|
-
export interface
|
|
61
|
+
export interface IExtractAllVerifyingKeysArgs {
|
|
62
62
|
/**
|
|
63
63
|
* The path to the poll joining zkey
|
|
64
64
|
*/
|
|
@@ -79,44 +79,44 @@ export interface IExtractAllVksArgs {
|
|
|
79
79
|
/**
|
|
80
80
|
* Maci verifying keys
|
|
81
81
|
*/
|
|
82
|
-
export interface
|
|
82
|
+
export interface IMaciVerifyingKeys {
|
|
83
83
|
/**
|
|
84
84
|
* The poll joining verifying key
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
pollJoiningVerifyingKey?: VerifyingKey;
|
|
87
87
|
/**
|
|
88
88
|
* The poll joined verifying key
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
pollJoinedVerifyingKey?: VerifyingKey;
|
|
91
91
|
/**
|
|
92
92
|
* The message processing verifying key
|
|
93
93
|
*/
|
|
94
|
-
|
|
94
|
+
processVerifyingKey?: VerifyingKey;
|
|
95
95
|
/**
|
|
96
96
|
* The tally verifying key
|
|
97
97
|
*/
|
|
98
|
-
|
|
98
|
+
tallyVerifyingKey?: VerifyingKey;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* The arguments for the setVerifyingKeys function
|
|
102
102
|
*/
|
|
103
103
|
export interface ISetVerifyingKeysArgs {
|
|
104
104
|
/**
|
|
105
|
-
* The polll joining
|
|
105
|
+
* The polll joining verifying key object
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
pollJoiningVerifyingKey: VerifyingKey;
|
|
108
108
|
/**
|
|
109
|
-
* The poll joined
|
|
109
|
+
* The poll joined verifying key object
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
pollJoinedVerifyingKey: VerifyingKey;
|
|
112
112
|
/**
|
|
113
|
-
* The process messages
|
|
113
|
+
* The process messages verifying key object
|
|
114
114
|
*/
|
|
115
|
-
|
|
115
|
+
processMessagesVerifyingKey: VerifyingKey;
|
|
116
116
|
/**
|
|
117
|
-
* The tally votes
|
|
117
|
+
* The tally votes verifying key object
|
|
118
118
|
*/
|
|
119
|
-
|
|
119
|
+
tallyVotesVerifyingKey: VerifyingKey;
|
|
120
120
|
/**
|
|
121
121
|
* The state tree depth
|
|
122
122
|
*/
|
|
@@ -138,9 +138,9 @@ export interface ISetVerifyingKeysArgs {
|
|
|
138
138
|
*/
|
|
139
139
|
messageBatchSize: number;
|
|
140
140
|
/**
|
|
141
|
-
* The
|
|
141
|
+
* The VerifyingKeysRegistry contract address
|
|
142
142
|
*/
|
|
143
|
-
|
|
143
|
+
verifyingKeysRegistryAddress: string;
|
|
144
144
|
/**
|
|
145
145
|
* The signer
|
|
146
146
|
*/
|
|
@@ -191,18 +191,18 @@ export interface ICheckVerifyingKeysArgs {
|
|
|
191
191
|
*/
|
|
192
192
|
signer: Signer;
|
|
193
193
|
/**
|
|
194
|
-
* The address of the
|
|
194
|
+
* The address of the VerifyingKeysRegistry contract
|
|
195
195
|
*/
|
|
196
|
-
|
|
196
|
+
verifyingKeysRegistry: string;
|
|
197
197
|
/**
|
|
198
198
|
* Whether to use quadratic voting or not
|
|
199
199
|
*/
|
|
200
200
|
useQuadraticVoting?: boolean;
|
|
201
201
|
}
|
|
202
202
|
/**
|
|
203
|
-
* Interface for the arguments to the
|
|
203
|
+
* Interface for the arguments to the extractVerifyingKeyToFile command
|
|
204
204
|
*/
|
|
205
|
-
export interface
|
|
205
|
+
export interface IExtractVerifyingKeyToFileArgs {
|
|
206
206
|
/**
|
|
207
207
|
* File path for poll joining zkey
|
|
208
208
|
*/
|
|
@@ -228,7 +228,7 @@ export interface IExtractVkToFileArgs {
|
|
|
228
228
|
*/
|
|
229
229
|
tallyVotesZkeyPathNonQv: string;
|
|
230
230
|
/**
|
|
231
|
-
* Output file path of extracted
|
|
231
|
+
* Output file path of extracted verifying keys
|
|
232
232
|
*/
|
|
233
233
|
outputFilePath: string;
|
|
234
234
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CA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AM,CAAC;IAErC;;OAEG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
1
|
+
import { type IVerifyingKeyContractParams, VerifyingKey } from "@maci-protocol/domainobjs";
|
|
2
|
+
import type { IGetAllVerifyingKeysArgs, IExtractAllVerifyingKeysArgs, IMaciVerifyingKeys, IMaciVerifyingKeysOnchain, IExtractVerifyingKeyToFileArgs } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Get all the verifying keys from the contract
|
|
5
|
-
* @param args - The arguments for the
|
|
5
|
+
* @param args - The arguments for the getAllVerifyingKeys function
|
|
6
6
|
* @returns The verifying keys
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const getAllOnChainVerifyingKeys: ({ verifyingKeysRegistryAddress, signer, stateTreeDepth, voteOptionTreeDepth, messageBatchSize, intStateTreeDepth, mode, }: IGetAllVerifyingKeysArgs) => Promise<IMaciVerifyingKeysOnchain>;
|
|
9
9
|
/**
|
|
10
10
|
* Compare two verifying keys
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
11
|
+
* @param verifyingKeyOnChain - the verifying key on chain
|
|
12
|
+
* @param verifyingKey - the local verifying key
|
|
13
13
|
* @returns whether they are equal or not
|
|
14
14
|
*/
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const compareVerifyingKeys: (verifyingKeyOnChain: VerifyingKey | IVerifyingKeyContractParams, verifyingKey?: VerifyingKey | IVerifyingKeyContractParams) => boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Extract all the verifying keys
|
|
18
|
-
* @param args - The arguments for the
|
|
18
|
+
* @param args - The arguments for the extractAllVerifyingKeys function
|
|
19
19
|
* @returns The verifying keys
|
|
20
20
|
*/
|
|
21
|
-
export declare const
|
|
21
|
+
export declare const extractAllVerifyingKeys: ({ pollJoiningZkeyPath, pollJoinedZkeyPath, processMessagesZkeyPath, tallyVotesZkeyPath, }: IExtractAllVerifyingKeysArgs) => Promise<IMaciVerifyingKeys>;
|
|
22
22
|
/**
|
|
23
23
|
* Command to confirm that the verifying keys in the contract match the local ones
|
|
24
24
|
* @note see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing
|
|
25
25
|
* @param args The arguments for the checkVerifyingKeys command
|
|
26
26
|
* @returns Whether the verifying keys match or not
|
|
27
27
|
*/
|
|
28
|
-
export declare const
|
|
28
|
+
export declare const extractVerifyingKeyToFile: ({ processMessagesZkeyPathQv, tallyVotesZkeyPathQv, processMessagesZkeyPathNonQv, pollJoinedZkeyPath, pollJoiningZkeyPath, tallyVotesZkeyPathNonQv, outputFilePath, }: IExtractVerifyingKeyToFileArgs) => Promise<void>;
|
|
29
29
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,2BAA2B,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI3F,OAAO,KAAK,EACV,wBAAwB,EACxB,4BAA4B,EAC5B,kBAAkB,EAClB,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAU,2HAQ9C,wBAAwB,KAAG,OAAO,CAAC,yBAAyB,CAqB9D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,qBAAqB,YAAY,GAAG,2BAA2B,EAC/D,eAAe,YAAY,GAAG,2BAA2B,KACxD,OA2BF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAU,2FAK3C,4BAA4B,KAAG,OAAO,CAAC,kBAAkB,CAsB3D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GAAU,sKAQ7C,8BAA8B,KAAG,OAAO,CAAC,IAAI,CA4B/C,CAAC"}
|