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

Support for custom gadgets #84

Open
effectfully opened this issue Nov 19, 2020 · 0 comments
Open

Support for custom gadgets #84

effectfully opened this issue Nov 19, 2020 · 0 comments
Labels
AST Crypto enhancement New feature or request

Comments

@effectfully
Copy link
Owner

I was confused as to what the difference between input and output variables in custom gadgets was and so I talked a bit with Eduardo. His response:

Actually there is no notion of output. We don't have a high level description of a gadget. It is in some sense just a slice of a vector of constraints. Currently you need to use the gadget "manually". For example, I can start an empty vector of constraints. Then I can initialize it with gadget A. Afterwards, I can concatenate a gadget B, but I am responsible for adding some linear constraints that make sure the variables that are supposed to be the output (I know the position of such variables for each gadget) are indeed used as input of next gadget. More concretely. If I start using an identity gadget 2 times, for variables a and b, then the input and output are the same, I must provide a witness that will be stored in position zero, and another witness that is stored on position 1. In the future, when I need to make reference to a or b then I need to remember their positions.

Namely, if I want to add a gadget for some ECC operation using variable b and the current size of the vector of constraints is for example 100, then must add a constraint that glues together the variables on positions 1 and 100+offset.

Therefore, I guess we will have to define some way to parameterize these positions, in order to allow more intelligent way to compose gadgets. But I imagine the compiler knows the position of each variable, while our implementation doesn't know the concept of a variable.

So there's not really any distinction between input and output variables. A gadget does not have any assignments and does not introduce any new variables. And is basically a list of constraints in a fully compiled form.

I do not fully grasp all the details here, but gadgets seem specific enough for us not to bother connecting them with procedures/functions at all. So it seems we don't even need to bother with procedures/functions for an MVP.

Making gadgets work will require some effort, though, due to them being so painfully low-level. Functions would be easier. But supporting gadgets seems inevitable.

@effectfully effectfully added AST Crypto enhancement New feature or request labels Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AST Crypto enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant