chore: trim deps

This commit is contained in:
Georgios Konstantopoulos 2021-07-26 18:13:46 +03:00
parent be99d3a1fd
commit c03ae8490f
3 changed files with 54 additions and 19 deletions

View File

@ -5,34 +5,34 @@ edition = "2018"
[dependencies]
# WASM operations
wasmer = "1.0.1"
fnv = "1.0.3"
num-traits = "0.2.0"
num-bigint = { version = "0.4", features = ["rand"] }
color-eyre = "0.5"
wasmer = { version = "2.0" }
fnv = { version = "1.0.3", default-features = false }
num-traits = { version = "0.2.0", default-features = false }
num-bigint = { version = "0.4", default-features = false, features = ["rand"] }
# ZKP Generation
ark-ec = "0.3.0"
ark-ff = "0.3.0"
ark-std = "0.3.0"
ark-bn254 = "0.3.0"
ark-r1cs-std = "0.3.1"
ark-ec = { version = "0.3.0", default-features = false }
ark-ff = { version = "0.3.0", default-features = false }
ark-std = { version = "0.3.0", default-features = false }
ark-bn254 = { version = "0.3.0" }
ark-groth16 = { git = "https://github.com/kobigurk/groth16", version = "0.3.0", branch = "feat/customizable-r1cs-to-qap" }
ark-poly = { version = "^0.3.0", default-features = false }
ark-relations = "0.3.0"
ark-relations = { version = "0.3.0", default-features = false }
ark-serialize = { version = "0.3.0", default-features = false }
# decoding of data
hex = "0.4.3"
byteorder = "1.4.3"
ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["abigen"] }
serde_json = "1.0.64"
serde = "1.0.126"
# ethereum compat
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
# error handling
thiserror = "1.0.26"
ark-serialize = "0.3.0"
color-eyre = "0.5"
[dev-dependencies]
hex-literal = "0.2.1"
tokio = { version = "1.7.1", features = ["macros"] }
serde_json = "1.0.64"
ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["abigen"] }

View File

@ -16,6 +16,41 @@ Clone the repository and run `cd ark-circom/ && cargo doc --open`
ark-circom = { git = "https://github.com/gakonst/ark-circom-rs" }
```
## Example
```rust
// Load the WASM and R1CS for witness and proof generation
let cfg = CircomConfig::<Bn254>::new(
"./test-vectors/mycircuit.wasm",
"./test-vectors/mycircuit.r1cs",
)?;
// Insert our public inputs as key value pairs
let mut builder = CircomBuilder::new(cfg);
builder.push_input("a", 3);
builder.push_input("b", 11);
// Create an empty instance for setting it up
let circom = builder.setup();
// Run a trusted setup
let mut rng = thread_rng();
let params = generate_random_parameters::<Bn254, _, _>(circom, &mut rng)?;
// Get the populated instance of the circuit with the witness
let circom = builder.build()?;
let inputs = circom.get_public_inputs().unwrap();
// Generate the proof
let proof = prove(circom, &params, &mut rng)?;
// Check that the proof is valid
let pvk = prepare_verifying_key(&params.vk);
let verified = verify_proof(&pvk, &proof, &inputs)?;
assert!(verified);
```
## Running the tests
Tests require the following installed:

View File

@ -1,7 +1,7 @@
//! Helpers for converting Arkworks types to U256-tuples as expected by the
//! Solidity Groth16 Verifier smart contracts
use ark_ff::{BigInteger, FromBytes, PrimeField};
use ethers::types::U256;
use ethers_core::types::U256;
use ark_bn254::{Bn254, Fq2, Fr, G1Affine, G2Affine};