Skip to content

Commit

Permalink
fix playground code and fix cli dry run bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yymone committed Oct 9, 2023
1 parent 0153507 commit 29f23ea
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions crates/cli/src/app_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,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,
Expand All @@ -148,7 +148,7 @@ pub trait AppBuilder: CommandBuilder {
Arc::new(Mutex::new(vec![])),
)?;

write_context_output(&context_output.borrow(), context_out_path)?;
write_context_output(&context_output.lock().unwrap(), context_out_path)?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/playground/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/playground/examples/binary_search.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Arc
use std::sync::Mutex;

use anyhow::Result;
use delphinus_zkwasm::loader::ExecutionArg;
Expand All @@ -15,7 +15,7 @@ fn main() -> Result<()> {
public_inputs: vec![0],
private_inputs: vec![],
context_inputs: vec![],
context_outputs: Rc::new(RefCell::new(vec![])),
context_outputs: Arc::new(Mutex::new(vec![])),
})?;
loader.mock_test(&circuit, &instances)
}
8 changes: 4 additions & 4 deletions crates/playground/examples/context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Arc;
use std::sync::Mutex;

use anyhow::Result;
use delphinus_zkwasm::loader::ExecutionArg;
Expand All @@ -10,7 +10,7 @@ fn main() -> Result<()> {
let wasm = std::fs::read("wasm/context.wasm")?;

let context_in: Vec<u64> = vec![2, 1];
let context_outputs = Rc::new(RefCell::new(vec![]));
let context_outputs = Arc::new(Mutex::new(vec![]));

let loader = ZkWasmLoader::<Bn256>::new(18, wasm, vec![])?;
let arg = ExecutionArg {
Expand All @@ -27,7 +27,7 @@ fn main() -> Result<()> {
public_inputs: vec![],
private_inputs: vec![],
context_inputs: context_outputs.borrow().to_vec(),
context_outputs: Rc::new(RefCell::new(vec![])),
context_outputs: Arc::new(Mutex::new(vec![])),
};

let (circuit, instances) = loader.circuit_with_witness(arg)?;
Expand Down
6 changes: 3 additions & 3 deletions crates/playground/examples/fibonacci.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Arc;
use std::sync::Mutex;

use anyhow::Result;
use delphinus_zkwasm::loader::ExecutionArg;
Expand All @@ -15,7 +15,7 @@ fn main() -> Result<()> {
public_inputs: vec![5],
private_inputs: vec![],
context_inputs: vec![],
context_outputs: Rc::new(RefCell::new(vec![])),
context_outputs: Arc::new(Mutex::new(vec![])),
})?;
loader.mock_test(&circuit, &instances)
}
6 changes: 3 additions & 3 deletions crates/playground/examples/phantom.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Arc;
use std::sync::Mutex;

use anyhow::Result;
use delphinus_zkwasm::loader::ExecutionArg;
Expand All @@ -19,7 +19,7 @@ fn main() -> Result<()> {
public_inputs: vec![2],
private_inputs: vec![],
context_inputs: vec![],
context_outputs: Rc::new(RefCell::new(vec![])),
context_outputs: Arc::new(Mutex::new(vec![])),
})?;
loader.mock_test(&circuit, &instances)
}

0 comments on commit 29f23ea

Please sign in to comment.