@@ -146,15 +146,15 @@ impl TracingInspector {
146146 ///
147147 /// Invoked on [Inspector::call].
148148 #[ allow( clippy:: too_many_arguments) ]
149- fn start_trace_on_call (
149+ fn start_trace_on_call < DB : Database > (
150150 & mut self ,
151- depth : usize ,
151+ data : & EVMData < ' _ , DB > ,
152152 address : Address ,
153- data : Bytes ,
153+ input_data : Bytes ,
154154 value : U256 ,
155155 kind : CallKind ,
156156 caller : Address ,
157- gas_limit : u64 ,
157+ mut gas_limit : u64 ,
158158 maybe_precompile : Option < bool > ,
159159 ) {
160160 // This will only be true if the inspector is configured to exclude precompiles and the call
@@ -166,14 +166,20 @@ impl TracingInspector {
166166 PushTraceKind :: PushAndAttachToParent
167167 } ;
168168
169+ if self . trace_stack . is_empty ( ) {
170+ // this is the root call which should get the original gas limit of the transaction,
171+ // because initialization costs are already subtracted from gas_limit
172+ gas_limit = data. env . tx . gas_limit ;
173+ }
174+
169175 self . trace_stack . push ( self . traces . push_trace (
170176 0 ,
171177 push_kind,
172178 CallTrace {
173- depth,
179+ depth : data . journaled_state . depth ( ) as usize ,
174180 address,
175181 kind,
176- data,
182+ data : input_data ,
177183 value,
178184 status : InstructionResult :: Continue ,
179185 caller,
@@ -421,7 +427,7 @@ where
421427 self . config . exclude_precompile_calls . then ( || self . is_precompile_call ( data, & to, value) ) ;
422428
423429 self . start_trace_on_call (
424- data. journaled_state . depth ( ) as usize ,
430+ data,
425431 to,
426432 inputs. input . clone ( ) ,
427433 value,
@@ -460,7 +466,7 @@ where
460466 let _ = data. journaled_state . load_account ( inputs. caller , data. db ) ;
461467 let nonce = data. journaled_state . account ( inputs. caller ) . info . nonce ;
462468 self . start_trace_on_call (
463- data. journaled_state . depth ( ) as usize ,
469+ data,
464470 get_create_address ( inputs, nonce) ,
465471 inputs. init_code . clone ( ) ,
466472 inputs. value ,
0 commit comments