-
Notifications
You must be signed in to change notification settings - Fork 504
feat: implement field emulation over small fields #1495
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements field emulation over small fields by replacing legacy API calls (emulated.ValueOf) with the new element constructors (e.g., fp.NewElement, fr.NewElement) and updating schema and witness handling to propagate the underlying field modulus.
- Updated algebra and pairing modules to use the new element constructors.
- Modified schema and witness functions to pass the field modulus, ensuring proper initialization of circuit variables.
- Adjusted tests and CSV statistics to reflect changes for small field support.
Reviewed Changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| std/algebra/emulated/sw_bls12381/g2.go | Replaced emulated.ValueOf by fp.NewElement and updated pointer usage. |
| std/algebra/emulated/sw_bls12381/g1.go | Similar API update replacing emulated.ValueOf with ba.NewElement. |
| std/algebra/emulated/fields_bw6761/e6_pairing.go | Updated element constructors to new API in pairing computations. |
| frontend/witness.go, schema/, cs/ | Updated Walk calls to pass the field modulus and propagate field info. |
| internal/smallfields/circuits_test.go | Extended tests for small field compilation and witness initialization. |
| backend/witness/* | Adjusted witness JSON serialization/deserialization to align with new schema parameter. |
ae3dc3c to
dbebbe9
Compare
Description
This PR adds capability for the multiplication checks in the field emulation to be performed in small fields. Namely, for the multiplication checks we sample the challenge in field extension and use it instead of a field element.
Depends on #1492, #1493 and #1494. Will rebase after other PRs are merged. For reviewing, have a look at the latest non-merge commits (particularly 1d314a1).
Type of change
How has this been tested?
Added tests to compile and solve (both with actual solver and test engine) over small fields.
Checklist:
golangci-lintdoes not output errors locally