From b998be6bc922d4d25dd68b102ebaea87d9ca76d8 Mon Sep 17 00:00:00 2001 From: Stephen <81497928+eigmax@users.noreply.github.com> Date: Sat, 28 Oct 2023 19:17:22 +0800 Subject: [PATCH] feat: wrap g16 api (#145) * chore: change curve naming to uppercase format (#142) * feat: move api from zkit to g16 --------- Co-authored-by: ibmp33 <51358300+ibmp33@users.noreply.github.com> --- zkit/src/groth16_api.rs => groth16/src/api.rs | 18 +++++++++--------- groth16/src/lib.rs | 1 + test/recursive_proof_to_snark.sh | 2 +- zkit/src/lib.rs | 1 - zkit/src/main.rs | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) rename zkit/src/groth16_api.rs => groth16/src/api.rs (99%) delete mode 100644 zkit/src/lib.rs diff --git a/zkit/src/groth16_api.rs b/groth16/src/api.rs similarity index 99% rename from zkit/src/groth16_api.rs rename to groth16/src/api.rs index ca4b106d..3f962e49 100644 --- a/zkit/src/groth16_api.rs +++ b/groth16/src/api.rs @@ -1,12 +1,4 @@ -use algebraic::{ - bellman_ce::Engine, - circom_circuit::CircomCircuit, - errors::{EigenError, Result}, - reader::load_r1cs, - witness::{load_input_for_witness, WitnessCalculator}, - Field, PrimeField, -}; -use groth16::{ +use crate::{ bellman_ce::{ groth16::{Parameters, Proof, VerifyingKey}, pairing::{ @@ -17,6 +9,14 @@ use groth16::{ groth16::Groth16, json_utils::*, }; +use algebraic::{ + bellman_ce::Engine, + circom_circuit::CircomCircuit, + errors::{EigenError, Result}, + reader::load_r1cs, + witness::{load_input_for_witness, WitnessCalculator}, + Field, PrimeField, +}; use num_traits::Zero; use rand; diff --git a/groth16/src/lib.rs b/groth16/src/lib.rs index 72718ffb..57dd3ad3 100644 --- a/groth16/src/lib.rs +++ b/groth16/src/lib.rs @@ -1,3 +1,4 @@ +pub mod api; pub mod groth16; pub mod json_utils; diff --git a/test/recursive_proof_to_snark.sh b/test/recursive_proof_to_snark.sh index 6f0fa5cd..950a2beb 100755 --- a/test/recursive_proof_to_snark.sh +++ b/test/recursive_proof_to_snark.sh @@ -68,7 +68,7 @@ if [ "$GENERATE_PROOF_TYPE" = "stark" ]; then ../target/release/eigen-zkit stark_prove -s ../starky/data/c12.starkStruct.json \ -p $WORKSPACE/$C12_VERIFIER.pil.json \ --o $WORKSPACE/$C12_VERIFIER.const \ - --m $WORKSPACE/$C12_VERIFIER.cm -c $WORKSPACE/circuits/$RECURSIVE1_VERIFIER.circom --i $WORKSPACE/aggregation/$RECURSIVE1_VERIFIER/input.zkin.json --norm_stage + --m $WORKSPACE/$C12_VERIFIER.cm -c $WORKSPACE/circuits/$RECURSIVE1_VERIFIER.circom --i $WORKSPACE/aggregation/$RECURSIVE1_VERIFIER/input.zkin.json --norm_stage --agg_stage else echo "Generate snark proof" diff --git a/zkit/src/lib.rs b/zkit/src/lib.rs deleted file mode 100644 index b8810be7..00000000 --- a/zkit/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod groth16_api; diff --git a/zkit/src/main.rs b/zkit/src/main.rs index 0dde7aef..fa39c408 100644 --- a/zkit/src/main.rs +++ b/zkit/src/main.rs @@ -1,7 +1,7 @@ extern crate clap; use clap::{command, Parser}; use dsl_compile::circom_compiler; -use eigen_zkit::groth16_api::*; +use groth16::api::*; use plonky::api::{ aggregation_check, aggregation_prove, aggregation_verify, analyse, calculate_witness, export_aggregation_verification_key, export_verification_key, generate_aggregation_verifier, @@ -297,7 +297,7 @@ pub struct Groth16ProveOpt { #[arg(long = "r1cs", required = true)] circuit_file: String, #[arg(short, required = true)] - wtns_file: String, + wasm_file: String, #[arg(short, required = true, default_value = "g16.zkey")] pk_file: String, #[arg(short, required = true)] @@ -484,7 +484,7 @@ fn main() { Command::Groth16Prove(args) => groth16_prove( &args.curve_type, &args.circuit_file, - &args.wtns_file, + &args.wasm_file, &args.pk_file, &args.input_file, &args.public_input_file,