Skip to content

Commit

Permalink
Merge pull request #161 from 0xPolygonMiden/dominik_add_program_hash_…
Browse files Browse the repository at this point in the history
…and_cycles

adding cycles and program_hash to Outputs
  • Loading branch information
Dominik1999 authored Jan 15, 2024
2 parents 877018b + 48efea3 commit 205532c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions playground/miden-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use wasm_bindgen::prelude::*;
#[wasm_bindgen(getter_with_clone)]
#[derive(Deserialize, Serialize)]
pub struct Outputs {
pub program_hash: String,
pub stack_output: Vec<u64>,
pub cycles: Option<usize>,
pub trace_len: Option<usize>,
pub overflow_addrs: Option<Vec<u64>>,
pub proof: Option<Vec<u8>>,
Expand Down Expand Up @@ -42,7 +44,9 @@ pub fn run_program(code_frontend: &str, inputs_frontend: &str) -> Result<Outputs
.map_err(|err| format!("Failed to generate execution trace - {:?}", err))?;

let result = Outputs {
program_hash: program.program_info.unwrap().program_hash().to_string(),
stack_output: trace.stack_outputs().stack().to_vec(),
cycles: Some(trace.trace_len_summary().trace_len()),
trace_len: Some(trace.get_trace_len()),
overflow_addrs: None,
proof: None,
Expand Down Expand Up @@ -79,7 +83,9 @@ pub fn prove_program(code_frontend: &str, inputs_frontend: &str) -> Result<Outpu
.map_err(|err| format!("Failed to prove execution - {:?}", err))?;

let result = Outputs {
program_hash: program.program_info.clone().unwrap().program_hash().to_string(),
stack_output: output.stack().to_vec(),
cycles: None,
trace_len: Some(proof.stark_proof().trace_length()),
overflow_addrs: Some(output.overflow_addrs().to_vec()),
proof: Some(proof.to_bytes()),
Expand Down

0 comments on commit 205532c

Please sign in to comment.