Skip to content

Commit d7752e7

Browse files
committed
Reorganize pipelines into modules
1 parent 7d97dda commit d7752e7

12 files changed

+474
-428
lines changed

cli.js

+9-42
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,22 @@
11
#!/usr/bin/env node
22
import {Command} from 'commander';
33

4-
import {verify, deploy, verifyMulti} from './index.js';
54
import {
6-
instanceSizes,
75
getPackageJson,
8-
formatBytes,
9-
MAX_POST_SIZE,
10-
DEFAULT_CONFIG,
116
} from './src/utils.js';
127

13-
const program = new Command();
14-
15-
program
16-
.name('circuitscan')
17-
.description('CLI tool to verify verifier contracts by their circom sources')
18-
.version(getPackageJson().version);
8+
import circomCommands from './src/circom/index.js';
9+
import circomMultiCommands from './src/circomMulti/index.js';
1910

20-
program
21-
.command('verify:circom <mainCircomFile> <chainId> <verifierContractAddress>')
22-
.description('Verify verifier contracts by their circom sources. Can also specify chain by name.')
23-
.option('-p, --protocol <protocol>', 'Specify the protocol: groth16 (default), fflonk, plonk (overrides circomkit.json if available)')
24-
.option('-k, --proving-key <provingKey>', `Specify the proving key filename or url (optional, for Groth16 trusted setups). Must be https hosted if >${formatBytes(MAX_POST_SIZE)}`)
25-
.option('-t, --ptau <ptauSize>', 'Force a specific Powers of Tau size (8-28 or url to download specific file)')
26-
.option('-v, --circom-version <circomVersion>', 'Specify the Circom version (e.g. "v2.1.8")')
27-
.option('-s, --snarkjs-version <snarkjsVersion>', 'Specify the SnarkJS version (e.g. "0.7.3")')
28-
.option('-i, --instance <memorySize>', `Specify the memory (GB) of compiler instance: ${Object.keys(instanceSizes).join(', ')} (default: 10GB lambda, faster init for small circuits)`)
29-
.option('-r, --resume <requestId>', 'In case of errors during compilation, reattach to a job and attempt a new deploy. Overrides all other options.')
30-
.option('-c, --config <configUrl>', `Specify a different configuration file (default: ${DEFAULT_CONFIG})`)
31-
.option('-a, --api-key <apiKey>', `Specify your API Key as a command line argument`)
32-
.action(verify);
11+
const program = new Command();
3312

3413
program
35-
.command('deploy:circom <mainCircomFile> [chainId]')
36-
.description('Deploy verifier contract by their circom sources. Can also specify chain by name.')
37-
.option('-p, --protocol <protocol>', 'Specify the protocol: groth16 (default), fflonk, plonk (overrides circomkit.json if available)')
38-
.option('-k, --proving-key <provingKey>', `Specify the proving key filename or url (optional, for Groth16 trusted setups). Must be https hosted if >${formatBytes(MAX_POST_SIZE)}`)
39-
.option('-t, --ptau <ptauSize>', 'Force a specific Powers of Tau size (8-28 or url to download specific file)')
40-
.option('-v, --circom-version <circomVersion>', 'Specify the Circom version (e.g. "v2.1.8")')
41-
.option('-s, --snarkjs-version <snarkjsVersion>', 'Specify the SnarkJS version (e.g. "0.7.3")')
42-
.option('-i, --instance <memorySize>', `Specify the memory (GB) of compiler instance: ${Object.keys(instanceSizes).join(', ')} (default: 10GB lambda, faster init for small circuits)`)
43-
.option('-r, --resume <requestId>', 'In case of errors during compilation, reattach to a job and attempt a new deploy. Overrides all other options.')
44-
.option('-c, --config <configUrl>', `Specify a different configuration file (default: ${DEFAULT_CONFIG})`)
45-
.option('-a, --api-key <apiKey>', `Specify your API Key as a command line argument`)
46-
.option('-b, --browser-wallet', 'Send transaction in browser instead of by passing private key env var (overrides chainId argument)')
47-
.action(deploy);
14+
.name('circuitscan')
15+
.description('CLI tool to verify verifier contracts by their circom sources')
16+
.version(getPackageJson().version);
4817

49-
program
50-
.command('verify:circom-multi <jsonFile>')
51-
.description('Verify a Groth16 multi-verifier using a JSON specification. See docs website for details.')
52-
.option('-c, --config <configUrl>', `Specify a different configuration file (default: ${DEFAULT_CONFIG})`)
53-
.action(verifyMulti);
18+
// Each pipeline adds its commands
19+
circomCommands(program);
20+
circomMultiCommands(program);
5421

5522
program.parse(process.argv);

index.js

-298
This file was deleted.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "circuitscan",
3-
"version": "0.0.25-alpha",
4-
"main": "index.js",
3+
"version": "0.0.26-alpha",
4+
"main": "cli.js",
55
"type": "module",
66
"author": "numtel <[email protected]>",
77
"license": "MIT",

0 commit comments

Comments
 (0)