From 05a6cd4a7eade6733e394d673acd09f04d260c72 Mon Sep 17 00:00:00 2001 From: Richard Bonichon Date: Tue, 31 Oct 2023 16:58:19 +0100 Subject: [PATCH] optimism: basic logging in place now needs to compute the right data :-) --- Cargo.lock | 5 +++-- optimism/Cargo.toml | 1 + optimism/src/mips/witness.rs | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77da43c308..d652e60b4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1302,6 +1302,7 @@ dependencies = [ "hex", "kimchi", "libflate", + "log", "mina-curves", "mina-poseidon", "poly-commitment", @@ -1389,9 +1390,9 @@ checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" diff --git a/optimism/Cargo.toml b/optimism/Cargo.toml index da634f3030..0991fe1ff0 100644 --- a/optimism/Cargo.toml +++ b/optimism/Cargo.toml @@ -31,3 +31,4 @@ hex = "0.4.3" regex = "1.10.2" libflate = "2" base64 = "0.21.5" +log = "0.4.20" diff --git a/optimism/src/mips/witness.rs b/optimism/src/mips/witness.rs index df9de5c26a..967a0aad80 100644 --- a/optimism/src/mips/witness.rs +++ b/optimism/src/mips/witness.rs @@ -4,6 +4,7 @@ use crate::{ }; use ark_ff::Field; use std::array; +use log::{info}; pub const NUM_GLOBAL_LOOKUP_TERMS: usize = 1; pub const NUM_DECODING_LOOKUP_TERMS: usize = 2; @@ -97,6 +98,7 @@ impl Env { pub fn step(&mut self, config: VmConfiguration) { self.pp_info(config.info_at); + // TODO self.halt = true; } @@ -114,6 +116,15 @@ impl Env { fn pp_info(& self, at: StepFrequency) { if self.at(at) { println!("Info"); + let elapsed = 1.0; + let step = self.instruction_counter; + let pc = self.instruction_pointer; + let insn = 0xffffff; + let ips = 0.0 / elapsed; + let pages = self.memory.len(); + let mem = 0; + let name = "unsupported"; + info!("processing step {} pc {} insn {} ips {} page {} mem {} name {}", step, pc, insn, ips, pages, mem, name); } } }