From b46a860e076a18f0518ce556f8c25b282cc57b49 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Wed, 15 Nov 2023 14:42:50 +0000 Subject: [PATCH] Track next_instruction_pointer --- optimism/src/cannon.rs | 2 +- optimism/src/mips/witness.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/optimism/src/cannon.rs b/optimism/src/cannon.rs index 1337bdbd40..850abeb127 100644 --- a/optimism/src/cannon.rs +++ b/optimism/src/cannon.rs @@ -41,7 +41,7 @@ pub struct State { pub preimage_offset: u32, pub pc: u32, #[serde(rename = "nextPC")] - next_pc: u32, // + pub next_pc: u32, pub lo: u32, pub hi: u32, pub heap: u32, diff --git a/optimism/src/mips/witness.rs b/optimism/src/mips/witness.rs index ab0d3fec35..b7bb702e36 100644 --- a/optimism/src/mips/witness.rs +++ b/optimism/src/mips/witness.rs @@ -46,6 +46,7 @@ pub struct Env { pub registers: Registers, pub registers_write_index: Registers, pub instruction_pointer: u32, + pub next_instruction_pointer: u32, pub scratch_state_idx: usize, pub scratch_state: [Fp; SCRATCH_SIZE], pub halt: bool, @@ -94,6 +95,7 @@ fn memory_size(total: usize) -> String { impl Env { pub fn create(page_size: usize, state: State) -> Self { let initial_instruction_pointer = state.pc; + let next_instruction_pointer = state.next_pc; let syscall_env = SyscallEnv::create(&state); @@ -130,6 +132,7 @@ impl Env { registers: initial_registers.clone(), registers_write_index: Registers::default(), instruction_pointer: initial_instruction_pointer, + next_instruction_pointer, scratch_state_idx: 0, scratch_state: fresh_scratch_state(), halt: state.exited,