-
Notifications
You must be signed in to change notification settings - Fork 8
Add a new ScalarMap struct and use it to make witnesses more structured
#92
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: main
Are you sure you want to change the base?
Conversation
|
I marked this PR as draft as I am not entirely happy with the examples, and would like to look at this again in the next couple of days and see if I can improve on the "user"-facing API. I intend to look at the crates using this library and seeing how big of a breaking change this will be to them as well. |
|
Fantastic, thank you so much! I think we have to start committing to semantic versioning, so we'd have to change the function name for this new API and deprecate the old one. Shouldn't be too much work. The PR should be linted too. |
|
As I've been working on the examples, I'm convinced that we need some updates to the way composed relations work with instance and witness assignments to make this work well. I am working on a proposal for that, and am implementing this all at once rather than one piece at a time so that we only need to propagate the breaking changes once. |
Why is that? With semantic versioning a version bump from |
|
@nategraf thank you so much! Yes, you're right, let's just keep in mind that this needs to go in 0.2 |
At the moment, witnesses are provided as
Vec<G::Scalar>. As a result, the building of witness must recreate the exact of the allocation of scalar vars. Additionally, this makes it difficult to ever work with variable references that are not exactly the index assigned as the ordered in which variables are created.This PR attempts to refactor this such that assignment of variables, including construction of a witness, is done by associating a
ScalarVarwith its assignments (e.g.nizk.prove_batchable([(x_var, x), (y_var, y)], &mut OsRng)). This is as opposed to the witness always being aVecwhere the order determined which scalars are assigned to which variable (e.g.nizk.prove_batchable([x, y)], &mut OsRng)).