foundry_evm/inspectors/
chisel_state.rsuse alloy_primitives::U256;
use revm::{
interpreter::{InstructionResult, Interpreter},
Database, EvmContext, Inspector,
};
#[derive(Clone, Debug, Default)]
pub struct ChiselState {
pub final_pc: usize,
pub state: Option<(Vec<U256>, Vec<u8>, InstructionResult)>,
}
impl ChiselState {
#[inline]
pub fn new(final_pc: usize) -> Self {
Self { final_pc, state: None }
}
}
impl<DB: Database> Inspector<DB> for ChiselState {
#[cold]
fn step_end(&mut self, interp: &mut Interpreter, _context: &mut EvmContext<DB>) {
if self.final_pc == interp.program_counter() - 1 {
self.state = Some((
interp.stack.data().clone(),
interp.shared_memory.context_memory().to_vec(),
interp.instruction_result,
))
}
}
}