-
Notifications
You must be signed in to change notification settings - Fork 13
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 interface with tests #7
base: main
Are you sure you want to change the base?
Conversation
Added a simpler |
src/circom/mod.rs
Outdated
let root = current_dir().unwrap().join("examples/cube"); | ||
let r1cs_path = root.join("cube.r1cs"); | ||
let wtns_path = root.join("cube.wasm"); | ||
let mut circuit = SpartanCircuit::new(r1cs_path); |
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's a simplification here. We can just pass r1cs_path
to setup (which returns (pk,vk)
) and the setup
can internally create a SpartanCircuit
object (this will hide the struct from the caller and reduces code that someone needs to write). Isn't it?
src/circom/mod.rs
Outdated
} | ||
|
||
#[allow(dead_code)] | ||
pub fn create_snark<G: Group, S: RelaxedR1CSSNARKTrait<G>>( |
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.
This method seems not that useful. In other words, we can just have two methods, one for setup and another for prove. The setup takes the r1cs file path and the prove takes the witness file path (in addition to pk).
Changed the interface to avoid having the user use the struct Also, |
@arasuarun Please open an issue on https://github.com/lurk-lab/circom-scotia with the change you have in mind! We'd love feedback on our APIs. |
A circom interace using the circom-scotia library.
There are different ways to go with how the structs are designed, so keeping this as a draft PR for now. Most of the code is in
src/circom/mod.rs
with theSpartanCircuit
struct. It's a wrapper around anR1CS
object with an optional witness vector.The
generate_keys
andgenerate_proof
functions are defined outside the struct as they require different generics<G: Group, S: RelaxedR1CSSNARKTrait<G>
. Perhaps these could be combined into the struct itself. Not sure what the best way to go about this is.The circom files for the circuit being tested are in the
examples/cube
folder. I could also move the tests to be an example in that folder.