From 32cb2ac29e292cd84a27d6e0998929a061960af8 Mon Sep 17 00:00:00 2001 From: Zhang Junyu Date: Mon, 9 Oct 2023 15:29:35 +0800 Subject: [PATCH] fix wasm_output --- crates/cli/src/app_builder.rs | 8 +++----- crates/zkwasm/src/runtime/wasmi_interpreter.rs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/cli/src/app_builder.rs b/crates/cli/src/app_builder.rs index ed028b6b4..ba042935e 100644 --- a/crates/cli/src/app_builder.rs +++ b/crates/cli/src/app_builder.rs @@ -4,11 +4,9 @@ use clap::AppSettings; use delphinus_zkwasm::circuits::config::MIN_K; use log::info; use log::warn; -use std::cell::RefCell; use std::fs; use std::io::Write; use std::path::PathBuf; -use std::rc::Rc; use std::sync::Arc; use std::sync::Mutex; @@ -136,7 +134,7 @@ pub trait AppBuilder: CommandBuilder { } else { assert!(public_inputs.len() <= Self::MAX_PUBLIC_INPUT_SIZE); - let context_output = Rc::new(RefCell::new(vec![])); + let context_output = Arc::new(Mutex::new(vec![])); exec_dry_run( zkwasm_k, @@ -145,10 +143,10 @@ pub trait AppBuilder: CommandBuilder { public_inputs, private_inputs, context_in, - Arc::new(Mutex::new(vec![])), + context_output.clone(), )?; - write_context_output(&context_output.borrow(), context_out_path)?; + write_context_output(&context_output.lock().unwrap(), context_out_path)?; Ok(()) } diff --git a/crates/zkwasm/src/runtime/wasmi_interpreter.rs b/crates/zkwasm/src/runtime/wasmi_interpreter.rs index e51ee1df9..937c6f176 100644 --- a/crates/zkwasm/src/runtime/wasmi_interpreter.rs +++ b/crates/zkwasm/src/runtime/wasmi_interpreter.rs @@ -96,7 +96,7 @@ impl Execution }, result, public_inputs_and_outputs: wasm_io.public_inputs_and_outputs.borrow().clone(), - outputs: wasm_io.public_inputs_and_outputs.borrow().clone(), + outputs: wasm_io.outputs.borrow().clone(), }) } }