-
Notifications
You must be signed in to change notification settings - Fork 16
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
LessThan circuits and padding #14
Conversation
Fix tabulation Add missing import
Fix random `Fp` slice creation Fix formatting
Remove unnecessary `PhantomData` Co-authored-by: Antonio Mejías Gil <[email protected]> Progress until 08/03 Co-authored-by: Antonio Mejías Gil <[email protected]> constructing range check, wip working on padding println nightmare, issue apparently fixed Remove redundant padding. Fix import. code cleanup further cleanup found better way to fix padding the 'better way' to fix padding actually broke other tests - reverted This reverts commit d4727ba. moved example to examples folder, refactored, tested many cases
Evaluate parallelization
…tead of unsigned integers.
LessThan circuits and padding
@microsoft-github-policy-service agree company="Hungry Cats Studio" |
377bb0e
to
b38a771
Compare
Remove unnecessary `PhantomData` Co-authored-by: Antonio Mejías Gil <[email protected]> Progress until 08/03 Co-authored-by: Antonio Mejías Gil <[email protected]> constructing range check, wip working on padding println nightmare, issue apparently fixed Remove redundant padding. Fix import. code cleanup further cleanup found better way to fix padding the 'better way' to fix padding actually broke other tests - reverted This reverts commit d4727ba. moved example to examples folder, refactored, tested many cases
…tead of unsigned integers.
b38a771
to
900e34c
Compare
@srinathsetty Have you had a chance to look at this? No rush. Happy to discuss anything. |
Hi @Antonio95 this looks great! thanks! We can merge this once we fix conflicts with main. Could you please rebase? |
Hi @srinathsetty , thanks a lot for taking a look! I have now merged (instead of rebasing, I hope that's okay - let me know otherwise). It seems that |
Hi @Antonio95! thanks! Yes, indeed. I think we can remove unused: fn pow2(self) -> usize; For bellpepper methods, it seems like we need those methods and the parameters. In Nova codebase (where this code originated originally and intended to be expanded to hash-based commitment schemes here), we used |
That seems like a good way to go about things, @srinathsetty . Let me know if you want me to remove the |
Yes, let's remove unused methods. |
Hey @srinathsetty! I have addressed the problematic
These errors also occur in the Another possibility that I see is to |
This looks great, thank you! |
Just fixed the clippy warning which made the last build fail |
This PR adds two example circuits to verify
a < b
, wherea
is a private witness held by the prover andb
is a public constant fixed at set-up. The two circuits rely on a fixed bit length thata
is supposed to fit in (when regarded as an unsigned integer, even though in reality it lies in some finite field).LessThanCircuitSafe
performs the aforementioned bit length verification ona
.LessThanCircuitUnsafe
does not. This leads to constraint savings when the circuit is used as a component in a larger circuit which already ensures the bit length meets the required bound.In the course of writing the examples, we encountered the issue that the existing Spartan machinery did not pad the matrices to power-of-two row and column lengths, as necessitated by the proof system. This caused compilation errors in our examples. Since it seemed like a good idea for this need for padding to be abstracted away from the user, we have implemented padding in the Spartan internals - that is the other significant contribution in this PR. Note that a
R1CSShape
method.pad()
already existed here, but after some experimentation we convinced ourselves that it could not be used to pad the circuit in the cases where it was necessary.Other minor changes:
<F>
generic on the existingCubicCircuit
example, which in turn allowed us to remove thePhantomData
therein and didn't require any further code modifications.