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

Upgrade to v0.4.0 #30

Merged
merged 23 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

### Bug fixes

## v0.4.0

- Change dependency to version `0.4.0` of other arkwork-rs crates.

## v0.3.0

- Change dependency to version `0.3.0` of other arkworks-rs crates.
Expand Down
34 changes: 17 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ark-gm17"
version = "0.3.0"
version = "0.4.0"
authors = [ "arkworks contributors" ]
description = "An implementation of the Groth-Maller 2017 zkSNARK proof system"
homepage = "https://arkworks.rs"
Expand All @@ -10,19 +10,19 @@ keywords = [ "zero-knowledge", "cryptography", "zkSNARK", "SNARK", "Groth-Maller
categories = [ "cryptography" ]
include = ["Cargo.toml", "src", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
license = "MIT/Apache-2.0"
edition = "2018"
edition = "2021"

################################# Dependencies ################################

[dependencies]
ark-ff = { version = "^0.3.0", default-features = false }
ark-ec = { version = "^0.3.0", default-features = false }
ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ] }
ark-poly = { version = "^0.3.0", default-features = false }
ark-std = { version = "^0.3.0", default-features = false }
ark-relations = { version = "^0.3.0", default-features = false }
ark-crypto-primitives = { version = "^0.3.0", default-features = false }
ark-r1cs-std = { version = "^0.3.0", default-features = false, optional = true }
ark-ff = { version = "^0.4.0", default-features = false }
ark-ec = { version = "^0.4.0", default-features = false }
ark-serialize = { version = "^0.4.0", default-features = false, features = [ "derive" ] }
ark-poly = { version = "^0.4.0", default-features = false }
ark-std = { version = "^0.4.0", default-features = false }
ark-relations = { version = "^0.4.0", default-features = false }
ark-crypto-primitives = { version = "^0.4.0", features = ["snark"], default-features = false }
ark-r1cs-std = { version = "^0.4.0", default-features = false, optional = true }

tracing = { version = "0.1", default-features = false, features = [ "attributes" ], optional = true }
derivative = { version = "2.0", features = ["use_core"], optional = true }
Expand All @@ -31,13 +31,13 @@ rayon = { version = "1", optional = true }

[dev-dependencies]
csv = { version = "1" }
ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] }
ark-bls12-377 = { version = "^0.3.0", default-features = false, features = ["curve"] }
ark-cp6-782 = { version = "^0.3.0", default-features = false }
ark-mnt4-298 = { version = "^0.3.0", default-features = false, features = ["r1cs", "curve"] }
ark-mnt6-298 = { version = "^0.3.0", default-features = false, features = ["r1cs"] }
ark-mnt4-753 = { version = "^0.3.0", default-features = false, features = ["r1cs", "curve"] }
ark-mnt6-753 = { version = "^0.3.0", default-features = false, features = ["r1cs"] }
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = ["curve"] }
ark-bls12-377 = { version = "^0.4.0", default-features = false, features = ["curve"] }
ark-cp6-782 = { version = "^0.4.0", default-features = false }
ark-mnt4-298 = { version = "^0.4.0", default-features = false, features = ["r1cs", "curve"] }
ark-mnt6-298 = { version = "^0.4.0", default-features = false, features = ["r1cs"] }
ark-mnt4-753 = { version = "^0.4.0", default-features = false, features = ["r1cs", "curve"] }
ark-mnt6-753 = { version = "^0.4.0", default-features = false, features = ["r1cs"] }

[features]
default = ["parallel"]
Expand Down
36 changes: 21 additions & 15 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// For benchmark, run:
// RAYON_NUM_THREADS=N cargo bench --no-default-features --features "std parallel" -- --nocapture
// where N is the number of threads you want to use (N = 1 for single-thread).
// RAYON_NUM_THREADS=N cargo bench --no-default-features --features "std
// parallel" -- --nocapture where N is the number of threads you want to use (N
// = 1 for single-thread).

use ark_bls12_381::{Bls12_381, Fr as BlsFr};
use ark_crypto_primitives::SNARK;
use ark_crypto_primitives::snark::SNARK;
use ark_ff::PrimeField;
use ark_gm17::GM17;
use ark_mnt4_298::{Fr as MNT4Fr, MNT4_298};
Expand All @@ -14,8 +15,11 @@ use ark_relations::{
lc,
r1cs::{ConstraintSynthesizer, ConstraintSystemRef, SynthesisError},
};
use ark_std::ops::Mul;
use ark_std::UniformRand;
use ark_std::{
ops::Mul,
rand::{rngs, Rng, SeedableRng},
UniformRand,
};

const NUM_PROVE_REPEATITIONS: usize = 10;
const NUM_VERIFY_REPEATITIONS: usize = 50;
Expand Down Expand Up @@ -66,20 +70,21 @@ impl<F: PrimeField> ConstraintSynthesizer<F> for DummyCircuit<F> {

macro_rules! gm17_prove_bench {
($bench_name:ident, $bench_field:ty, $bench_pairing_engine:ty) => {
let rng = &mut ark_std::test_rng();
let mut _rng = ark_std::test_rng();
let mut rng = rngs::StdRng::from_seed(_rng.gen());
let c = DummyCircuit::<$bench_field> {
a: Some(<$bench_field>::rand(rng)),
b: Some(<$bench_field>::rand(rng)),
a: Some(<$bench_field>::rand(&mut rng)),
b: Some(<$bench_field>::rand(&mut rng)),
num_variables: 10,
num_constraints: 65536,
};

let (pk, _) = GM17::<$bench_pairing_engine>::circuit_specific_setup(c, rng).unwrap();
let (pk, _) = GM17::<$bench_pairing_engine>::circuit_specific_setup(c, &mut rng).unwrap();

let start = ark_std::time::Instant::now();

for _ in 0..NUM_PROVE_REPEATITIONS {
let _ = GM17::<$bench_pairing_engine>::prove(&pk, c.clone(), rng).unwrap();
let _ = GM17::<$bench_pairing_engine>::prove(&pk, c.clone(), &mut rng).unwrap();
}

println!(
Expand All @@ -92,16 +97,17 @@ macro_rules! gm17_prove_bench {

macro_rules! gm17_verify_bench {
($bench_name:ident, $bench_field:ty, $bench_pairing_engine:ty) => {
let rng = &mut ark_std::test_rng();
let mut _rng = ark_std::test_rng();
let mut rng = rngs::StdRng::from_seed(_rng.gen());
let c = DummyCircuit::<$bench_field> {
a: Some(<$bench_field>::rand(rng)),
b: Some(<$bench_field>::rand(rng)),
a: Some(<$bench_field>::rand(&mut rng)),
b: Some(<$bench_field>::rand(&mut rng)),
num_variables: 10,
num_constraints: 65536,
};

let (pk, vk) = GM17::<$bench_pairing_engine>::circuit_specific_setup(c, rng).unwrap();
let proof = GM17::<$bench_pairing_engine>::prove(&pk, c.clone(), rng).unwrap();
let (pk, vk) = GM17::<$bench_pairing_engine>::circuit_specific_setup(c, &mut rng).unwrap();
let proof = GM17::<$bench_pairing_engine>::prove(&pk, c.clone(), &mut rng).unwrap();

let v = c.a.unwrap().mul(c.b.unwrap());

Expand Down
1 change: 0 additions & 1 deletion examples/recursive-snark/gm17.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
unused_must_use,
unused_mut,
unused_unsafe,
private_in_public,
unsafe_code
)]

Expand Down
8 changes: 1 addition & 7 deletions examples/snark-scalability/gm17.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
unused_allocation,
unused_comparisons
)]
#![deny(
unused_must_use,
unused_mut,
unused_unsafe,
private_in_public,
unsafe_code
)]
#![deny(unused_must_use, unused_mut, unused_unsafe, unsafe_code)]

use csv;

Expand Down
Loading
Loading