-
Notifications
You must be signed in to change notification settings - Fork 501
build: updated to latest gnark crypto api change (code gen) #1668
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
base: master
Are you sure you want to change the base?
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 updates the tinyfield code generation to use the latest gnark-crypto API. The changes migrate from the deprecated GenerateFF API to the new simpler generator.Generate function, and replace the structured FieldDependency configuration with direct field assignments in the gkrConfig struct.
- Migrated field generator API from
GenerateFFwithconfig.NewFieldConfigto the newgenerator.Generatefunction - Refactored
gkrConfigstruct to use direct field assignments instead of embeddedFieldDependencystruct - Added test coverage for the new
SetBytesCanonicalmethod generated by the updated gnark-crypto
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/smallfields/tinyfield/element_test.go | Added property-based test for SetBytesCanonical method to verify round-trip consistency with Bytes() |
| internal/smallfields/tinyfield/doc.go | Updated documentation to remove specific mention of AVX512/NEON instructions, making it more generic |
| internal/generator/backend/main.go | Migrated to new gnark-crypto generator API, replacing GenerateFF with Generate and flattening gkrConfig struct fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // conf, err := config.NewFieldConfig(d.Curve, "Element", d.AutoGenerateField, false) | ||
| // if err != nil { | ||
| // panic(err) | ||
| // } | ||
| // if err := generator.GenerateFF(conf, d.RootPath, generator.WithASM(nil)); err != nil { | ||
| // panic(err) | ||
| // } |
Copilot
AI
Dec 29, 2025
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.
The commented-out code should be removed rather than left in place. This old API code has been replaced by the new generator.Generate call and is no longer needed. Keeping dead code in the codebase reduces maintainability and can cause confusion for future developers.
| // conf, err := config.NewFieldConfig(d.Curve, "Element", d.AutoGenerateField, false) | |
| // if err != nil { | |
| // panic(err) | |
| // } | |
| // if err := generator.GenerateFF(conf, d.RootPath, generator.WithASM(nil)); err != nil { | |
| // panic(err) | |
| // } |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
| // } | ||
| // if err := generator.GenerateFF(conf, d.RootPath, generator.WithASM(nil)); err != nil { | ||
| // panic(err) | ||
| // } |
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.
Commented-out old implementation code left in codebase
The old implementation using config.NewFieldConfig and generator.GenerateFF with generator.WithASM(nil) has been left as commented-out code after the migration to the new generator.Generate API. This dead code adds noise to the codebase and could confuse future maintainers. It appears to have been kept for reference during development but wasn't cleaned up before the PR.
Description
Update
tinyfieldcode generation using latest gnark-crypto. Sister PR: Consensys/gnark-crypto#781Note
field/generator/config+GenerateFF(...)withgenerator.Generate(package, element, modulus, outDir)ininternal/generator/backend/main.go; removeconfigimport and refactorgkrConfigto explicit fields (no embeddedFieldDependency). Update GKR small-rational config similarly.SetBytesCanonical(Bytes())round-trips inelement_test.go.1.24.9and refresh deps (gnark-crypto,bavard,compress,pprof,golang.org/x/*, etc.) ingo.mod/go.sum.Written by Cursor Bugbot for commit 014e208. This will update automatically on new commits. Configure here.