-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): generate batch of artifacts (#113)
* feat: override arguments of circuits in generate command * refactor: do no export generate * changeset * feat: generate batch of artifacts * feat: improve logging * changeset * chore: add lint override * chore: update snapshot * chore: decreases coverage thresholds * chore: format * chore: update cli rollup config
- Loading branch information
Showing
11 changed files
with
125 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@zk-kit/artifacts-cli": minor | ||
--- | ||
|
||
Generate batch of artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@zk-kit/artifacts-cli": minor | ||
--- | ||
|
||
Can override circuits parameters in generate command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { readFileSync } from 'node:fs' | ||
import { exit } from 'node:process' | ||
import { spinner } from '../../spinner.ts' | ||
import { generateActionNoExit } from '../generate/action.ts' | ||
|
||
export default async function generateBatch(optionsPath: string, destination: string) { | ||
const options = JSON.parse(readFileSync(optionsPath, 'utf8')) as Record< | ||
string, | ||
{ circuit: string; paramsList: string[][] } | ||
> | ||
|
||
spinner.start() | ||
for (const [config, { circuit, paramsList }] of Object.entries(options)) { | ||
for (const params of paramsList) | ||
await generateActionNoExit(circuit, params, { config, destination }) | ||
} | ||
|
||
spinner.succeed(`All snark artifacts generated successfully in ${destination}`) | ||
exit(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Command } from '@commander-js/extra-typings' | ||
import generateBatchAction from './action.ts' | ||
|
||
export const generateBatch = new Command('generate-batch').alias('gb').description( | ||
'Generate snark artifacts for a list of circom circuits', | ||
) | ||
.argument( | ||
'<optionsPath>', | ||
'Path to the options definition json file: { [circomkitJsonPath]: { circuit:string, params: string[][] }}', | ||
) | ||
.argument('<destination>', 'Destination directory for the generated artifacts') | ||
.action(generateBatchAction) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { download } from './download/index.ts' | ||
import { generateBatch } from './generate-batch/index.ts' | ||
import { generate } from './generate/index.ts' | ||
import { list } from './list.ts' | ||
|
||
export default [download, generate, list] | ||
export default [download, generate, generateBatch, list] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters