-
Notifications
You must be signed in to change notification settings - Fork 37
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
Feat/circom prover #304
Feat/circom prover #304
Conversation
f5ba880
to
82c6c52
Compare
82c6c52
to
2307291
Compare
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 i get a concrete rationale for creating a new package in the monorepo instead of breaking the ark logic into a separate file instead? This adds a layer of complexity and as such i'd expect concrete upside. As it stands i don't see the upside and am against adding a new package.
circom-prover/src/witness.rs
Outdated
|
||
/// To create witness functions corresponding to different witness generation libs. | ||
#[macro_export] | ||
macro_rules! create_witness_fn { |
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.
I think this macro is a bad abstraction. Why do we want to hide which adapter is being used to create the witness function? e.g. why can't we use rust_witness
and witnesscalc_adapter
directly? Adding this adds a layer of complexity, what is the justification?
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.
removed in 265abb6
inputs: HashMap<String, Vec<String>>, | ||
dat_path: String, | ||
) -> Vec<BigUint> { | ||
std::thread::spawn(move || { |
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 thread is a noop. This generate_witness
implementation creates a background thread, then blocks the main thread waiting for the background thread (e.g. immediately joins the thread below).
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.
Nice catch! I forgot to handle this. fixed in b6d39a6
ah i see, the intention is to publish the package on crates.io? |
I think Vivian's intention is
, want to address
and also to simply the dependencies of At the beginning, Vivian proposed to have a separated repo to address above issues. However, I suggested to put the logic inside I would love to hear your feedback on how to fix #299 and make the codebase clean! 😄 Moving to circom-prover repo works for me as well. |
@chancehudson Yes and I think the and I think the |
524ec15
to
b6d39a6
Compare
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.
I think the more ideal implementation is to have like
witness/
witnesscalc.rs
rust_witness.rs
mod.rs
and we enable each by
#[cfg(feature = "witnesscalc")]
mod witnesscalc;
#[cfg(feature = "rust-witness")]
mod rust_witness;
so we don't have to set many feature flags
and what if people set two different witness generators at the same time?
e.g. rustwitness
and witnesscalc
it looks like it will execute the same operation twice?
#[cfg(feature = "witnesscalc")]
WitnessFn::WitnessCalc(wit_fn) => wit_fn(bigint_inputs, _dat_path.as_str()),
#[cfg(feature = "rustwitness")]
WitnessFn::RustWitness(wit_fn) => wit_fn(bigint_inputs),
I actually prefer the way if we can enable both features at the same time
(though it might not make sense)
but we need to design the functions
like generate_witness_rust_witness
, generate_witness_witnesscalc
and init the prover like
let circom_prover = CircomProver(wtns_fn, proof_fn);
or we need to check if one feature is enabled, and another should not be executed
It's a good idea, but I realized there is no many code in witnesscalc.rs or rust_witness.rs. It seems a little over design for me and that's why I kept two different witness generation functions in the same file.
No, it won't execute the same operation twice. WitnessFn::WitnessCalc(wit_fn) => wit_fn(bigint_inputs, _dat_path.as_str()),
WitnessFn::RustWitness(wit_fn) => wit_fn(bigint_inputs), Just like a normal |
I was considering this design as well, but it seems not really necessary to do in this way. I think current design is more lightweight, people can call any functions as they want, not have to init a let a = CircomProver(rust_witness, arkworks);
let b = CircomProver(witness_calc, arkworks); which means it better not to use The only benefit I can image is that we don't need to 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.
LGTM
Just some lines can be removed
Co-authored-by: Ya-wen, Jeng <[email protected]>
Co-authored-by: Ya-wen, Jeng <[email protected]>
close #299