Skip to content
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 removes ark-circom dep. #312

Merged
merged 7 commits into from
Feb 6, 2025

Conversation

KimiWu123
Copy link
Collaborator

@KimiWu123 KimiWu123 commented Feb 3, 2025

This PR is the second part of #299 , removing ark-circom dependency.

Details:

Copied functions we need from https://github.com/zkmopro/circom-compat/tree/wasm-delete to our repo.

@KimiWu123 KimiWu123 force-pushed the feat/circom-prover-remove-ark-circom-dep branch from 638fb61 to 3c58dba Compare February 3, 2025 09:23
Copy link

cloudflare-workers-and-pages bot commented Feb 3, 2025

Deploying mopro with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a3b3fd
Status: ✅  Deploy successful!
Preview URL: https://9a93372d.mopro.pages.dev
Branch Preview URL: https://feat-circom-prover-remove-ar.mopro.pages.dev

View logs

@KimiWu123 KimiWu123 force-pushed the feat/circom-prover-remove-ark-circom-dep branch 13 times, most recently from bb2dfe9 to 66f5726 Compare February 4, 2025 08:44
@KimiWu123 KimiWu123 force-pushed the feat/circom-prover-remove-ark-circom-dep branch from 66f5726 to 3349a3f Compare February 4, 2025 09:05
@KimiWu123 KimiWu123 marked this pull request as ready for review February 4, 2025 09:10
@KimiWu123 KimiWu123 requested a review from vivianjeng February 4, 2025 09:30
@@ -39,40 +36,13 @@ pub fn deserialize_inputs<T: Pairing>(data: Vec<u8>) -> SerializableInputs<T> {
SerializableInputs::deserialize_uncompressed(&mut &data[..]).expect("Deserialization failed")
}

// Convert proof to U256-tuples as expected by the Solidity Groth16 Verifier
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two functions were moved to mopro-ffi/circom

@KimiWu123 KimiWu123 force-pushed the feat/circom-prover-remove-ark-circom-dep branch from 829b44a to a67411f Compare February 5, 2025 02:44
@KimiWu123
Copy link
Collaborator Author

@vivianjeng , this PR is ready for review!

I decided to keep serialization functions in circom-prover because I think it's easier to pass native types (Vec<u8>) cross modules, don't need to handle generic types (Proof<T: Pairing>).

Comment on lines 129 to 132
use circom_prover::{
prover::{CircomProof, ProofLib},
witness::WitnessFn,
ProofCalldata, G1, G2,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove all these exports?

        use circom_prover::{
            prover::{CircomProof, ProofLib},
            witness::WitnessFn,
            ProofCalldata, G1, G2,
        };

It is not related to the UDL file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, but we still need to keep WitnessFn. It is used in test-e2e/src/lib.rs, like the following,

mopro_ffi::set_circom_circuits! {
    ("multiplier2_final.zkey", WitnessFn::RustWitness(multiplier2_witness))
}

fixed in 7d42ac1

Copy link
Collaborator

@vivianjeng vivianjeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

ProofCalldata, G1, G2,
};
use mopro_ffi::{GenerateProofResult, MoproError};
use circom_prover::witness::WitnessFn;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still concern about the import
but we can fix this by this issue
if the circom feature is disabled

circom = [
"circom-prover",

Apps will not find the circom_prover dependency

but it can be fixed by this issue
#306

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I didn't think about that. I submitted d3234fb to fix this. The downside of this solution is caller (test-e2e needs to define circom feature in toml file). The other solution is to implement an empty struct like circom_app! and halo2_app!.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vivianjeng , I just realized, our current implementation also has this issue. For example, if we disable circom feature, it wll cause an error that set_circom_circuits can't be found. So, I think it's a good idea to address this issue in #306 as you mentioned.

@KimiWu123 KimiWu123 force-pushed the feat/circom-prover-remove-ark-circom-dep branch from d3234fb to 9a3b3fd Compare February 6, 2025 03:26
@KimiWu123 KimiWu123 merged commit 0b53402 into main Feb 6, 2025
33 checks passed
@vivianjeng vivianjeng mentioned this pull request Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants