From 2a294fcb00dd562198e86853a2e3ecb434ab8cc4 Mon Sep 17 00:00:00 2001 From: rakita Date: Tue, 30 Jan 2024 03:18:33 +0100 Subject: [PATCH] chore(Inspector): add inspector depth test (#1028) * chore(clippy): nightly clippy * refactor(op): Move op l1 block load to op handler * add inspector test and optimism test --- crates/revm/src/inspector/handler_register.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/revm/src/inspector/handler_register.rs b/crates/revm/src/inspector/handler_register.rs index 53023e0253..db63f334a9 100644 --- a/crates/revm/src/inspector/handler_register.rs +++ b/crates/revm/src/inspector/handler_register.rs @@ -308,7 +308,7 @@ mod tests { fn call( &mut self, - _context: &mut EvmContext, + context: &mut EvmContext, _call: &mut CallInputs, _return_memory_offset: Range, ) -> Option { @@ -316,36 +316,40 @@ mod tests { unreachable!("call should not be called twice") } self.call = true; + assert_eq!(context.journaled_state.depth(), 0); None } fn call_end( &mut self, - _context: &mut EvmContext, + context: &mut EvmContext, _inputs: &CallInputs, outcome: CallOutcome, ) -> CallOutcome { if self.call_end { unreachable!("call_end should not be called twice") } + assert_eq!(context.journaled_state.depth(), 0); self.call_end = true; outcome } fn create( &mut self, - _context: &mut EvmContext, + context: &mut EvmContext, _call: &mut CreateInputs, ) -> Option { + assert_eq!(context.journaled_state.depth(), 0); None } fn create_end( &mut self, - _context: &mut EvmContext, + context: &mut EvmContext, _inputs: &CreateInputs, outcome: CreateOutcome, ) -> CreateOutcome { + assert_eq!(context.journaled_state.depth(), 0); outcome } }