From 7bea9e83a03c514d6518099cc857cf0fe0231d13 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Mon, 11 Dec 2023 16:20:41 -0700 Subject: [PATCH] refactor --- src/storage_proofs.rs | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/storage_proofs.rs b/src/storage_proofs.rs index 9f5b8f6..a2bc9fe 100644 --- a/src/storage_proofs.rs +++ b/src/storage_proofs.rs @@ -50,45 +50,45 @@ impl StorageProofs { } } - pub fn prove( - &mut self, - chunks: &[U256], - siblings: &[U256], - hashes: &[U256], - path: &[i32], - root: U256, - salt: U256, - proof_bytes: &mut Vec, - public_inputs_bytes: &mut Vec, - ) -> Result<(), String> { - let mut builder = self.builder.clone(); + // pub fn prove( + // &mut self, + // chunks: &[U256], + // siblings: &[U256], + // hashes: &[U256], + // path: &[i32], + // root: U256, + // salt: U256, + // proof_bytes: &mut Vec, + // public_inputs_bytes: &mut Vec, + // ) -> Result<(), String> { + // let mut builder = self.builder.clone(); - // vec of vecs is flattened, since wasm expects a contiguous array in memory - chunks.iter().for_each(|c| builder.push_input("chunks", *c)); + // // vec of vecs is flattened, since wasm expects a contiguous array in memory + // chunks.iter().for_each(|c| builder.push_input("chunks", *c)); - siblings - .iter() - .for_each(|c| builder.push_input("siblings", *c)); + // siblings + // .iter() + // .for_each(|c| builder.push_input("siblings", *c)); - hashes.iter().for_each(|c| builder.push_input("hashes", *c)); - path.iter().for_each(|c| builder.push_input("path", *c)); + // hashes.iter().for_each(|c| builder.push_input("hashes", *c)); + // path.iter().for_each(|c| builder.push_input("path", *c)); - builder.push_input("root", root); - builder.push_input("salt", salt); + // builder.push_input("root", root); + // builder.push_input("salt", salt); - let circuit = builder.build().map_err(|e| e.to_string())?; - let inputs = circuit - .get_public_inputs() - .ok_or("Unable to get public inputs!")?; - let proof = prove(circuit, &self.params, &mut self.rng).map_err(|e| e.to_string())?; + // let circuit = builder.build().map_err(|e| e.to_string())?; + // let inputs = circuit + // .get_public_inputs() + // .ok_or("Unable to get public inputs!")?; + // let proof = prove(circuit, &self.params, &mut self.rng).map_err(|e| e.to_string())?; - proof.serialize(proof_bytes).map_err(|e| e.to_string())?; - inputs - .serialize(public_inputs_bytes) - .map_err(|e| e.to_string())?; + // proof.serialize(proof_bytes).map_err(|e| e.to_string())?; + // inputs + // .serialize(public_inputs_bytes) + // .map_err(|e| e.to_string())?; - Ok(()) - } + // Ok(()) + // } pub fn prove_run( &mut self, @@ -188,7 +188,7 @@ fn parse_mpack_args(builder: &mut CircomBuilder, mut inputs: &[u8]) // ie, "path" => "/some/file/path" rmpv::Value::String(s) => { let s = s.clone().into_bytes(); - s.iter().for_each(|c| builder.push_input(name, *c)); + s.iter().for_each(|c| builder.push_input(name, (*c) as i32)); } // directly add a (name,u256) arg pair rmpv::Value::Ext(_, _) => {