From 524c24c20c1b131f9f2769e3c4f1481521dd4f06 Mon Sep 17 00:00:00 2001 From: Serhii Shymkiv Date: Sun, 20 Oct 2024 12:57:00 +0300 Subject: [PATCH] Some fixes. --- o1vm/README.md | 2 +- o1vm/src/interpreters/mips/witness.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/o1vm/README.md b/o1vm/README.md index 22215f08af..cc64fb70f6 100644 --- a/o1vm/README.md +++ b/o1vm/README.md @@ -165,7 +165,7 @@ python3 -m http.server 8765 - Then run the o1vm with the following command: ```shell -O1VM_FLAVOR="pickles" STOP_AT="=10000000" ./run-code.sh +FILENAME="env-for-latest-l2-block.sh" O1VM_FLAVOR="pickles" STOP_AT="=10000000" ./run-code.sh ``` - Don't forget to stop the HTTP server after you are done. diff --git a/o1vm/src/interpreters/mips/witness.rs b/o1vm/src/interpreters/mips/witness.rs index 0c6c1175fa..34695b8d40 100644 --- a/o1vm/src/interpreters/mips/witness.rs +++ b/o1vm/src/interpreters/mips/witness.rs @@ -1286,7 +1286,10 @@ impl Env { let insn = self.get_opcode().unwrap(); // Approximate instruction per seconds - let how_many_steps = step as usize - start.step; + let how_many_steps = (step as usize) + .checked_sub(start.step) + .unwrap_or_else(|| panic!("Step counter overflowed: {} - {}", step, start.step)); + let ips = how_many_steps as f64 / elapsed.as_secs() as f64; let pages = self.memory.len();