Skip to content

Commit

Permalink
Fix handling single specific circuit
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <[email protected]>
  • Loading branch information
jimthematrix committed Aug 14, 2024
1 parent a3025ed commit 83af476
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions zkp/circuits/gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const argv = yargs(hideBin(process.argv)).argv;

const circuitsRoot = process.env.CIRCUITS_ROOT;
const provingKeysRoot = process.env.PROVING_KEYS_ROOT;
const ptauDownload = process.env.PTAU_DOWNLOAD_PATH;
const circuitsRoot = process.env.CIRCUITS_ROOT || argv.circuitsRoot;
const provingKeysRoot = process.env.PROVING_KEYS_ROOT || argv.provingKeysRoot;
const ptauDownload = process.env.PTAU_DOWNLOAD_PATH || argv.ptauDownloadPath;
const specificCircuits = argv.c;
const compileOnly = argv.compileOnly;
const parallelLimit = parseInt(process.env.GEN_CONCURRENCY, 10) || 10; // Default to compile 10 circuits in parallel
Expand Down Expand Up @@ -115,8 +115,13 @@ const processCircuit = async (circuit, ptau, skipSolidityGenaration) => {

const run = async () => {
if (specificCircuits) {
let onlyCircuits = specificCircuits;
if (!Array.isArray(specificCircuits)) {
onlyCircuits = [specificCircuits];
}

// if specific circuits are provided, check it's in the map
for (const circuit of specificCircuits) {
for (const circuit of onlyCircuits) {
if (!circuits[circuit]) {
console.error(`Error: Unknown circuit: ${circuit}`);
process.exit(1);
Expand Down

0 comments on commit 83af476

Please sign in to comment.