diff --git a/crates/lean_compiler/src/lib.rs b/crates/lean_compiler/src/lib.rs index d23ffe5b..7d3bd3d5 100644 --- a/crates/lean_compiler/src/lib.rs +++ b/crates/lean_compiler/src/lib.rs @@ -24,8 +24,10 @@ pub fn compile_program(program: String) -> Bytecode { // for (loc, name) in function_locations.iter() { // println!("{name}: {loc}"); // } + /* let compiled = */ + compile_to_low_level_bytecode(intermediate_bytecode, program, function_locations).unwrap() // ; // println!("\n\nCompiled Program:\n\n{compiled}"); - compile_to_low_level_bytecode(intermediate_bytecode, program, function_locations).unwrap() + // compiled } pub fn compile_and_run( diff --git a/crates/lean_prover/tests/test_zkvm.rs b/crates/lean_prover/tests/test_zkvm.rs index 8ee67ecd..195dd570 100644 --- a/crates/lean_prover/tests/test_zkvm.rs +++ b/crates/lean_prover/tests/test_zkvm.rs @@ -125,6 +125,6 @@ fn test_zk_vm_helper(program_str: &str, (public_input, private_input): (&[F], &[ ); let proof_time = time.elapsed(); verify_execution(&bytecode, public_input, proof_data, whir_config_builder()).unwrap(); - println!("{}", summary); + println!("{summary}"); println!("Proof time: {:.3} s", proof_time.as_secs_f32()); } diff --git a/crates/lean_vm/src/diagnostics/error.rs b/crates/lean_vm/src/diagnostics/error.rs index 80216c68..1659d3c9 100644 --- a/crates/lean_vm/src/diagnostics/error.rs +++ b/crates/lean_vm/src/diagnostics/error.rs @@ -9,8 +9,12 @@ pub enum RunnerError { #[error("Out of memory")] OutOfMemory, - #[error("Memory already set")] - MemoryAlreadySet, + #[error("Memory already set: m[{address}] = {prev_value} != {new_value}")] + MemoryAlreadySet { + address: usize, + prev_value: F, + new_value: F, + }, #[error("Not a pointer")] NotAPointer, diff --git a/crates/lean_vm/src/execution/memory.rs b/crates/lean_vm/src/execution/memory.rs index aa19397d..a162fb46 100644 --- a/crates/lean_vm/src/execution/memory.rs +++ b/crates/lean_vm/src/execution/memory.rs @@ -41,7 +41,11 @@ impl Memory { } if let Some(existing) = &mut self.0[index] { if *existing != value { - return Err(RunnerError::MemoryAlreadySet); + return Err(RunnerError::MemoryAlreadySet { + address: index, + prev_value: *existing, + new_value: value, + }); } } else { self.0[index] = Some(value); diff --git a/crates/lean_vm/src/execution/tests.rs b/crates/lean_vm/src/execution/tests.rs index ca03ba2c..feaaa596 100644 --- a/crates/lean_vm/src/execution/tests.rs +++ b/crates/lean_vm/src/execution/tests.rs @@ -25,7 +25,14 @@ fn test_memory_already_set_error() { memory.set(0, F::ONE).unwrap(); // Setting different value should fail - assert!(matches!(memory.set(0, F::ZERO), Err(RunnerError::MemoryAlreadySet))); + assert!(matches!( + memory.set(0, F::ZERO), + Err(RunnerError::MemoryAlreadySet { + address: 0, + prev_value: F::ONE, + new_value: F::ZERO, + }) + )); } #[test]