@maci-protocol/cli 0.0.0-ci.f433bba → 0.0.0-ci.f446b8f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/ts/index.js CHANGED
@@ -45,6 +45,7 @@ const fs_1 = __importDefault(require("fs"));
45
45
  const path_1 = __importDefault(require("path"));
46
46
  require("./cliInit");
47
47
  const utils_1 = require("./utils");
48
+ const constants_1 = require("./utils/constants");
48
49
  const defaults_1 = require("./utils/defaults");
49
50
  // set the description version and name of the cli tool
50
51
  const { description, version, name } = JSON.parse(fs_1.default.readFileSync(path_1.default.resolve(__dirname, "..", "package.json"), "utf8"));
@@ -66,34 +67,31 @@ program
66
67
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
67
68
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
68
69
  .requiredOption("-s, --stateTreeDepth <stateTreeDepth>", "the state tree depth", parseInt)
69
- .action(async (cmdOptions) => {
70
+ .action(async (args) => {
70
71
  try {
71
72
  const signer = await getSigner();
72
- (0, utils_1.banner)(cmdOptions.quiet);
73
+ (0, utils_1.banner)(args.quiet);
73
74
  const network = await signer.provider?.getNetwork();
74
75
  const [poseidonT3, poseidonT4, poseidonT5, poseidonT6] = (0, utils_1.readContractAddresses)({
75
76
  contractNames: [sdk_1.EContracts.PoseidonT3, sdk_1.EContracts.PoseidonT4, sdk_1.EContracts.PoseidonT5, sdk_1.EContracts.PoseidonT6],
76
77
  network: network?.name,
77
78
  });
78
79
  let [signupPolicyContractAddress] = (0, utils_1.readContractAddresses)({
79
- contractNames: [cmdOptions.signupPolicyContractName.toString()],
80
+ contractNames: [args.signupPolicyContractName.toString()],
80
81
  network: network?.name,
81
82
  });
82
83
  if (!signupPolicyContractAddress) {
83
- const checkerFactory = cmdOptions.freeForAllCheckerFactoryAddress
84
- ? sdk_1.FreeForAllCheckerFactory__factory.connect(cmdOptions.freeForAllCheckerFactoryAddress, signer)
84
+ const checkerFactory = args.freeForAllCheckerFactoryAddress
85
+ ? sdk_1.FreeForAllCheckerFactory__factory.connect(args.freeForAllCheckerFactoryAddress, signer)
85
86
  : undefined;
86
- const policyFactory = cmdOptions.freeForAllPolicyFactoryAddress
87
- ? sdk_1.FreeForAllPolicyFactory__factory.connect(cmdOptions.freeForAllPolicyFactoryAddress, signer)
87
+ const policyFactory = args.freeForAllPolicyFactoryAddress
88
+ ? sdk_1.FreeForAllPolicyFactory__factory.connect(args.freeForAllPolicyFactoryAddress, signer)
88
89
  : undefined;
89
90
  const [contract] = await (0, sdk_1.deployFreeForAllSignUpPolicy)({ checker: checkerFactory, policy: policyFactory }, signer, true);
90
91
  signupPolicyContractAddress = await contract.getAddress();
91
92
  }
92
- // deploy a verifier contract
93
- const verifierContract = await (0, sdk_1.deployVerifier)(signer, true);
94
- const verifierContractAddress = await verifierContract.getAddress();
95
93
  // deploy MACI, PollFactory and poseidon
96
- const { maciContractAddress, pollFactoryContractAddress, tallyFactoryContractAddress, messageProcessorFactoryContractAddress, poseidonAddresses, } = await (0, sdk_1.deployMaci)({
94
+ const { maciContractAddress, pollFactoryContractAddress, tallyFactoryContractAddress, messageProcessorFactoryContractAddress, poseidonAddresses, verifierContractAddress, verifyingKeysRegistryContractAddress, } = await (0, sdk_1.deployMaci)({
97
95
  signupPolicyAddress: signupPolicyContractAddress,
98
96
  poseidonAddresses: {
99
97
  poseidonT3,
@@ -102,14 +100,15 @@ program
102
100
  poseidonT6,
103
101
  },
104
102
  signer,
105
- stateTreeDepth: cmdOptions.stateTreeDepth,
103
+ stateTreeDepth: args.stateTreeDepth,
106
104
  });
107
- const emptyBallotRoots = (0, sdk_1.genEmptyBallotRoots)(cmdOptions.stateTreeDepth);
105
+ const emptyBallotRoots = (0, sdk_1.generateEmptyBallotRoots)(args.stateTreeDepth);
108
106
  // save to the JSON File
109
107
  await (0, utils_1.storeContractAddresses)({
110
108
  data: {
111
- [cmdOptions.signupPolicyContractName]: { address: signupPolicyContractAddress, args: [] },
109
+ [args.signupPolicyContractName]: { address: signupPolicyContractAddress, args: [] },
112
110
  [sdk_1.EContracts.Verifier]: { address: verifierContractAddress, args: [] },
111
+ [sdk_1.EContracts.VerifyingKeysRegistry]: { address: verifyingKeysRegistryContractAddress, args: [] },
113
112
  [sdk_1.EContracts.MACI]: {
114
113
  address: maciContractAddress,
115
114
  args: [
@@ -117,7 +116,7 @@ program
117
116
  messageProcessorFactoryContractAddress,
118
117
  tallyFactoryContractAddress,
119
118
  signupPolicyContractAddress,
120
- cmdOptions.stateTreeDepth,
119
+ args.stateTreeDepth,
121
120
  emptyBallotRoots.map((root) => root.toString()),
122
121
  ],
123
122
  },
@@ -131,7 +130,7 @@ program
131
130
  },
132
131
  signer,
133
132
  });
134
- (0, sdk_1.logGreen)({ quiet: cmdOptions.quiet, text: (0, sdk_1.success)(`MACI deployed at: ${maciContractAddress}`) });
133
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`MACI deployed at: ${maciContractAddress}`) });
135
134
  }
136
135
  catch (error) {
137
136
  program.error(error.message, { exitCode: 1 });
@@ -140,75 +139,81 @@ program
140
139
  program
141
140
  .command("checkVerifyingKeys")
142
141
  .description("check that the verifying keys in the contract match the local ones")
143
- .option("-u, --use-quadratic-voting <useQuadraticVoting>", "whether to use quadratic voting", (value) => value === "true", true)
142
+ .option("-m, --mode <mode>", "Voting mode (qv, non-qv, full)", (value) => constants_1.MODE_NAME_TO_ENUM[value], sdk_1.EMode.QV)
144
143
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
145
144
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
146
- .option("-k, --vk-contract <vkContract>", "the VkRegistry contract address")
145
+ .option("-k, --vk-contract <vkContract>", "the VerifyingKeysRegistry contract address")
147
146
  .requiredOption("-s, --state-tree-depth <stateTreeDepth>", "the state tree depth", parseInt)
148
- .requiredOption("-i, --int-state-tree-depth <intStateTreeDepth>", "the intermediate state tree depth", parseInt)
147
+ .requiredOption("-i, --tally-processing-state-tree-depth <tallyProcessingStateTreeDepth>", "the intermediate state tree depth", parseInt)
149
148
  .requiredOption("-v, --vote-option-tree-depth <voteOptionTreeDepth>", "the vote option tree depth", parseInt)
150
- .requiredOption("-b, --msg-batch-size <messageBatchSize>", "the message batch size", parseInt)
151
- .requiredOption("-p, --process-messages-zkey <processMessagesZkeyPath>", "the process messages zkey path (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)")
152
- .requiredOption("-t, --tally-votes-zkey <tallyVotesZkeyPath>", "the tally votes zkey path (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)")
149
+ .requiredOption("-b, --message-batch-size <messageBatchSize>", "the message batch size", parseInt)
150
+ .requiredOption("-p, --message-processor-zkey <messageProcessorZkeyPath>", "the message processor zkey path (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)")
151
+ .requiredOption("-t, --vote-tally-zkey <voteTallyZkeyPath>", "the vote tally zkey path (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)")
153
152
  .requiredOption("--poll-joining-zkey <pollJoiningZkey>", "the poll joining zkey path (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)")
154
153
  .requiredOption("--poll-joined-zkey <pollJoinedZkey>", "the poll joined zkey path (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)")
155
- .action(async (cmdOptions) => {
154
+ .action(async (args) => {
156
155
  try {
157
156
  const signer = await getSigner();
158
157
  const network = await signer.provider?.getNetwork();
159
- const [vkContractAddress] = (0, utils_1.readContractAddresses)({
160
- contractNames: [sdk_1.EContracts.VkRegistry],
158
+ const [contractAddress] = (0, utils_1.readContractAddresses)({
159
+ contractNames: [sdk_1.EContracts.VerifyingKeysRegistry],
161
160
  network: network?.name,
162
- defaultAddresses: [cmdOptions.vkContract],
161
+ defaultAddresses: [args.vkContract],
163
162
  });
164
- (0, sdk_1.logYellow)({ quiet: cmdOptions.quiet, text: (0, sdk_1.info)("Retrieving verifying keys from the contract...") });
163
+ (0, sdk_1.logYellow)({ quiet: args.quiet, text: (0, sdk_1.info)("Retrieving verifying keys from the contract...") });
165
164
  await (0, sdk_1.checkVerifyingKeys)({
166
- stateTreeDepth: cmdOptions.stateTreeDepth,
167
- intStateTreeDepth: cmdOptions.intStateTreeDepth,
168
- voteOptionTreeDepth: cmdOptions.voteOptionTreeDepth,
169
- messageBatchSize: cmdOptions.msgBatchSize,
170
- processMessagesZkeyPath: cmdOptions.processMessagesZkey,
171
- tallyVotesZkeyPath: cmdOptions.tallyVotesZkey,
172
- pollJoiningZkeyPath: cmdOptions.pollJoiningZkey,
173
- pollJoinedZkeyPath: cmdOptions.pollJoinedZkey,
174
- vkRegistry: vkContractAddress,
175
- useQuadraticVoting: cmdOptions.useQuadraticVoting,
165
+ stateTreeDepth: args.stateTreeDepth,
166
+ tallyProcessingStateTreeDepth: args.tallyProcessingStateTreeDepth,
167
+ voteOptionTreeDepth: args.voteOptionTreeDepth,
168
+ messageBatchSize: args.messageBatchSize,
169
+ messageProcessorZkeyPath: args.messageProcessorZkey,
170
+ voteTallyZkeyPath: args.voteTallyZkey,
171
+ pollJoiningZkeyPath: args.pollJoiningZkey,
172
+ pollJoinedZkeyPath: args.pollJoinedZkey,
173
+ verifyingKeysRegistry: contractAddress,
174
+ mode: args.mode,
176
175
  signer,
177
176
  });
178
- (0, sdk_1.logGreen)({ quiet: cmdOptions.quiet, text: (0, sdk_1.success)("Verifying keys match") });
177
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)("Verifying keys match") });
179
178
  }
180
179
  catch (error) {
181
180
  program.error(error.message, { exitCode: 1 });
182
181
  }
183
182
  });
184
183
  program
185
- .command("genMaciPubKey")
184
+ .command("generateMaciPubKey")
186
185
  .description("generate a new MACI public key")
187
- .requiredOption("-k, --privkey <privkey>", "the private key")
186
+ .requiredOption("-k, --private-key <privateKey>", "the private key")
188
187
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
189
188
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
190
- .action((cmdObj) => {
191
- const publicKey = (0, sdk_1.generateMaciPublicKey)(cmdObj.privkey);
192
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`Public key: ${publicKey}`) });
189
+ .action((args) => {
190
+ const publicKey = (0, sdk_1.generateMaciPublicKey)(args.privateKey);
191
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`Public key: ${publicKey}`) });
193
192
  });
194
193
  program
195
- .command("genMaciKeyPair")
194
+ .command("generateMaciKeyPair")
196
195
  .description("generate a new MACI key pair")
197
196
  .option("-s, --seed <seed>", "seed value for keypair", (value) => (value ? BigInt(value) : undefined), undefined)
198
197
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
199
- .action((cmdObj) => {
200
- const { publicKey, privateKey } = (0, sdk_1.generateKeypair)({ seed: cmdObj.seed });
201
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`Public key: ${publicKey}`) });
202
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`Private key: ${privateKey}`) });
198
+ .action((args) => {
199
+ const { publicKey, privateKey, publicKeyAsContractParam } = (0, sdk_1.generateKeypair)({ seed: args.seed });
200
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`Public key: ${publicKey}`) });
201
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`Private key: ${privateKey}`) });
202
+ (0, sdk_1.logGreen)({
203
+ quiet: args.quiet,
204
+ text: (0, sdk_1.success)(`Public key as contract param:
205
+ X: ${publicKeyAsContractParam.x}
206
+ Y: ${publicKeyAsContractParam.y}`),
207
+ });
203
208
  });
204
209
  program
205
- .command("deployVkRegistry")
210
+ .command("deployVerifyingKeysRegistry")
206
211
  .description("deploy a new verification key registry contract")
207
212
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
208
213
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
209
- .action(async (cmdObj) => {
214
+ .action(async (args) => {
210
215
  try {
211
- (0, utils_1.banner)(cmdObj.quiet);
216
+ (0, utils_1.banner)(args.quiet);
212
217
  const signer = await getSigner();
213
218
  // assume that the vkRegistry contract is the first one to be deployed
214
219
  const isContractAddressesStoreExists = fs_1.default.existsSync(utils_1.contractAddressesStorePath);
@@ -217,12 +222,15 @@ program
217
222
  (0, utils_1.resetContractAddresses)(network?.name);
218
223
  }
219
224
  // deploy and store the address
220
- const vkRegistryAddress = await (0, sdk_1.deployVkRegistryContract)({ signer });
225
+ const verifyingKeysRegistryAddress = await (0, sdk_1.deployVerifyingKeysRegistryContract)({ signer });
221
226
  await (0, utils_1.storeContractAddresses)({
222
- data: { [sdk_1.EContracts.VkRegistry]: { address: vkRegistryAddress, args: [] } },
227
+ data: { [sdk_1.EContracts.VerifyingKeysRegistry]: { address: verifyingKeysRegistryAddress, args: [] } },
223
228
  signer,
224
229
  });
225
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`VkRegistry deployed at: ${vkRegistryAddress}`) });
230
+ (0, sdk_1.logGreen)({
231
+ quiet: args.quiet,
232
+ text: (0, sdk_1.success)(`VerifyingKeysRegistry deployed at: ${verifyingKeysRegistryAddress}`),
233
+ });
226
234
  }
227
235
  catch (error) {
228
236
  program.error(error.message, { exitCode: 1 });
@@ -249,36 +257,38 @@ program
249
257
  program
250
258
  .command("deployPoll")
251
259
  .description("deploy a new poll")
252
- .option("-k, --vkRegistryAddress <vkRegistryAddress>", "the vk registry contract address")
253
- .requiredOption("-s, --start <pollStartDate>", "the poll start date", parseInt)
254
- .requiredOption("-e, --end <pollEndDate>", "the poll end date", parseInt)
255
- .requiredOption("-i, --int-state-tree-depth <intStateTreeDepth>", "the int state tree depth", parseInt)
256
- .requiredOption("-b, --msg-batch-size <messageBatchSize>", "the message batch size", parseInt)
260
+ .option("-k, --verifyingKeysRegistryAddress <verifyingKeysRegistryAddress>", "the vk registry contract address")
261
+ .requiredOption("--start <pollStartDate>", "the poll start date", parseInt)
262
+ .requiredOption("--end <pollEndDate>", "the poll end date", parseInt)
263
+ .requiredOption("-i, --tally-processing-state-tree-depth <tallyProcessingStateTreeDepth>", "the int state tree depth", parseInt)
264
+ .requiredOption("-b, --message-batch-size <messageBatchSize>", "the message batch size", parseInt)
265
+ .requiredOption("-s, --state-tree-depth <stateTreeDepth>", "the state tree depth", parseInt)
257
266
  .requiredOption("-v, --vote-option-tree-depth <voteOptionTreeDepth>", "the vote option tree depth", parseInt)
258
- .requiredOption("-p, --pubkey <coordinatorPubkey>", "the coordinator public key")
259
- .option("-u, --use-quadratic-voting <useQuadraticVoting>", "whether to use quadratic voting", (value) => value === "true", true)
267
+ .requiredOption("-p, --public-key <publicKey>", "the coordinator public key")
268
+ .option("-m, --mode <mode>", "Voting mode (qv, non-qv, full)", (value) => constants_1.MODE_NAME_TO_ENUM[value], sdk_1.EMode.QV)
260
269
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
261
- .option("-m, --relayers <relayers>", "the relayer addresses", (value) => value.split(",").map((item) => item.trim()))
270
+ .option("--relayers <relayers>", "the relayer addresses", (value) => value.split(",").map((item) => item.trim()))
262
271
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
263
272
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
264
273
  .option("-o, --vote-options <voteOptions>", "the number of vote options", parseInt)
265
274
  .option("--initial-voice-credits <initialVoiceCredits>", "the initial voice credits", parseInt)
266
275
  .option("--initial-voice-credits-proxy <initialVoiceCreditsProxy>", "the initial voice credits proxy address")
267
276
  .option("--signup-policy <signupPolicy>", "the signup policy contract address")
268
- .action(async (cmdObj) => {
277
+ .action(async (args) => {
269
278
  try {
270
- (0, utils_1.banner)(cmdObj.quiet);
279
+ (0, utils_1.banner)(args.quiet);
271
280
  const signer = await getSigner();
272
281
  const network = await signer.provider?.getNetwork();
273
- const [vkRegistryAddress, maciAddress, initialVoiceCreditProxyAddress, verifierContractAddress] = (0, utils_1.readContractAddresses)({
282
+ const [maciAddress, initialVoiceCreditProxyAddress, initialVoiceCreditProxyFactoryAddress] = (0, utils_1.readContractAddresses)({
274
283
  contractNames: [
275
- sdk_1.EContracts.VkRegistry,
284
+ sdk_1.EContracts.VerifyingKeysRegistry,
276
285
  sdk_1.EContracts.MACI,
277
286
  sdk_1.EContracts.ConstantInitialVoiceCreditProxy,
287
+ sdk_1.EContracts.ConstantInitialVoiceCreditProxyFactory,
278
288
  sdk_1.EContracts.Verifier,
279
289
  ],
280
290
  network: network?.name,
281
- defaultAddresses: [cmdObj.vkRegistryAddress, cmdObj.maciAddress, cmdObj.initialVoiceCreditsProxy],
291
+ defaultAddresses: [args.verifyingKeysRegistryAddress, args.maciAddress, args.initialVoiceCreditsProxy],
282
292
  });
283
293
  const maciContract = sdk_1.MACI__factory.connect(maciAddress, signer);
284
294
  const nextPollId = await maciContract.nextPollId();
@@ -288,39 +298,39 @@ program
288
298
  contractNames: [policyContractName.toString()],
289
299
  keys: [nextPollId.toString()],
290
300
  network: network?.name,
291
- defaultAddresses: [cmdObj.signupPolicy],
301
+ defaultAddresses: [args.signupPolicy],
292
302
  });
293
303
  const { pollId, pollContractAddress, tallyContractAddress, messageProcessorContractAddress, initialVoiceCreditProxyContractAddress, policyContractAddress, } = await (0, sdk_1.deployPoll)({
294
- initialVoiceCredits: cmdObj.initialVoiceCredits || defaults_1.DEFAULT_INITIAL_VOICE_CREDITS,
295
- pollStartTimestamp: cmdObj.start,
296
- pollEndTimestamp: cmdObj.end,
297
- intStateTreeDepth: cmdObj.intStateTreeDepth,
298
- messageBatchSize: cmdObj.msgBatchSize,
299
- voteOptionTreeDepth: cmdObj.voteOptionTreeDepth,
300
- coordinatorPubKey: domainobjs_1.PubKey.deserialize(cmdObj.pubkey),
304
+ initialVoiceCredits: args.initialVoiceCredits || defaults_1.DEFAULT_INITIAL_VOICE_CREDITS,
305
+ pollStartTimestamp: args.start,
306
+ pollEndTimestamp: args.end,
307
+ tallyProcessingStateTreeDepth: args.tallyProcessingStateTreeDepth,
308
+ messageBatchSize: args.messageBatchSize,
309
+ stateTreeDepth: args.stateTreeDepth,
310
+ voteOptionTreeDepth: args.voteOptionTreeDepth,
311
+ coordinatorPublicKey: domainobjs_1.PublicKey.deserialize(args.publicKey),
301
312
  maciAddress,
302
- vkRegistryContractAddress: vkRegistryAddress,
303
- relayers: cmdObj.relayers ?? [ethers_1.ZeroAddress],
304
- mode: cmdObj.useQuadraticVoting ? sdk_1.EMode.QV : sdk_1.EMode.NON_QV,
313
+ relayers: args.relayers ?? [ethers_1.ZeroAddress],
314
+ mode: args.mode,
305
315
  signer,
306
- voteOptions: cmdObj.voteOptions ?? defaults_1.DEFAULT_VOTE_OPTIONS,
307
- verifierContractAddress,
316
+ voteOptions: args.voteOptions ?? defaults_1.DEFAULT_VOTE_OPTIONS,
308
317
  policyContractAddress: signupPolicyContractAddress,
318
+ initialVoiceCreditProxyFactoryAddress,
309
319
  initialVoiceCreditProxyContractAddress: initialVoiceCreditProxyAddress,
310
320
  });
311
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`Poll ID: ${pollId}`) });
312
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`Poll contract address: ${pollContractAddress}`) });
313
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`Tally contract address: ${tallyContractAddress}`) });
321
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`Poll ID: ${pollId}`) });
322
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`Poll contract address: ${pollContractAddress}`) });
323
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`Tally contract address: ${tallyContractAddress}`) });
314
324
  (0, sdk_1.logGreen)({
315
- quiet: cmdObj.quiet,
325
+ quiet: args.quiet,
316
326
  text: (0, sdk_1.success)(`Message processor contract address: ${messageProcessorContractAddress}`),
317
327
  });
318
328
  (0, sdk_1.logGreen)({
319
- quiet: cmdObj.quiet,
329
+ quiet: args.quiet,
320
330
  text: (0, sdk_1.success)(`Initial voice credit proxy contract address: ${initialVoiceCreditProxyContractAddress}`),
321
331
  });
322
332
  (0, sdk_1.logGreen)({
323
- quiet: cmdObj.quiet,
333
+ quiet: args.quiet,
324
334
  text: (0, sdk_1.success)(`Signup policy contract address: ${policyContractAddress}`),
325
335
  });
326
336
  }
@@ -331,8 +341,7 @@ program
331
341
  program
332
342
  .command("joinPoll")
333
343
  .description("join the poll")
334
- .requiredOption("-k, --priv-key <privKey>", "the private key")
335
- .option("-i, --state-index <stateIndex>", "the user's state index", BigInt)
344
+ .requiredOption("-k, --private-key <privateKey>", "the private key")
336
345
  .option("-s, --sg-data <sgData>", "the signup policy data")
337
346
  .option("-v, --ivcp-data <ivcpData>", "the initial voice credit proxy data")
338
347
  .option("-n, --new-voice-credit-balance <newVoiceCreditBalance>", "the voice credit balance of the user for the poll", BigInt)
@@ -348,38 +357,37 @@ program
348
357
  .requiredOption("--poll-joining-zkey <pollZkeyPath>", "the poll join zkey path (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)")
349
358
  .option("-w, --wasm", "whether to use the wasm binaries")
350
359
  .option("-r, --rapidsnark <rapidsnark>", "the path to the rapidsnark binary")
351
- .option("-g, --poll-witnessgen <pollWitnessgen>", "the path to the poll witness generation binary")
352
- .action(async (cmdObj) => {
360
+ .option("-g, --poll-witness-generator <pollWitnessGenerator>", "the path to the poll witness generation binary")
361
+ .action(async (args) => {
353
362
  try {
354
363
  const signer = await getSigner();
355
364
  const network = await signer.provider?.getNetwork();
356
365
  const [maciAddress] = (0, utils_1.readContractAddresses)({
357
366
  contractNames: [sdk_1.EContracts.MACI],
358
367
  network: network?.name,
359
- defaultAddresses: [cmdObj.maciAddress],
368
+ defaultAddresses: [args.maciAddress],
360
369
  });
361
- const privateKey = cmdObj.privKey || (await (0, utils_1.promptSensitiveValue)("Insert your MACI private key"));
370
+ const privateKey = args.privateKey || (await (0, utils_1.promptSensitiveValue)("Insert your MACI private key"));
362
371
  const data = await (0, sdk_1.joinPoll)({
363
372
  maciAddress,
364
373
  privateKey,
365
- stateIndex: cmdObj.stateIndex,
366
- stateFile: cmdObj.stateFile,
367
- pollId: cmdObj.pollId,
374
+ stateFile: args.stateFile,
375
+ pollId: args.pollId,
368
376
  signer,
369
- startBlock: cmdObj.startBlock,
370
- endBlock: cmdObj.endBlock,
371
- blocksPerBatch: cmdObj.blocksPerBatch,
372
- pollJoiningZkey: cmdObj.pollJoiningZkey,
373
- pollWasm: cmdObj.pollWasm,
374
- useWasm: cmdObj.wasm,
375
- rapidsnark: cmdObj.rapidsnark,
376
- pollWitgen: cmdObj.pollWitnessgen,
377
- sgDataArg: cmdObj.sgData ?? utils_1.DEFAULT_SG_DATA,
378
- ivcpDataArg: cmdObj.ivcpData ?? utils_1.DEFAULT_IVCP_DATA,
379
- });
380
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.info)(`User joined poll with nullifier: ${data.nullifier}`) });
381
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.info)(`User joined poll with state index: ${data.pollStateIndex}`) });
382
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.info)(`User joined poll with ${data.voiceCredits} voice credits`) });
377
+ startBlock: args.startBlock,
378
+ endBlock: args.endBlock,
379
+ blocksPerBatch: args.blocksPerBatch,
380
+ pollJoiningZkey: args.pollJoiningZkey,
381
+ pollWasm: args.pollWasm,
382
+ useWasm: args.wasm,
383
+ rapidsnark: args.rapidsnark,
384
+ pollWitnessGenerator: args.pollWitnessGenerator,
385
+ sgDataArg: args.sgData ?? utils_1.DEFAULT_SG_DATA,
386
+ ivcpDataArg: args.ivcpData ?? utils_1.DEFAULT_IVCP_DATA,
387
+ });
388
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.info)(`User joined poll with nullifier: ${data.nullifier}`) });
389
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.info)(`User joined poll with state index: ${data.pollStateIndex}`) });
390
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.info)(`User joined poll with ${data.voiceCredits} voice credits`) });
383
391
  }
384
392
  catch (error) {
385
393
  program.error(error.message, { exitCode: 1 });
@@ -389,47 +397,70 @@ program
389
397
  .command("setVerifyingKeys")
390
398
  .description("set the verifying keys")
391
399
  .requiredOption("-s, --state-tree-depth <stateTreeDepth>", "the state tree depth", parseInt)
392
- .requiredOption("-i, --int-state-tree-depth <intStateTreeDepth>", "the intermediate state tree depth", parseInt)
400
+ .requiredOption("-i, --tally-processing-state-tree-depth <tallyProcessingStateTreeDepth>", "the intermediate state tree depth", parseInt)
393
401
  .requiredOption("-v, --vote-option-tree-depth <voteOptionTreeDepth>", "the vote option tree depth", parseInt)
394
- .requiredOption("-b, --msg-batch-size <messageBatchSize>", "the message batch size", parseInt)
402
+ .requiredOption("-b, --message-batch-size <messageBatchSize>", "the message batch size", parseInt)
403
+ .option("--poll-state-tree-depth <pollStateTreeDepth>", "the poll state tree depth", parseInt)
395
404
  .option("--poll-joining-zkey <pollJoiningZkeyPath>", "the poll joining zkey path (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)")
396
405
  .option("--poll-joined-zkey <pollJoinedZkeyPath>", "the poll joined zkey path (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)")
397
- .option("--process-messages-zkey-qv <processMessagesZkeyPathQv>", "the process messages qv zkey path (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)")
398
- .option("--tally-votes-zkey-qv <tallyVotesZkeyPathQv>", "the tally votes qv zkey path (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)")
399
- .option("--process-messages-zkey-non-qv <processMessagesZkeyPathNonQv>", "the process messages non-qv zkey path (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)")
400
- .option("--tally-votes-zkey-non-qv <tallyVotesZkeyPathNonQv>", "the tally votes non-qv zkey path (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)")
401
- .option("-u, --use-quadratic-voting <useQuadraticVoting>", "whether to use quadratic voting", (value) => value === "true", true)
406
+ .option("--message-processor-zkey-qv <messageProcessorZkeyPathQv>", "the message processor qv zkey path (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)")
407
+ .option("--vote-tally-zkey-qv <voteTallyZkeyPathQv>", "the vote tally qv zkey path (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)")
408
+ .option("--message-processor-zkey-non-qv <messageProcessorZkeyPathNonQv>", "the message processor non-qv zkey path (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)")
409
+ .option("--vote-tally-zkey-non-qv <voteTallyZkeyPathNonQv>", "the vote tally non-qv zkey path (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)")
410
+ .option("--message-processor-zkey-full <messageProcessorZkeyPathFull>", "the message processor full zkey path (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)")
411
+ .option("--vote-tally-zkey-full <tallyVotesZkeyPathFull>", "the vote tally full zkey path (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)")
412
+ .option("-m, --modes <modes>", "Comma-separated list of voting modes (qv, non-qv, full)", (value) => value.split(",").map((v) => constants_1.MODE_NAME_TO_ENUM[v.trim()]), [sdk_1.EMode.QV])
402
413
  .option("-k, --vk-registry <vkRegistry>", "the vk registry contract address")
403
414
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
404
415
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
405
- .action(async (cmdObj) => {
416
+ .action(async (args) => {
406
417
  try {
407
418
  const signer = await getSigner();
408
419
  const network = await signer.provider?.getNetwork();
409
- const [vkRegistryAddress] = (0, utils_1.readContractAddresses)({
410
- contractNames: [sdk_1.EContracts.VkRegistry],
420
+ const [verifyingKeysRegistryAddress] = (0, utils_1.readContractAddresses)({
421
+ contractNames: [sdk_1.EContracts.VerifyingKeysRegistry],
411
422
  network: network?.name,
412
- defaultAddresses: [cmdObj.vkRegistry],
423
+ defaultAddresses: [args.vkRegistry],
413
424
  });
414
- const { pollJoiningVk, pollJoinedVk, processVk, tallyVk } = await (0, sdk_1.extractAllVks)({
415
- pollJoiningZkeyPath: cmdObj.pollJoiningZkey,
416
- pollJoinedZkeyPath: cmdObj.pollJoinedZkey,
417
- processMessagesZkeyPath: cmdObj.useQuadraticVoting
418
- ? cmdObj.processMessagesZkeyQv
419
- : cmdObj.processMessagesZkeyNonQv,
420
- tallyVotesZkeyPath: cmdObj.useQuadraticVoting ? cmdObj.tallyVotesZkeyQv : cmdObj.tallyVotesZkeyQv,
425
+ const processKeys = {
426
+ [sdk_1.EMode.QV]: args.messageProcessorZkeyQv,
427
+ [sdk_1.EMode.NON_QV]: args.messageProcessorZkeyNonQv,
428
+ [sdk_1.EMode.FULL]: args.messageProcessorZkeyFull,
429
+ };
430
+ const tallyKeys = {
431
+ [sdk_1.EMode.QV]: args.voteTallyZkeyQv,
432
+ [sdk_1.EMode.NON_QV]: args.voteTallyZkeyNonQv,
433
+ [sdk_1.EMode.FULL]: args.voteTallyZkeyFull,
434
+ };
435
+ const { pollJoiningVerifyingKey, pollJoinedVerifyingKey } = await (0, sdk_1.extractAllVerifyingKeys)({
436
+ pollJoiningZkeyPath: args.pollJoiningZkey,
437
+ pollJoinedZkeyPath: args.pollJoinedZkey,
438
+ });
439
+ const keysResults = await Promise.all(args.modes.map((mode) => (0, sdk_1.extractAllVerifyingKeys)({
440
+ messageProcessorZkeyPath: processKeys[mode],
441
+ voteTallyZkeyPath: tallyKeys[mode],
442
+ })));
443
+ const processVerifyingKeys = [];
444
+ const tallyVerifyingKeys = [];
445
+ keysResults.forEach(({ processVerifyingKey, tallyVerifyingKey }, idx) => {
446
+ if (!processVerifyingKey || !tallyVerifyingKey) {
447
+ throw new Error(`Verifying keys for mode ${args.modes[idx]} are not valid`);
448
+ }
449
+ processVerifyingKeys.push(processVerifyingKey);
450
+ tallyVerifyingKeys.push(tallyVerifyingKey);
421
451
  });
422
452
  await (0, sdk_1.setVerifyingKeys)({
423
- stateTreeDepth: cmdObj.stateTreeDepth,
424
- intStateTreeDepth: cmdObj.intStateTreeDepth,
425
- voteOptionTreeDepth: cmdObj.voteOptionTreeDepth,
426
- messageBatchSize: cmdObj.msgBatchSize,
427
- pollJoiningVk: pollJoiningVk,
428
- pollJoinedVk: pollJoinedVk,
429
- processMessagesVk: processVk,
430
- tallyVotesVk: tallyVk,
431
- vkRegistryAddress,
432
- mode: cmdObj.useQuadraticVoting ? sdk_1.EMode.QV : sdk_1.EMode.NON_QV,
453
+ stateTreeDepth: args.stateTreeDepth,
454
+ tallyProcessingStateTreeDepth: args.tallyProcessingStateTreeDepth,
455
+ voteOptionTreeDepth: args.voteOptionTreeDepth,
456
+ messageBatchSize: args.messageBatchSize,
457
+ pollStateTreeDepth: args.pollStateTreeDepth || args.stateTreeDepth,
458
+ pollJoiningVerifyingKey: pollJoiningVerifyingKey,
459
+ pollJoinedVerifyingKey: pollJoinedVerifyingKey,
460
+ processMessagesVerifyingKeys: processVerifyingKeys,
461
+ tallyVotesVerifyingKeys: tallyVerifyingKeys,
462
+ verifyingKeysRegistryAddress,
463
+ modes: args.modes,
433
464
  signer,
434
465
  });
435
466
  }
@@ -440,9 +471,9 @@ program
440
471
  program
441
472
  .command("publish")
442
473
  .description("publish a new message to a MACI Poll contract")
443
- .requiredOption("-p, --pubkey <pubkey>", "the MACI public key which should replace the user's public key in the state tree")
474
+ .requiredOption("-p, --public-key <publicKey>", "the MACI public key which should replace the user's public key in the state tree")
444
475
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
445
- .option("-k, --privkey <privkey>", "your serialized MACI private key")
476
+ .option("-k, --private-key <privateKey>", "your serialized MACI private key")
446
477
  .requiredOption("-i, --state-index <stateIndex>", "the user's state index", BigInt)
447
478
  .requiredOption("-v, --vote-option-index <voteOptionIndex>", "the vote option index", BigInt)
448
479
  .requiredOption("-n, --nonce <nonce>", "the message nonce", BigInt)
@@ -451,25 +482,25 @@ program
451
482
  .requiredOption("-w, --new-vote-weight <newVoteWeight>", "the new vote weight", BigInt)
452
483
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
453
484
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
454
- .action(async (cmdObj) => {
485
+ .action(async (args) => {
455
486
  try {
456
487
  const signer = await getSigner();
457
488
  const network = await signer.provider?.getNetwork();
458
489
  const [maciAddress] = (0, utils_1.readContractAddresses)({
459
490
  contractNames: [sdk_1.EContracts.MACI],
460
491
  network: network?.name,
461
- defaultAddresses: [cmdObj.maciAddress],
492
+ defaultAddresses: [args.maciAddress],
462
493
  });
463
- const privateKey = cmdObj.privkey || (await (0, utils_1.promptSensitiveValue)("Insert your MACI private key"));
494
+ const privateKey = args.privateKey || (await (0, utils_1.promptSensitiveValue)("Insert your MACI private key"));
464
495
  await (0, sdk_1.publish)({
465
- pubkey: cmdObj.pubkey,
466
- stateIndex: cmdObj.stateIndex,
467
- voteOptionIndex: cmdObj.voteOptionIndex,
468
- nonce: cmdObj.nonce,
469
- pollId: cmdObj.pollId,
470
- newVoteWeight: cmdObj.newVoteWeight,
496
+ publicKey: args.publicKey,
497
+ stateIndex: args.stateIndex,
498
+ voteOptionIndex: args.voteOptionIndex,
499
+ nonce: args.nonce,
500
+ pollId: args.pollId,
501
+ newVoteWeight: args.newVoteWeight,
471
502
  maciAddress,
472
- salt: cmdObj.salt,
503
+ salt: args.salt,
473
504
  privateKey,
474
505
  signer,
475
506
  });
@@ -484,23 +515,23 @@ program
484
515
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
485
516
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
486
517
  .requiredOption("-p, --poll-id <pollId>", "the poll id", BigInt)
487
- .action(async (cmdObj) => {
518
+ .action(async (args) => {
488
519
  try {
489
520
  const signer = await getSigner();
490
521
  const network = await signer.provider?.getNetwork();
491
522
  const [maciAddress] = (0, utils_1.readContractAddresses)({
492
523
  contractNames: [sdk_1.EContracts.MACI],
493
524
  network: network?.name,
494
- defaultAddresses: [cmdObj.maciAddress],
525
+ defaultAddresses: [args.maciAddress],
495
526
  });
496
527
  const receipt = await (0, sdk_1.mergeSignups)({
497
- pollId: cmdObj.pollId,
528
+ pollId: args.pollId,
498
529
  maciAddress,
499
530
  signer,
500
531
  });
501
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.info)(`Transaction hash: ${receipt.hash}`) });
532
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.info)(`Transaction hash: ${receipt.hash}`) });
502
533
  (0, sdk_1.logGreen)({
503
- quiet: cmdObj.quiet,
534
+ quiet: args.quiet,
504
535
  text: (0, sdk_1.success)(`Executed mergeSignups(); gas used: ${receipt.gasUsed.toString()}`),
505
536
  });
506
537
  }
@@ -514,37 +545,39 @@ program
514
545
  .requiredOption("-s, --seconds <seconds>", "the number of seconds to fast-forward", parseInt)
515
546
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
516
547
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
517
- .action(async (cmdObj) => {
548
+ .action(async (args) => {
518
549
  try {
519
- (0, utils_1.banner)(cmdObj.quiet);
550
+ (0, utils_1.banner)(args.quiet);
520
551
  const signer = await getSigner();
521
- await (0, sdk_1.timeTravel)({ seconds: cmdObj.seconds, signer });
522
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`Fast-forwarded ${cmdObj.seconds} seconds`) });
552
+ await (0, sdk_1.timeTravel)({ seconds: args.seconds, signer });
553
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`Fast-forwarded ${args.seconds} seconds`) });
523
554
  }
524
555
  catch (error) {
525
556
  program.error(error.message, { exitCode: 1 });
526
557
  }
527
558
  });
528
559
  program
529
- .command("extractVkToFile")
560
+ .command("extractVerifyingKeyToFile")
530
561
  .description("extract vkey to json file")
531
562
  .requiredOption("--poll-joining-zkey <pollJoiningZkey>", "the poll joining zkey path (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)")
532
563
  .requiredOption("--poll-joined-zkey <pollJoinedZkey>", "the poll joined zkey path (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)")
533
- .requiredOption("--process-messages-zkey-qv <processMessagesZkeyPathQv>", "the process messages qv zkey path (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)")
534
- .requiredOption("--tally-votes-zkey-qv <tallyVotesZkeyPathQv>", "the tally votes qv zkey path (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)")
535
- .requiredOption("--process-messages-zkey-non-qv <processMessagesZkeyPathNonQv>", "the process messages non-qv zkey path (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)")
536
- .requiredOption("--tally-votes-zkey-non-qv <tallyVotesZkeyPathNonQv>", "the tally votes non-qv zkey path (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)")
564
+ .requiredOption("--message-processor-zkey-qv <messageProcessorZkeyPathQv>", "the message processor qv zkey path (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)")
565
+ .requiredOption("--vote-tally-zkey-qv <voteTallyZkeyPathQv>", "the vote tally qv zkey path (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)")
566
+ .requiredOption("--message-processor-zkey-non-qv <messageProcessorZkeyPathNonQv>", "the message processor non-qv zkey path (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)")
567
+ .requiredOption("--message-processor-zkey-full <messageProcessorZkeyPathFull>", "the message processor full zkey path (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)")
568
+ .requiredOption("--vote-tally-zkey-non-qv <voteTallyZkeyPathNonQv>", "the vote tally non-qv zkey path (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)")
537
569
  .requiredOption("-o, --output-file <outputFile>", "the output file path of extracted vkeys")
538
- .action(async (cmdObj) => {
570
+ .action(async (args) => {
539
571
  try {
540
- await (0, sdk_1.extractVkToFile)({
541
- processMessagesZkeyPathQv: cmdObj.processMessagesZkeyQv,
542
- tallyVotesZkeyPathQv: cmdObj.tallyVotesZkeyQv,
543
- processMessagesZkeyPathNonQv: cmdObj.processMessagesZkeyNonQv,
544
- tallyVotesZkeyPathNonQv: cmdObj.tallyVotesZkeyNonQv,
545
- pollJoiningZkeyPath: cmdObj.pollJoiningZkey,
546
- pollJoinedZkeyPath: cmdObj.pollJoinedZkey,
547
- outputFilePath: cmdObj.outputFile,
572
+ await (0, sdk_1.extractVerifyingKeyToFile)({
573
+ messageProcessorZkeyPathQv: args.messageProcessorZkeyQv,
574
+ messageProcessorZkeyPathFull: args.messageProcessorZkeyFull,
575
+ voteTallyZkeyPathQv: args.voteTallyZkeyQv,
576
+ messageProcessorZkeyPathNonQv: args.messageProcessorZkeyNonQv,
577
+ voteTallyZkeyPathNonQv: args.voteTallyZkeyNonQv,
578
+ pollJoiningZkeyPath: args.pollJoiningZkey,
579
+ pollJoinedZkeyPath: args.pollJoinedZkey,
580
+ outputFilePath: args.outputFile,
548
581
  });
549
582
  }
550
583
  catch (error) {
@@ -554,28 +587,28 @@ program
554
587
  program
555
588
  .command("signup")
556
589
  .description("Sign up to a MACI contract")
557
- .requiredOption("-p, --pubkey <maciPubKey>", "the MACI public key")
590
+ .requiredOption("-p, --public-key <publicKey>", "the MACI public key")
558
591
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
559
592
  .option("-s, --sg-data <sgData>", "the signup gateway data")
560
593
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
561
594
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
562
- .action(async (cmdObj) => {
595
+ .action(async (args) => {
563
596
  try {
564
597
  const signer = await getSigner();
565
598
  const network = await signer.provider?.getNetwork();
566
599
  const [maciAddress] = (0, utils_1.readContractAddresses)({
567
600
  contractNames: [sdk_1.EContracts.MACI],
568
601
  network: network?.name,
569
- defaultAddresses: [cmdObj.maciAddress],
602
+ defaultAddresses: [args.maciAddress],
570
603
  });
571
604
  const data = await (0, sdk_1.signup)({
572
- maciPubKey: cmdObj.pubkey,
605
+ maciPublicKey: args.publicKey,
573
606
  maciAddress,
574
- sgData: cmdObj.sgData ?? utils_1.DEFAULT_SG_DATA,
607
+ sgData: args.sgData ?? utils_1.DEFAULT_SG_DATA,
575
608
  signer,
576
609
  });
577
610
  (0, sdk_1.logGreen)({
578
- quiet: cmdObj.quiet,
611
+ quiet: args.quiet,
579
612
  text: (0, sdk_1.success)(`State index: ${data.stateIndex.toString()}\n Transaction hash: ${data.transactionHash}`),
580
613
  });
581
614
  }
@@ -586,28 +619,28 @@ program
586
619
  program
587
620
  .command("isRegisteredUser")
588
621
  .description("Checks if user is registered with their public key and get their data")
589
- .requiredOption("-p, --pubkey <maciPubKey>", "the MACI public key")
622
+ .requiredOption("-p, --public-key <publicKey>", "the MACI public key")
590
623
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
591
624
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
592
- .action(async (cmdObj) => {
625
+ .action(async (args) => {
593
626
  try {
594
627
  const signer = await getSigner();
595
628
  const network = await signer.provider?.getNetwork();
596
629
  const [maciAddress] = (0, utils_1.readContractAddresses)({
597
630
  contractNames: [sdk_1.EContracts.MACI],
598
631
  network: network?.name,
599
- defaultAddresses: [cmdObj.maciAddress],
632
+ defaultAddresses: [args.maciAddress],
600
633
  });
601
634
  const data = await (0, sdk_1.getSignedupUserData)({
602
- maciPubKey: cmdObj.pubkey,
635
+ maciPublicKey: args.publicKey,
603
636
  maciAddress,
604
637
  signer,
605
638
  });
606
639
  if (data.isRegistered) {
607
- (0, sdk_1.logGreen)({ quiet: cmdObj.quiet, text: (0, sdk_1.success)(`State index: ${data.stateIndex?.toString()}`) });
640
+ (0, sdk_1.logGreen)({ quiet: args.quiet, text: (0, sdk_1.success)(`State index: ${data.stateIndex?.toString()}`) });
608
641
  }
609
642
  else {
610
- (0, sdk_1.logRed)({ quiet: cmdObj.quiet, text: "User is not registered" });
643
+ (0, sdk_1.logRed)({ quiet: args.quiet, text: "User is not registered" });
611
644
  }
612
645
  }
613
646
  catch (error) {
@@ -617,32 +650,32 @@ program
617
650
  program
618
651
  .command("isJoinedUser")
619
652
  .description("Checks if user is joined to the poll with public key")
620
- .requiredOption("-p, --pubkey <pubkey>", "the MACI public key")
653
+ .requiredOption("-p, --public-key <publicKey>", "the MACI public key")
621
654
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
622
655
  .requiredOption("-o, --poll-id <pollId>", "the poll id", BigInt)
623
656
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
624
657
  .option("--start-block <startBlock>", "the block number to start looking for events from", parseInt)
625
658
  .option("--end-block <endBlock>", "the block number to end looking for events from", parseInt)
626
659
  .option("--blocks-per-batch <blockPerBatch>", "the number of blocks to process per batch", parseInt)
627
- .action(async (cmdObj) => {
660
+ .action(async (args) => {
628
661
  try {
629
662
  const signer = await getSigner();
630
663
  const network = await signer.provider?.getNetwork();
631
664
  const [maciAddress] = (0, utils_1.readContractAddresses)({
632
665
  contractNames: [sdk_1.EContracts.MACI],
633
666
  network: network?.name,
634
- defaultAddresses: [cmdObj.maciAddress],
667
+ defaultAddresses: [args.maciAddress],
635
668
  });
636
669
  const data = await (0, sdk_1.getJoinedUserData)({
637
- pollPubKey: cmdObj.pubkey,
638
- startBlock: cmdObj.startBlock,
670
+ pollPublicKey: args.publicKey,
671
+ startBlock: args.startBlock,
639
672
  maciAddress,
640
- pollId: cmdObj.pollId,
673
+ pollId: args.pollId,
641
674
  signer,
642
675
  });
643
676
  if (data.isJoined) {
644
677
  (0, sdk_1.logGreen)({
645
- quiet: cmdObj.quiet,
678
+ quiet: args.quiet,
646
679
  text: (0, sdk_1.success)([
647
680
  `Poll state index: ${data.pollStateIndex?.toString()}, registered: ${data.isJoined}`,
648
681
  `Voice credits: ${data.voiceCredits?.toString()}`,
@@ -650,7 +683,7 @@ program
650
683
  });
651
684
  }
652
685
  else {
653
- (0, sdk_1.logRed)({ quiet: cmdObj.quiet, text: "User has not joined the poll" });
686
+ (0, sdk_1.logRed)({ quiet: args.quiet, text: "User has not joined the poll" });
654
687
  }
655
688
  }
656
689
  catch (error) {
@@ -662,29 +695,34 @@ program
662
695
  .description("Get deployed poll from MACI contract")
663
696
  .option("-p, --poll <poll>", "the poll id")
664
697
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
665
- .action(async (cmdObj) => {
698
+ .action(async (args) => {
666
699
  try {
667
700
  const signer = await getSigner();
668
701
  const network = await signer.provider?.getNetwork();
669
702
  const [maciAddress] = (0, utils_1.readContractAddresses)({
670
703
  contractNames: [sdk_1.EContracts.MACI],
671
704
  network: network?.name,
672
- defaultAddresses: [cmdObj.maciAddress],
705
+ defaultAddresses: [args.maciAddress],
673
706
  });
674
707
  const details = await (0, sdk_1.getPoll)({
675
- pollId: cmdObj.poll,
708
+ pollId: args.poll,
676
709
  maciAddress,
677
710
  signer,
678
711
  });
712
+ const modeNames = {
713
+ [sdk_1.EMode.QV]: "Quadratic Voting",
714
+ [sdk_1.EMode.NON_QV]: "Non-Quadratic Voting",
715
+ [sdk_1.EMode.FULL]: "Full Credits Voting",
716
+ };
679
717
  (0, sdk_1.logGreen)({
680
718
  quiet: true,
681
719
  text: (0, sdk_1.success)([
682
720
  `ID: ${details.id}`,
683
721
  `Start time: ${new Date(Number(details.startDate) * 1000).toString()}`,
684
722
  `End time: ${new Date(Number(details.endDate) * 1000).toString()}`,
685
- `Number of signups ${details.numSignups}`,
723
+ `Number of signups ${details.totalSignups}`,
686
724
  `State tree merged: ${details.isMerged}`,
687
- `Mode: ${details.mode === 0n ? "Quadratic Voting" : "Non-Quadratic Voting"}`,
725
+ `Mode: ${modeNames[details.mode]}`,
688
726
  ].join("\n")),
689
727
  });
690
728
  }
@@ -699,15 +737,15 @@ program
699
737
  .requiredOption("-w, --address <address>", "the address to fund")
700
738
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
701
739
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
702
- .action(async (cmdObj) => {
740
+ .action(async (args) => {
703
741
  try {
704
- (0, utils_1.banner)(cmdObj.quiet);
742
+ (0, utils_1.banner)(args.quiet);
705
743
  const signer = await getSigner();
706
- const hash = await (0, sdk_1.fundWallet)({ amount: cmdObj.amount, address: cmdObj.address, signer });
707
- (0, sdk_1.logYellow)({ quiet: cmdObj.quiet, text: (0, sdk_1.info)(`Transaction hash: ${hash}`) });
744
+ const hash = await (0, sdk_1.fundWallet)({ amount: args.amount, address: args.address, signer });
745
+ (0, sdk_1.logYellow)({ quiet: args.quiet, text: (0, sdk_1.info)(`Transaction hash: ${hash}`) });
708
746
  (0, sdk_1.logGreen)({
709
- quiet: cmdObj.quiet,
710
- text: (0, sdk_1.success)(`Successfully funded ${cmdObj.address} with ${cmdObj.amount} wei`),
747
+ quiet: args.quiet,
748
+ text: (0, sdk_1.success)(`Successfully funded ${args.address} with ${args.amount} wei`),
711
749
  });
712
750
  }
713
751
  catch (error) {
@@ -722,34 +760,34 @@ program
722
760
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
723
761
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
724
762
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
725
- .action(async (cmdObj) => {
763
+ .action(async (args) => {
726
764
  try {
727
- (0, utils_1.banner)(cmdObj.quiet);
765
+ (0, utils_1.banner)(args.quiet);
728
766
  const signer = await getSigner();
729
767
  const network = await signer.provider?.getNetwork();
730
768
  // read the tally file
731
- const isTallyFileExists = fs_1.default.existsSync(cmdObj.tallyFile);
732
- if (!cmdObj.tallyFile || !isTallyFileExists) {
733
- throw new Error(`Unable to open ${cmdObj.tallyFile}`);
769
+ const isTallyFileExists = fs_1.default.existsSync(args.tallyFile);
770
+ if (!args.tallyFile || !isTallyFileExists) {
771
+ throw new Error(`Unable to open ${args.tallyFile}`);
734
772
  }
735
- const tallyData = await (0, utils_1.readJSONFile)(cmdObj.tallyFile);
773
+ const tallyData = await (0, utils_1.readJSONFile)(args.tallyFile);
736
774
  const [maciAddress] = (0, utils_1.readContractAddresses)({
737
775
  contractNames: [sdk_1.EContracts.MACI],
738
776
  network: network?.name,
739
- defaultAddresses: [cmdObj.maciAddress],
777
+ defaultAddresses: [args.maciAddress],
740
778
  });
741
- const pollParams = await (0, sdk_1.getPollParams)({ pollId: cmdObj.pollId, maciContractAddress: maciAddress, signer });
779
+ const pollParams = await (0, sdk_1.getPollParams)({ pollId: args.pollId, maciContractAddress: maciAddress, signer });
742
780
  const tallyCommitments = (0, sdk_1.generateTallyCommitments)({
743
781
  tallyData,
744
782
  voteOptionTreeDepth: pollParams.voteOptionTreeDepth,
745
783
  });
746
784
  await (0, sdk_1.verify)({
747
785
  tallyData,
748
- pollId: cmdObj.pollId,
786
+ pollId: args.pollId,
749
787
  maciAddress,
750
788
  signer,
751
789
  tallyCommitments,
752
- numVoteOptions: pollParams.numVoteOptions,
790
+ totalVoteOptions: pollParams.totalVoteOptions,
753
791
  voteOptionTreeDepth: pollParams.voteOptionTreeDepth,
754
792
  });
755
793
  }
@@ -758,34 +796,34 @@ program
758
796
  }
759
797
  });
760
798
  program
761
- .command("genProofs")
799
+ .command("generateProofs")
762
800
  .description("generate the proofs for a poll")
763
- .option("-k, --privkey <privkey>", "your serialized MACI private key")
801
+ .option("-k, --private-key <privateKey>", "your serialized MACI private key")
764
802
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
765
803
  .requiredOption("-o, --poll-id <pollId>", "the poll id", BigInt)
766
804
  .requiredOption("-t, --tally-file <tallyFile>", "the tally file with results, per vote option spent credits, spent voice credits total")
767
805
  .option("-r, --rapidsnark <rapidsnark>", "the path to the rapidsnark binary")
768
- .option("-g, --process-witnessgen <processWitnessgen>", "the path to the process witness generation binary")
769
- .option("--process-witnessdat <processWitnessdat>", "the path to the process witness dat file")
770
- .option("--tally-witnessgen <tallyWitnessgen>", "the path to the tally witness generation binary")
771
- .option("--tally-witnessdat <tallyWitnessdat>", "the path to the tally witness dat file")
806
+ .option("-g, --message-processor-witness-generator <messageProcessorWitnessGenerator>", "the path to the process witness generation binary")
807
+ .option("--message-processor-witnessDat <messageProcessorWitnessDat>", "the path to the process witness dat file")
808
+ .option("--vote-tally-witness-generator <voteTallyWitnessGenerator>", "the path to the tally witness generation binary")
809
+ .option("--vote-tally-witnessDat <voteTallyWitnessDat>", "the path to the tally witness dat file")
772
810
  .requiredOption("--poll-joining-zkey <processJoinZkey>", "the path to the poll join zkey")
773
- .requiredOption("--process-zkey <processZkey>", "the path to the process zkey")
774
- .requiredOption("--tally-zkey <tallyZkey>", "the path to the tally zkey")
811
+ .requiredOption("--message-processor-zkey <messageProcessorZkey>", "the path to the process zkey")
812
+ .requiredOption("--vote-tally-zkey <voteTallyZkey>", "the path to the tally zkey")
775
813
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
776
814
  .option("-p, --rpc-provider <provider>", "the rpc provider URL")
777
815
  .requiredOption("-f, --output <outputDir>", "the output directory for proofs")
778
816
  .option("--transaction-hash <transactionHash>", "transaction hash of MACI contract creation")
779
817
  .option("-w, --wasm", "whether to use the wasm binaries")
780
- .option("--process-wasm <processWasm>", "the path to the process witness generation wasm binary")
781
- .option("--tally-wasm <tallyWasm>", "the path to the tally witness generation wasm binary")
818
+ .option("--message-processor-wasm <messageProcessorWasm>", "the path to the process witness generation wasm binary")
819
+ .option("--vote-tally-wasm <voteTallyWasm>", "the path to the tally witness generation wasm binary")
782
820
  .option("--state-file <stateFile>", "the path to the state file containing the serialized maci state")
783
821
  .option("--start-block <startBlock>", "the block number to start looking for events from", parseInt)
784
822
  .option("--end-block <endBlock>", "the block number to end looking for events from", parseInt)
785
823
  .option("--blocks-per-batch <blockPerBatch>", "the number of blocks to process per batch", parseInt)
786
- .option("-u, --use-quadratic-voting <useQuadraticVoting>", "whether to use quadratic voting", (value) => value === "true", true)
824
+ .option("-m, --mode <mode>", "Voting mode (qv, non-qv, full)", (value) => constants_1.MODE_NAME_TO_ENUM[value], sdk_1.EMode.QV)
787
825
  .option("-b, --ipfs-message-backup-files <ipfsMessageBackupFiles>", "Backup files for ipfs messages (name format: ipfsHash1.json, ipfsHash2.json, ..., ipfsHashN.json)", (value) => value?.split(/\s*,\s*/))
788
- .action(async ({ quiet, maciAddress, pollId, ipfsMessageBackupFiles, stateFile, startBlock, endBlock, blocksPerBatch, privkey, transactionHash, output, tallyFile, tallyZkey, tallyWitnessgen, tallyWasm, processZkey, processWitnessgen, processWasm, useQuadraticVoting, tallyWitnessdat, processWitnessdat, wasm, rapidsnark, }) => {
826
+ .action(async ({ quiet, maciAddress, pollId, ipfsMessageBackupFiles, stateFile, startBlock, endBlock, blocksPerBatch, privateKey, transactionHash, output, tallyFile, voteTallyZkey, voteTallyWitnessGenerator, voteTallyWasm, messageProcessorZkey, messageProcessorWitnessGenerator, messageProcessorWasm, mode, voteTallyWitnessDat, messageProcessorWitnessDat, wasm, rapidsnark, }) => {
789
827
  try {
790
828
  (0, utils_1.banner)(quiet);
791
829
  const signer = await getSigner();
@@ -795,7 +833,7 @@ program
795
833
  network: network?.name,
796
834
  defaultAddresses: [maciAddress],
797
835
  });
798
- const coordinatorPrivateKey = privkey || (await (0, utils_1.promptSensitiveValue)("Insert your MACI private key"));
836
+ const coordinatorPrivateKey = privateKey || (await (0, utils_1.promptSensitiveValue)("Insert your MACI private key"));
799
837
  await (0, sdk_1.generateProofs)({
800
838
  maciAddress: maciContractAddress,
801
839
  coordinatorPrivateKey,
@@ -809,15 +847,15 @@ program
809
847
  signer,
810
848
  outputDir: output,
811
849
  tallyFile,
812
- tallyZkey,
813
- tallyWitgen: tallyWitnessgen,
814
- tallyWasm,
815
- processZkey,
816
- processWitgen: processWitnessgen,
817
- processWasm,
818
- useQuadraticVoting,
819
- tallyDatFile: tallyWitnessdat,
820
- processDatFile: processWitnessdat,
850
+ voteTallyZkey,
851
+ voteTallyWitnessGenerator,
852
+ voteTallyWasm,
853
+ messageProcessorZkey,
854
+ messageProcessorWitnessGenerator,
855
+ messageProcessorWasm,
856
+ mode,
857
+ voteTallyWitnessDatFile: voteTallyWitnessDat,
858
+ messageProcessorWitnessDatFile: messageProcessorWitnessDat,
821
859
  useWasm: wasm,
822
860
  rapidsnark,
823
861
  });
@@ -827,12 +865,12 @@ program
827
865
  }
828
866
  });
829
867
  program
830
- .command("genLocalState")
868
+ .command("generateLocalState")
831
869
  .description("generate a local MACI state from the smart contracts events")
832
870
  .requiredOption("-o, --output <outputPath>", "the path where to write the state")
833
871
  .requiredOption("-p, --poll-id <pollId>", "the id of the poll", BigInt)
834
872
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
835
- .option("-k, --privkey <privkey>", "your serialized MACI private key")
873
+ .option("-k, --private-key <privateKey>", "your serialized MACI private key")
836
874
  .option("--start-block <startBlock>", "the start block number", parseInt)
837
875
  .option("--end-block <endBlock>", "the end block number", parseInt)
838
876
  .option("--blocks-per-batch <blockPerBatch>", "the blocks per batch", parseInt)
@@ -842,30 +880,30 @@ program
842
880
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
843
881
  .option("-b, --ipfs-message-backup-files <ipfsMessageBackupFiles>", "Backup files for ipfs messages (name format: ipfsHash1.json, ipfsHash2.json, ..., ipfsHashN.json)", (value) => value?.split(/\s*,\s*/))
844
882
  .option("-l, --logs-output <logsOutputPath>", "the path where to save the logs for debugging and auditing purposes")
845
- .action(async (cmdObj) => {
883
+ .action(async (args) => {
846
884
  try {
847
885
  const signer = await getSigner();
848
886
  const network = await signer.provider?.getNetwork();
849
887
  const [maciAddress] = (0, utils_1.readContractAddresses)({
850
888
  contractNames: [sdk_1.EContracts.MACI],
851
889
  network: network?.name,
852
- defaultAddresses: [cmdObj.maciAddress],
890
+ defaultAddresses: [args.maciAddress],
853
891
  });
854
- const coordinatorPrivateKey = cmdObj.privkey || (await (0, utils_1.promptSensitiveValue)("Insert your MACI private key"));
892
+ const coordinatorPrivateKey = args.privateKey || (await (0, utils_1.promptSensitiveValue)("Insert your MACI private key"));
855
893
  await (0, sdk_1.generateMaciState)({
856
- outputPath: cmdObj.output.toString(),
857
- pollId: cmdObj.pollId,
894
+ outputPath: args.output.toString(),
895
+ pollId: args.pollId,
858
896
  maciAddress,
859
897
  coordinatorPrivateKey,
860
- provider: cmdObj.rpcProvider,
861
- endBlock: cmdObj.endBlock,
862
- startBlock: cmdObj.startBlock,
863
- blockPerBatch: cmdObj.blocksPerBatch,
864
- transactionHash: cmdObj.transactionHash,
865
- ipfsMessageBackupFiles: cmdObj.ipfsMessageBackupFiles,
866
- sleep: cmdObj.sleep,
898
+ provider: args.rpcProvider,
899
+ endBlock: args.endBlock,
900
+ startBlock: args.startBlock,
901
+ blockPerBatch: args.blocksPerBatch,
902
+ transactionHash: args.transactionHash,
903
+ ipfsMessageBackupFiles: args.ipfsMessageBackupFiles,
904
+ sleep: args.sleep,
867
905
  signer,
868
- logsOutputPath: cmdObj.logsOutput,
906
+ logsOutputPath: args.logsOutput,
869
907
  });
870
908
  }
871
909
  catch (error) {
@@ -880,20 +918,20 @@ program
880
918
  .option("-q, --quiet <quiet>", "whether to print values to the console", (value) => value === "true", false)
881
919
  .option("-r, --rpc-provider <provider>", "the rpc provider URL")
882
920
  .option("-x, --maci-address <maciAddress>", "the MACI contract address")
883
- .requiredOption("-f, --proof-dir <proofDir>", "the proof output directory from the genProofs subcommand")
884
- .action(async (cmdObj) => {
921
+ .requiredOption("-f, --proof-dir <proofDir>", "the proof output directory from the generateProofs subcommand")
922
+ .action(async (args) => {
885
923
  try {
886
924
  const signer = await getSigner();
887
925
  const network = await signer.provider?.getNetwork();
888
926
  const [maciAddress] = (0, utils_1.readContractAddresses)({
889
927
  contractNames: [sdk_1.EContracts.MACI],
890
928
  network: network?.name,
891
- defaultAddresses: [cmdObj.maciAddress],
929
+ defaultAddresses: [args.maciAddress],
892
930
  });
893
931
  await (0, sdk_1.proveOnChain)({
894
- pollId: cmdObj.pollId,
895
- tallyFile: cmdObj.tallyFile,
896
- proofDir: cmdObj.proofDir,
932
+ pollId: args.pollId,
933
+ tallyFile: args.tallyFile,
934
+ proofDir: args.proofDir,
897
935
  maciAddress,
898
936
  signer,
899
937
  });