Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yann-sjtu committed Nov 16, 2023
1 parent 7a5d860 commit 52d5a67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions crates/zkwasm/src/loader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl<E: MultiMillerLoop> ZkWasmLoader<E> {
compiled_module.dry_run(&mut env)
}

pub fn dry_run_trace_count(&self, arg: ExecutionArg) -> Result<Option<RuntimeValue>> {
pub fn dry_run_trace_count(&self, arg: ExecutionArg) -> Result<(Option<RuntimeValue>, usize)> {
let (mut env, _) = HostEnv::new_with_full_foreign_plugins(
arg.public_inputs,
arg.private_inputs,
Expand Down Expand Up @@ -356,7 +356,3 @@ mod tests {
}
}
}

pub fn get_trace_count() -> usize {
return wasmi::tracer::phantom::get_trace_count();
}
6 changes: 3 additions & 3 deletions crates/zkwasm/src/runtime/wasmi_interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl WasmRuntimeIO {
pub trait Execution<R> {
fn dry_run<E: Externals>(self, externals: &mut E) -> Result<Option<R>>;

fn dry_run_trace_count<E: Externals>(self, externals: &mut E) -> Result<Option<RuntimeValue>>;
fn dry_run_trace_count<E: Externals>(self, externals: &mut E) -> Result<(Option<RuntimeValue>, usize)>;

fn run<E: Externals>(
self,
Expand All @@ -56,14 +56,14 @@ impl Execution<RuntimeValue>
Ok(result)
}

fn dry_run_trace_count<E: Externals>(self, externals: &mut E) -> Result<Option<RuntimeValue>> {
fn dry_run_trace_count<E: Externals>(self, externals: &mut E) -> Result<(Option<RuntimeValue>, usize)> {
let instance = self.instance.run_start(externals).unwrap();

let result = instance.invoke_export_trace_count(
&self.entry, &[], externals, self.tracer.clone()
)?;

Ok(result)
Ok((result, wasmi::tracer::phantom::get_trace_count()))
}

fn run<E: Externals>(
Expand Down

0 comments on commit 52d5a67

Please sign in to comment.