INNER CODE UNIT · Rust
execute
GuildOfWeavers/distaff · src/lib.rs:30
pub fn execute(program: &Program, inputs: &ProgramInputs, num_outputs: usize, options: &ProofOptions) -> (Vec<u128>, StarkProof)
{
assert!(num_outputs <= MAX_OUTPUTS,
"cannot produce more than {} outputs, but requested {}", MAX_OUTPUTS, num_outputs);
// execute the program to create an execution trace
let now = Instant::now();
let (trace, ctx_depth, loop_depth) = processor::execute(program, inputs);
let mut trace = stark::TraceTable::new(trace, ctx_depth, loop_depth, options.extension_factor());
debug!("Generated execution trace of {} registers and {} steps in {} ms",
trace.register_count(),
trace.unextended_length(),
now.elapsed().as_millis());
// copy the user stack state the the last step to return as output
let last_state = trace.get_last_state();
let outputs = last_state.user_stack()[..num_outputs].to_vec();