mirror of
https://github.com/vacp2p/zerokit.git
synced 2025-02-22 19:28:27 +00:00
fix(rln): cargo fix
This commit is contained in:
parent
6d3571034d
commit
967315bc26
@ -28,7 +28,7 @@ pub fn ZKEY() -> ProvingKey<Bn254> /*, ConstraintMatrices<Fr>)*/ {
|
||||
}
|
||||
|
||||
pub fn VK() -> VerifyingKey<Bn254> {
|
||||
let mut verifyingKey: VerifyingKey<Bn254>;
|
||||
let verifyingKey: VerifyingKey<Bn254>;
|
||||
|
||||
if Path::new(VK_PATH).exists() {
|
||||
let verifyingKey = vk_from_json(VK_PATH);
|
||||
@ -46,7 +46,7 @@ pub fn CIRCOM() -> CircomBuilder<Bn254> {
|
||||
let cfg = CircomConfig::<Bn254>::new(WASM_PATH, R1CS_PATH).unwrap(); // should be )?; but need to address "the trait `From<ErrReport>` is not implemented for `protocol::ProofError`"
|
||||
|
||||
// We build the circuit
|
||||
let mut builder = CircomBuilder::new(cfg);
|
||||
let builder = CircomBuilder::new(cfg);
|
||||
|
||||
builder
|
||||
}
|
||||
@ -127,7 +127,7 @@ fn vk_from_json(vk_path: &str) -> VerifyingKey<Bn254> {
|
||||
let json = std::fs::read_to_string(vk_path).unwrap();
|
||||
let json: Value = serde_json::from_str(&json).unwrap();
|
||||
|
||||
let mut vk = VerifyingKey {
|
||||
let vk = VerifyingKey {
|
||||
alpha_g1: json_to_g1(&json, "vk_alpha_1"),
|
||||
beta_g2: json_to_g2(&json, "vk_beta_2"),
|
||||
gamma_g2: json_to_g2(&json, "vk_gamma_2"),
|
||||
|
@ -119,7 +119,7 @@ mod test {
|
||||
// We generate all relevant keys
|
||||
let provingKey = &ZKEY();
|
||||
let verificationKey = &VK();
|
||||
let mut builder = CIRCOM();
|
||||
let builder = CIRCOM();
|
||||
|
||||
// Let's generate a zkSNARK proof
|
||||
let (proof, inputs) = generate_proof(builder, provingKey, rlnWitness).unwrap();
|
||||
|
@ -1,19 +1,16 @@
|
||||
/// This is basic entry point for `cargo run` to play around with proof,
|
||||
/// outputs, etc.
|
||||
///
|
||||
use ark_circom::{CircomBuilder, CircomConfig};
|
||||
use ark_std::rand::thread_rng;
|
||||
|
||||
|
||||
use color_eyre::Result;
|
||||
|
||||
use ark_bn254::Bn254;
|
||||
use num_bigint::BigInt;
|
||||
|
||||
|
||||
|
||||
// Tracing
|
||||
use ark_relations::r1cs::{ConstraintLayer, ConstraintTrace, TracingMode};
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
|
||||
// JSON
|
||||
use serde::Deserialize;
|
||||
|
||||
|
||||
use rln::circuit::{CIRCOM, VK, ZKEY};
|
||||
use rln::protocol::{generate_proof, initRLNWitnessFromJSON, verify_proof};
|
||||
@ -77,7 +74,7 @@ fn groth16_proof_example() -> Result<()> {
|
||||
// We generate all relevant keys
|
||||
let provingKey = &ZKEY();
|
||||
let verificationKey = &VK();
|
||||
let mut builder = CIRCOM();
|
||||
let builder = CIRCOM();
|
||||
|
||||
// We compute witness from the json input example
|
||||
let rlnWitness = initRLNWitnessFromJSON(input_json_str);
|
||||
|
@ -58,7 +58,7 @@ impl RLN {
|
||||
let cfg =
|
||||
CircomConfig::<Bn254>::new("./resources/rln.wasm", "./resources/rln.r1cs").unwrap();
|
||||
|
||||
let mut builder = CircomBuilder::new(cfg);
|
||||
let builder = CircomBuilder::new(cfg);
|
||||
|
||||
// create an empty instance for setting it up
|
||||
let circom = builder.setup();
|
||||
@ -72,7 +72,7 @@ impl RLN {
|
||||
println!("Public inputs {:#?} ", inputs);
|
||||
|
||||
let leaf = Field::from(0);
|
||||
let mut tree = PoseidonTree::new(21, leaf);
|
||||
let tree = PoseidonTree::new(21, leaf);
|
||||
|
||||
RLN {
|
||||
circom,
|
||||
@ -197,7 +197,7 @@ impl RLN {
|
||||
// let tree = IncrementalMerkleTree::empty(hasher, merkle_depth);
|
||||
|
||||
let leaf = Field::from(0);
|
||||
let mut tree = PoseidonTree::new(21, leaf);
|
||||
let tree = PoseidonTree::new(21, leaf);
|
||||
|
||||
RLN {
|
||||
circom,
|
||||
@ -208,7 +208,7 @@ impl RLN {
|
||||
|
||||
/// returns current membership root
|
||||
/// * `root` is a scalar field element in 32 bytes
|
||||
pub fn get_root<W: Write>(&self, mut result_data: W) -> io::Result<()> {
|
||||
pub fn get_root<W: Write>(&self, _result_data: W) -> io::Result<()> {
|
||||
//let root = self.tree.get_root();
|
||||
// Converts PrimeFieldRepr into LE
|
||||
//root.into_repr().write_le(&mut result_data)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user