mirror of https://github.com/vacp2p/zerokit.git
Parse and print JSON WitnessInput
This commit is contained in:
parent
e197f285ea
commit
7c856fd1b1
|
@ -38,3 +38,7 @@ color-eyre = "0.5"
|
|||
# tracing
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.2"
|
||||
|
||||
# json
|
||||
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
|
||||
serde_json = "1.0.48"
|
||||
|
|
|
@ -12,6 +12,23 @@ use tracing::{span, event, Level};
|
|||
use ark_relations::r1cs::{ConstraintTrace, ConstraintLayer, ConstraintSystem, TracingMode};
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
|
||||
// JSON
|
||||
use serde::Deserialize;
|
||||
use serde_json;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WitnessInput {
|
||||
root: String,
|
||||
nullifier_hash: String,
|
||||
recipient: String,
|
||||
relayer: String,
|
||||
//fee: String,
|
||||
fee: i32,
|
||||
nullifier: String,
|
||||
path_elements: Vec<String>,
|
||||
path_indices: Vec<i32>,
|
||||
}
|
||||
|
||||
fn groth16_proof_example() -> Result<()> {
|
||||
println!("Circom 1");
|
||||
|
@ -68,6 +85,10 @@ fn groth16_proof_example() -> Result<()> {
|
|||
"pathIndices":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}
|
||||
"#;
|
||||
|
||||
let witness : WitnessInput = serde_json::from_str(input_json_str).expect("JSON was not well-formatted");
|
||||
|
||||
println!("JSON: {:?}", witness);
|
||||
|
||||
println!("Circom 3");
|
||||
// XXX Here - probably is inputs don't match,
|
||||
// but would like the tracing to tell me this
|
||||
|
|
Loading…
Reference in New Issue