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

doc: annotated guide to correctly constraining and optimizing circom #2

Merged
merged 4 commits into from
Oct 2, 2024

Conversation

thor314
Copy link
Contributor

@thor314 thor314 commented Oct 1, 2024

Adds short blog post in README about correctly constraining Circom values.

@thor314 thor314 marked this pull request as ready for review October 1, 2024 22:48
@thor314
Copy link
Contributor Author

thor314 commented Oct 1, 2024

rdy4reviu.

I'm finished with the main thrust of the post. The only thing I would add; I could spend time going farther into tools that I spent a half hour trying to set up without success (circom-mutator, picus), or a tool I found today (ecne).

lmk if that seems worth doing, and any stylistic guidance on this readme.

also, waylon mentioned on call that he thought it would be good to make this repo public after review.

README.md Outdated

As stated in the circom docs, generally avoid using `<--`, at least until an optimization code pass. The operator may save a small number of gates, but risks underconstraining the circuit. A developer may incorrectly use `<--` to allow assignment for would-be non-quadratic assignments; this is a [footgun](https://en.wiktionary.org/wiki/footgun).

Use of `<--` is can allow the developer to reason extra constraints out of their circuits, thereby improving proving times. When optimizing code with `<--`, use tools like `circom --inspect` (which searches the codebase for `<--` that can be transformed into `<==`) and `circomspect` to check for correctly constrained circuits.
Copy link

Choose a reason for hiding this comment

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

Suggested change
Use of `<--` is can allow the developer to reason extra constraints out of their circuits, thereby improving proving times. When optimizing code with `<--`, use tools like `circom --inspect` (which searches the codebase for `<--` that can be transformed into `<==`) and `circomspect` to check for correctly constrained circuits.
```suggestion
Use of `<--` can allow the developer to reason extra constraints out of their circuits, thereby improving proving times. When optimizing code with `<--`, use tools like `circom --inspect` (which searches the codebase for `<--` that can be transformed into `<==`) and `circomspect` to check for correctly constrained circuits.

Copy link

Choose a reason for hiding this comment

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

This sentence sounds a little strange

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated in last latest push

Copy link

@0xJepsen 0xJepsen left a comment

Choose a reason for hiding this comment

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

@thor314 this is great. Thanks for diving in and looking into this. I would love for this to be open source so i can share it with my nerd friends and highlight the resource

@thor314 thor314 merged commit b839767 into main Oct 2, 2024
1 check passed
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