Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ron committed Jun 20, 2019
1 parent 82a1990 commit 226dc0f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
use bulletproofs::r1cs::{zkinterface_backend, R1CSProof};
use wasm_bindgen::prelude::wasm_bindgen;
use zkinterface::reading::Messages;
use bulletproofs::r1cs::{
R1CSProof,
zkinterface_backend,
};


/// Prove using the circuit and the witness.
#[wasm_bindgen]
Expand All @@ -18,7 +14,6 @@ pub fn prove(circuit: &[u8], witness: &[u8]) -> Vec<u8> {
bincode::serialize(&proof).unwrap()
}


/// Verify using the circuit and the proof.
#[wasm_bindgen]
pub fn verify(circuit: &[u8], inputs: &[u8], proof_ser: &[u8]) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions zkif-wasm-bundles/zkif-wasm-bulletproofs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use wasm_bindgen::prelude::*;
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen]
extern {
extern "C" {
#[wasm_bindgen(js_namespace = console)]
fn error(msg: String);
#[wasm_bindgen(js_namespace = console)]
Expand All @@ -19,5 +19,5 @@ extern {
#[wasm_bindgen(start)]
pub fn start() {
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
console_error_panic_hook::set_once();
}
5 changes: 2 additions & 3 deletions zkif-wasm-bundles/zkif-wasm-example/src/frontend.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use wasm_bindgen::prelude::wasm_bindgen;
use zkinterface::{
examples::{example_circuit_inputs, write_example_constraints, write_example_witness_inputs},
use zkinterface::examples::{
example_circuit_inputs, write_example_constraints, write_example_witness_inputs,
};

/// Generate a test circuit constraints.
Expand All @@ -15,7 +15,6 @@ pub fn make_circuit(x: u32, y: u32, zz: u32) -> Vec<u8> {
msg
}


/// Generate a witness.
#[wasm_bindgen]
pub fn make_witness(x: u32, y: u32) -> Vec<u8> {
Expand Down
4 changes: 2 additions & 2 deletions zkif-wasm-bundles/zkif-wasm-example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use wasm_bindgen::prelude::*;
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen]
extern {
extern "C" {
#[wasm_bindgen(js_namespace = console)]
fn error(msg: String);
#[wasm_bindgen(js_namespace = console)]
Expand All @@ -19,5 +19,5 @@ extern {
#[wasm_bindgen(start)]
pub fn start() {
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
console_error_panic_hook::set_once();
}
14 changes: 8 additions & 6 deletions zkif-wasm-bundles/zkif-wasm-zokrates/src/frontend.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use wasm_bindgen::prelude::{JsValue, wasm_bindgen};
use wasm_bindgen::prelude::{wasm_bindgen, JsValue};
use zkinterface::{
reading::{Messages, split_messages},
reading::{split_messages, Messages},
zkinterface_generated::zkinterface::get_size_prefixed_root_as_root,
};
use zokrates_core::{
Expand All @@ -11,10 +11,8 @@ use zokrates_core::{
};
use zokrates_field::field::FieldPrime;


fn compile_prog(code: &str) -> Prog<FieldPrime> {
compile::<FieldPrime, &[u8], &[u8], std::io::Error>(
&mut code.as_bytes(), None, None).unwrap()
compile::<FieldPrime, &[u8], &[u8], std::io::Error>(&mut code.as_bytes(), None, None).unwrap()
}

/// Generate a constraint system.
Expand Down Expand Up @@ -42,7 +40,11 @@ pub fn make_witness(code: &str, x: u32, y: u32) -> JsValue /* Instance */ {

let verifier_msg = get_verifier_msg(&prover_msg).unwrap();

JsValue::from_serde(&Instance { prover_msg, verifier_msg }).unwrap()
JsValue::from_serde(&Instance {
prover_msg,
verifier_msg,
})
.unwrap()
}

#[derive(Serialize)]
Expand Down
4 changes: 2 additions & 2 deletions zkif-wasm-bundles/zkif-wasm-zokrates/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extern crate serde_derive;
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen]
extern {
extern "C" {
#[wasm_bindgen(js_namespace = console)]
fn error(msg: String);
#[wasm_bindgen(js_namespace = console)]
Expand All @@ -22,5 +22,5 @@ extern {
#[wasm_bindgen(start)]
pub fn start() {
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
console_error_panic_hook::set_once();
}

0 comments on commit 226dc0f

Please sign in to comment.