0xmozak / mozak-vm

Mozak RISC-V Virtual Machine
Apache License 2.0
11 stars 8 forks source link

Fix the constraint (and trace generation) for zeroing out memory before program execution #896

Closed phildimes closed 10 months ago

phildimes commented 11 months ago

values are coming as 0 , but the point is that we have to update memory constraint to accommodate this kind of cases memory constraint expects a store before load for address range 4294967124-4294967126

vivekvpandya commented 10 months ago

To re-produce please use following command

vivek@vivek-ThinkPad-E14-Gen-3:~/dev/mozak-vm/examples$ MOZAK_STARK_DEBUG=TRUE ~/dev/mozak-vm/target/debug/mozak-cli -vv prove-and-verify ./target/riscv32im-mozak-zkvm-elf/release/sha2-example iotape.txt iotape.txt 
Debug constraints for MemoryStark
lv-row[24124] - values: Memory { is_writable: 1, addr: 4294967124, clk: 7345, is_store: 0, is_load: 1, is_init: 0, value: 0, diff_addr: 5, diff_addr_inv: 14757395255531667457, diff_clk: 0 }
nv-row[24125] - values: Memory { is_writable: 1, addr: 4294967125, clk: 7345, is_store: 0, is_load: 1, is_init: 0, value: 0, diff_addr: 1, diff_addr_inv: 1, diff_clk: 0 }
thread 'main' panicked at circuits/src/generation/mod.rs:190:13:
assertion failed: !consumer.debug_api_has_constraint_failed()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace