@@ -3,11 +3,13 @@ use derive_where::derive_where;
3
3
use revm:: {
4
4
bytecode:: opcode:: OpCode ,
5
5
context:: Cfg ,
6
- context_interface:: { CfgGetter , JournalStateGetter , Transaction , TransactionGetter } ,
6
+ context_interface:: {
7
+ CfgGetter , JournalStateGetter , JournaledState , Transaction , TransactionGetter ,
8
+ } ,
7
9
interpreter:: {
8
10
interpreter_types:: { Jumps , LoopControl , MemoryTrait , StackTrait } ,
9
- CallInputs , CallOutcome , CreateInputs , CreateOutcome , EOFCreateInputs , Interpreter ,
10
- InterpreterResult , InterpreterTypes , Stack ,
11
+ CallInputs , CallOutcome , CreateInputs , CreateOutcome , Interpreter , InterpreterResult ,
12
+ InterpreterTypes , Stack ,
11
13
} ,
12
14
primitives:: { hex, HashMap , B256 , U256 } ,
13
15
} ;
@@ -20,13 +22,8 @@ pub struct TracerEip3155<CTX, INTR> {
20
22
#[ derive_where( skip) ]
21
23
output : Box < dyn Write > ,
22
24
gas_inspector : GasInspector ,
23
-
24
25
/// Print summary of the execution.
25
26
print_summary : bool ,
26
-
27
- /// depth
28
- depth : usize ,
29
-
30
27
stack : Vec < U256 > ,
31
28
pc : usize ,
32
29
opcode : u8 ,
@@ -145,7 +142,6 @@ where
145
142
gas_inspector : GasInspector :: new ( ) ,
146
143
print_summary : true ,
147
144
include_memory : false ,
148
- depth : 0 ,
149
145
stack : Default :: default ( ) ,
150
146
memory : Default :: default ( ) ,
151
147
pc : 0 ,
@@ -232,7 +228,7 @@ where
232
228
self . refunded = interp. control . gas ( ) . refunded ( ) ;
233
229
}
234
230
235
- fn step_end ( & mut self , interp : & mut Interpreter < INTR > , _ : & mut CTX ) {
231
+ fn step_end ( & mut self , interp : & mut Interpreter < INTR > , context : & mut CTX ) {
236
232
self . gas_inspector . step_end ( interp. control . gas ( ) ) ;
237
233
if self . skip {
238
234
self . skip = false ;
@@ -245,7 +241,7 @@ where
245
241
gas : hex_number ( self . gas ) ,
246
242
gas_cost : hex_number ( self . gas_inspector . last_gas_cost ( ) ) ,
247
243
stack : self . stack . iter ( ) . map ( hex_number_u256) . collect ( ) ,
248
- depth : self . depth as u64 ,
244
+ depth : context . journal ( ) . depth ( ) as u64 ,
249
245
return_data : "0x" . to_string ( ) ,
250
246
refund : hex_number ( self . refunded as u64 ) ,
251
247
mem_size : self . mem_size . to_string ( ) ,
@@ -263,30 +259,10 @@ where
263
259
let _ = self . write_value ( & value) ;
264
260
}
265
261
266
- fn call ( & mut self , _: & mut Self :: Context , _: & mut CallInputs ) -> Option < CallOutcome > {
267
- self . depth += 1 ;
268
- None
269
- }
270
-
271
- fn create ( & mut self , _: & mut Self :: Context , _: & mut CreateInputs ) -> Option < CreateOutcome > {
272
- self . depth += 1 ;
273
- None
274
- }
275
-
276
- fn eofcreate (
277
- & mut self ,
278
- _: & mut Self :: Context ,
279
- _: & mut EOFCreateInputs ,
280
- ) -> Option < CreateOutcome > {
281
- self . depth += 1 ;
282
- None
283
- }
284
-
285
262
fn call_end ( & mut self , context : & mut CTX , _: & CallInputs , outcome : & mut CallOutcome ) {
286
263
self . gas_inspector . call_end ( outcome) ;
287
- self . depth -= 1 ;
288
264
289
- if self . depth == 0 {
265
+ if context . journal ( ) . depth ( ) == 0 {
290
266
self . print_summary ( & outcome. result , context) ;
291
267
// clear the state if we are at the top level
292
268
self . clear ( ) ;
@@ -295,19 +271,14 @@ where
295
271
296
272
fn create_end ( & mut self , context : & mut CTX , _: & CreateInputs , outcome : & mut CreateOutcome ) {
297
273
self . gas_inspector . create_end ( outcome) ;
298
- self . depth -= 1 ;
299
274
300
- if self . depth == 0 {
275
+ if context . journal ( ) . depth ( ) == 0 {
301
276
self . print_summary ( & outcome. result , context) ;
302
277
303
278
// clear the state if we are at the top level
304
279
self . clear ( ) ;
305
280
}
306
281
}
307
-
308
- fn eofcreate_end ( & mut self , _: & mut Self :: Context , _: & EOFCreateInputs , _: & mut CreateOutcome ) {
309
- self . depth -= 1 ;
310
- }
311
282
}
312
283
313
284
fn hex_number ( uint : u64 ) -> String {
0 commit comments