Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add halo2-wasm cli #25

Merged
merged 7 commits into from
Nov 8, 2023
Merged

feat: add halo2-wasm cli #25

merged 7 commits into from
Nov 8, 2023

Conversation

rpalakkal
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Oct 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
halo2-repl ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 28, 2023 11:00pm

@rpalakkal rpalakkal marked this pull request as ready for review October 28, 2023 22:59
@rpalakkal rpalakkal requested a review from ytham October 28, 2023 22:59
Copy link
Contributor

@jonathanpwang jonathanpwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for now, left some notes to add to issues / consider in the long-term.

For the short-term, the following should be mentioned in the readme:

  • Need to use -c src/examples/run.ts src/examples/circuit.ts to use the default runner (consider just using default runner unless an override is provided`
  • To use default runner, halo2-lib-js needs to be globally installed
  • Global install needs to use npm and not pnpm (haven't tried yarn)
  • npm global install without sudo: https://github.com/sindresorhus/guides/blob/main/npm-global-without-sudo.md
  • Global install of halo2-wasm-cli to use the halo2-wasm command

cli/src/examples/run.ts Show resolved Hide resolved
cli/src/keygen.ts Outdated Show resolved Hide resolved
cli/src/prove.ts Outdated Show resolved Hide resolved
import { getFunctionFromTs, getRunCircuitFromTs, getUint8ArrayFromBuffer, saveBufferToFile, saveJsonToFile } from "./utils";

export const prove = async (path: string, options: { pk: string, stats: boolean, proof: string, instances:string, circuit: string }) => {
const circuit = await getFunctionFromTs(path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current way is fine, so this is just a note, but we may consider making the circuit path and circuit input path separate, so the proof runner code is .ts but the input is .json -- this is more just to make it clear you can re-run the same circuit code on multiple inputs.

We can just make it a ticket for later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added an inputs field to mock/prove commands to optionally read inputs from a json file (if it's not provided, then just defaults to the circuit file)

import { CircuitScaffold } from "./scaffold";
import { getFunctionFromTs, getRunCircuitFromTs, getUint8ArrayFromBuffer, readJsonFromFile } from "./utils";

export const verify = async (path: string, options: { vk: string, proof: string, instances: string, circuit: string }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To verify shouldn't you only need: vkey, instances, proof? There should no longer be a need for circuit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reading the vkey seems to require BaseCircuitParams, which is instantiated in halo2-wasm from CircuitConfig. Currently the circuit file is responsible for exporting the circuit config (

export const config = {
). Will add this to the readme.

@rpalakkal rpalakkal merged commit f3d6964 into main Nov 8, 2023
1 check passed
@rpalakkal rpalakkal deleted the feat/cli branch November 8, 2023 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants