-
Notifications
You must be signed in to change notification settings - Fork 62
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
Circom wrapper's helper function #26
Circom wrapper's helper function #26
Conversation
Which were the dependencies problems that you found with https://github.com/arkworks-rs/circom-compat ? |
@arnaucube I updated I recognize the need to eliminate the copy-pasted code of |
Successfully imported |
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.
Very nice! Thank you very much for contribuiting ^^
For task #16 there is a dependancy on #15, but while we don't have #15 (frontend
trait) defined, this PR seems a good advancement of the methods that will be used once the frontend
trait is defined.
I don't have much time now (currently OOO), but leaving some comments as a first high level pass.
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.
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.
Could we avoid adding .wasm
and .r1cs
files for testing and generate them on the fly? Would that take a lot of time and slow down the tests that much?
Asking as otherwise, sync the repo will take time. And if we can save it would be cool. But not at the cost of tests taking forever.
In any case, worth exploring the alternatives.
Also, as for the frontend, could we have some struct/trait for which we implement this public functions? I'd rather have a unit struct that has nothing but parses all that stuff so that I don't need to call 3 functions rather than this.
@han0110 Thanks for the feedback.
Certainly, I believe it's possible by using a sh file. In fact,
Thank you for the suggestion. I see the merit in your approach and will proceed with creating such a struct or trait. |
I've addressed and refined every point in our code based on your invaluable feedback. Thank you for your guidance. Here's a concise summary of the modifications: I removed the redundant generic Instead of adding I integrated several related functions into the
I would be most grateful if you could review the revised code again. @arnaucube |
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.
LGTM
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.
Fixed conflicts.
LGTM! Thanks for this work @yugonsan
I have fixed some issues based on the error in GitHub actions. I have edited the |
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.
Very good job! The interface looks very nice now^^
I'm excited to start folding Circom circuits soon™
7656c6b
Hello, I conducted the issue #16 (Circom Wrapper). It would be best to write
frontend_trait
at first, but I made this helper function in advance.What?
frontend/circom/mod.rs
is the main code in this PR. The file works for below;.r1cs
files.folding-schemes
's R1CS..wasm
file and inputs.folding-schemes
'sR1CS
andz
format.Changes
convert_constraints_bigint_to_scalar
function that maps BigInt constraints to Bn254's ScalarField constraints.extract_constraints_from_r1cs
to parse constraints from Circom's.r1cs
files.convert_to_folding_schemes_r1cs
to adapt the constraints forfolding-schemes
's R1CS.calculate_witness
for witness computation using Circom's.wasm
file.circom_to_folding_schemes_r1cs_and_z
to convert from Circom's R1CS and witness tofolding-schemes
formats.How?
In #16, I said that I would use
nova-scotia
, but ark-circom(circom-compat) is based on arkworks so it is more compatible tofolding-schemes
.So I adopted the
ark-circom
instead ofnova-scotia
, and copy&pasted their codes incircom/r1cs_reader.rs
andcircom/witness/circom.rs, memory.rs, mod.rs, witness_calculator.rs
because I couldn't importark-circom
crate due to arkworks dependencies problem.ark-circom
has Apache-2.0 and MIT license, but it would be better to write credit for the library in readme.Testing?
The
test_circom_to_folding_conversion
function showcases the entire process: from extracting constraints from an R1CS file, through conversion tofolding-schemes
's R1CS and z, to checking the equality of A•z◎B•z=C•z.I confirmed
folding-schemes
's R1CS and z from Circom's.r1cs
andwitness.wasm
satisfy thecheck_relation
function insrc/ccs
.Anything Else?
To Do
let l = a_matrix.first().map(|vec| vec.len()).unwrap_or(0);
This does not accurately represent the size of public inputs and outputs. In other words, everything is public i/o. Moving forward, we need to modify this to ensure l captures the correct size of public inputs and outputs."
frontend_trait
and fit this circom wrapper function to it.Thank you for your review. I appreciate it and look forward to your feedback!