foundry_evm/inspectors/
chisel_state.rs1use alloy_primitives::U256;
2use revm::{
3 Inspector,
4 interpreter::{Interpreter, interpreter_types::Jumps},
5};
6
7#[derive(Clone, Debug, Default)]
9pub struct ChiselState {
10 pub final_pc: usize,
12 pub state: Option<(Vec<U256>, Vec<u8>)>,
14}
15
16impl ChiselState {
17 #[inline]
19 pub const fn new(final_pc: usize) -> Self {
20 Self { final_pc, state: None }
21 }
22}
23
24impl<CTX> Inspector<CTX> for ChiselState {
25 #[cold]
26 fn step_end(&mut self, interpreter: &mut Interpreter, _context: &mut CTX) {
27 if self.final_pc == interpreter.bytecode.pc() - 1 {
30 self.state = Some((
31 interpreter.stack.data().clone(),
32 interpreter.memory.context_memory().to_vec(),
33 ))
34 }
35 }
36}