From 3126210952501833456fe2ca7ae769722d420af8 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Mon, 11 Dec 2023 16:21:30 -0700 Subject: [PATCH] refactor --- src/storage_proofs.rs | 52 +++++++++---------------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/src/storage_proofs.rs b/src/storage_proofs.rs index a2bc9fe..32416cd 100644 --- a/src/storage_proofs.rs +++ b/src/storage_proofs.rs @@ -50,47 +50,7 @@ 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(); - - // // 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)); - - // 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); - - // 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())?; - - // Ok(()) - // } - - pub fn prove_run( + pub fn prove( &mut self, inputs: &[u8], proof_bytes: &mut Vec, @@ -99,6 +59,16 @@ impl StorageProofs { let mut builder: CircomBuilder = self.builder.clone(); parse_mpack_args(&mut builder, inputs)?; + // 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, let circuit: CircomCircuit = builder.build() .map_err(|e| e.to_string())?;