-
Notifications
You must be signed in to change notification settings - Fork 370
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
refactor: allow builder to interact with schema parser #332
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.
looks OK to me, not sure where this is going but doesn't look like to be introducing any regressions 👍
// VariableCount returns the number of native elements required to represent
// the given reflected type as a witness.
VariableCount(reflect.Type) int
Don't understand why this is in Builder interface.
Just in case on how I would be using it. When I have defined variables in a circuit as type
So, if I wrap the native builder (r1cs or scs) for using non-native field emulation ( For example usage, see https://github.com/ConsenSys/gnark/blob/1fcebc0dcae8a0d7f06c9efe869834141cdc94be/std/math/nonnative/api.go#L37 Or actually, maybe I could do without |
|
👍. But I slept on it over the weekend and it may not cover all possible use cases in field emulation. I'll try before merging. |
In the upcoming fake-API for field emulation branch I have implemented a wrapper for
frontend.Builder
which initialises the variables in the circuit witness. The builder also needs to modify the parsed schema (for example, we need a native element for every limb). For that, theLeafHandler
now takes as input*schema.Field
which it can modify in-place.I think this PR may not be optimal. Will try to rebase fake-API branch on top of this one to see how it would be used in practice.