Skip to content

Commit

Permalink
Dependency refactor (#110)
Browse files Browse the repository at this point in the history
closes: #109 

- Remove `jf-rescue` crate, rescue hash function now resides in `jf-primitives/rescue`.
- Plonk constraint system definition and concrete constructions now live in a standalone crate `jf-relation`.
    - Basic and customized circuit gates are defined in `jf-relation`.
    - Customized/advanced circuit implementations are located in their own crates.
        - Plonk verifier related gadgets, `transcript` and `plonk-verifier` are now in `jf-plonk/circuit`.
        - Primitive gadgets, including `commitment`, `el gamal` etc. remains in `jf-primitives/circuit`.
        - Circuit for rescue hash function is now in `jf-primitives/circuit/rescue`.
- `par-utils` is moved to `jf-utils`.
- New dependency graph
    - `jf-relation` depends on `jf-utils`.
    - `jf-primitives` depends on `jf-relation` and `jf-utils`.
    - `jf-plonk` depends on all other crates.
  • Loading branch information
mrain authored Aug 24, 2022
1 parent 535e190 commit f74a685
Show file tree
Hide file tree
Showing 80 changed files with 2,914 additions and 2,791 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
- Introduce `struct BoolVar` whenever necessary and possible (#91)
- Introduce comparison gates (#81)
- More general input to `deserialize_canonical_bytes!()` (#108)
- Codebase refactor (#110)
- Remove `jf-rescue` crate, rescue hash function now resides in `jf-primitives/rescue`.
- Plonk constraint system definition and concrete constructions now live in a standalone crate `jf-relation`.
- Basic and customized circuit gates are defined in `jf-relation`.
- Customized/advanced circuit implementations are located in their own crates.
- Plonk verifier related gadgets, `transcript` and `plonk-verifier` are now in `jf-plonk/circuit`.
- Primitive gadgets, including `commitment`, `el gamal` etc. remains in `jf-primitives/circuit`.
- Circuit for rescue hash function is now in `jf-primitives/circuit/rescue`.
- `par-utils` is moved to `jf-utils`.

## v0.1.2

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
members = [
"plonk",
"rescue",
"relation",
"primitives",
"utilities",
"utilities_derive",
Expand Down
10 changes: 7 additions & 3 deletions plonk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ license = "MIT"

[dependencies]
jf-utils = { path = "../utilities" }
jf-rescue = { path = "../rescue" }
jf-relation = { path = "../relation", default-features = false }
jf-primitives = { path = "../primitives", default-features = false }

ark-std = { version = "0.3.0", default-features = false }
ark-serialize = "0.3.0"
Expand All @@ -27,7 +28,7 @@ downcast-rs = { version = "1.2.0", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"] }
displaydoc = { version = "0.2.3", default-features = false }
derivative = { version = "2", features = ["use_core"] }
num-bigint = { version = "0.4", default-features = false}
num-bigint = { version = "0.4", default-features = false }
rand_chacha = { version = "0.3.1" }
sha3 = "^0.10"
espresso-systems-common = { git = "https://github.com/espressosystems/espresso-systems-common", branch = "main" }
Expand All @@ -46,6 +47,7 @@ ark-ed-on-bls12-377 = { git = "https://github.com/arkworks-rs/curves", rev = "67
ark-ed-on-bls12-381-bandersnatch = { git = "https://github.com/arkworks-rs/curves", rev = "677b4ae751a274037880ede86e9b6f30f62635af" }
ark-ed-on-bn254 = "0.3.0"
hex = "^0.4.3"
jf-relation = { path = "../relation", default-features = false }

# Benchmarks
[[bench]]
Expand All @@ -57,4 +59,6 @@ harness = false
default = [ "parallel" ]
std = [ "ark-std/std", "ark-serialize/std", "ark-ff/std", "ark-ec/std", "ark-poly/std"]
test_apis = [] # exposing apis for testing purpose
parallel = [ "ark-ff/parallel", "ark-ec/parallel", "ark-poly/parallel", "rayon" ]
parallel = [ "ark-ff/parallel", "ark-ec/parallel", "ark-poly/parallel",
"jf-utils/parallel", "jf-relation/parallel", "jf-primitives/parallel",
"rayon" ]
2 changes: 1 addition & 1 deletion plonk/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ use ark_bn254::{Bn254, Fr as Fr254};
use ark_bw6_761::{Fr as Fr761, BW6_761};
use ark_ff::PrimeField;
use jf_plonk::{
circuit::{Circuit, PlonkCircuit},
errors::PlonkError,
proof_system::{PlonkKzgSnark, UniversalSNARK},
transcript::StandardTranscript,
PlonkType,
};
use jf_relation::{Circuit, PlonkCircuit};
use std::time::Instant;

const NUM_REPETITIONS: usize = 10;
Expand Down
4 changes: 2 additions & 2 deletions plonk/examples/proof_of_exp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use ark_ed_on_bls12_381::{EdwardsAffine, EdwardsParameters, Fr};
use ark_ff::PrimeField;
use ark_std::{rand::SeedableRng, UniformRand};
use jf_plonk::{
circuit::{customized::ecc::Point, Arithmetization, Circuit, PlonkCircuit},
errors::PlonkError,
proof_system::{PlonkKzgSnark, UniversalSNARK},
transcript::StandardTranscript,
};
use jf_relation::{gadgets::ecc::Point, Arithmetization, Circuit, PlonkCircuit};
use jf_utils::fr_to_fq;
use rand_chacha::ChaCha20Rng;

Expand Down Expand Up @@ -128,7 +128,7 @@ where
// Step 3:
// Connect the wires.
let X_var_computed = circuit.variable_base_scalar_mul::<EmbedCurve>(x_var, &G_var)?;
circuit.point_equal_gate(&X_var_computed, &X_var)?;
circuit.enforce_point_equal(&X_var_computed, &X_var)?;

// Sanity check: the circuit must be satisfied.
assert!(circuit
Expand Down
Loading

0 comments on commit f74a685

Please sign in to comment.