1
1
use super :: {
2
2
Cheatcodes , CheatsConfig , ChiselState , CoverageCollector , Fuzzer , LogCollector ,
3
- TracingInspector ,
3
+ ScriptExecutionInspector , TracingInspector ,
4
4
} ;
5
5
use alloy_primitives:: { map:: AddressHashMap , Address , Bytes , Log , TxKind , U256 } ;
6
6
use foundry_cheatcodes:: { CheatcodesExecutor , Wallets } ;
@@ -199,6 +199,7 @@ impl InspectorStackBuilder {
199
199
if let Some ( chisel_state) = chisel_state {
200
200
stack. set_chisel ( chisel_state) ;
201
201
}
202
+
202
203
stack. collect_coverage ( coverage. unwrap_or ( false ) ) ;
203
204
stack. collect_logs ( logs. unwrap_or ( true ) ) ;
204
205
stack. print ( print. unwrap_or ( false ) ) ;
@@ -290,6 +291,7 @@ pub struct InspectorStackInner {
290
291
pub log_collector : Option < LogCollector > ,
291
292
pub printer : Option < CustomPrintTracer > ,
292
293
pub tracer : Option < TracingInspector > ,
294
+ pub script_execution_inspector : Option < ScriptExecutionInspector > ,
293
295
pub enable_isolation : bool ,
294
296
pub odyssey : bool ,
295
297
pub create2_deployer : Address ,
@@ -437,6 +439,13 @@ impl InspectorStack {
437
439
}
438
440
}
439
441
442
+ /// Set whether to enable script execution inspector.
443
+ #[ inline]
444
+ pub fn script ( & mut self , script_address : Address ) {
445
+ self . script_execution_inspector . get_or_insert_with ( Default :: default) . script_address =
446
+ script_address;
447
+ }
448
+
440
449
/// Collects all the data gathered during inspection into a single struct.
441
450
#[ inline]
442
451
pub fn collect ( self ) -> InspectorData {
@@ -757,7 +766,13 @@ impl Inspector<&mut dyn DatabaseExt> for InspectorStackRefMut<'_> {
757
766
ecx : & mut EvmContext < & mut dyn DatabaseExt > ,
758
767
) {
759
768
call_inspectors ! (
760
- [ & mut self . coverage, & mut self . tracer, & mut self . cheatcodes, & mut self . printer] ,
769
+ [
770
+ & mut self . coverage,
771
+ & mut self . tracer,
772
+ & mut self . cheatcodes,
773
+ & mut self . script_execution_inspector,
774
+ & mut self . printer
775
+ ] ,
761
776
|inspector| inspector. initialize_interp( interpreter, ecx) ,
762
777
) ;
763
778
}
@@ -769,7 +784,8 @@ impl Inspector<&mut dyn DatabaseExt> for InspectorStackRefMut<'_> {
769
784
& mut self . tracer,
770
785
& mut self . coverage,
771
786
& mut self . cheatcodes,
772
- & mut self . printer,
787
+ & mut self . script_execution_inspector,
788
+ & mut self . printer
773
789
] ,
774
790
|inspector| inspector. step( interpreter, ecx) ,
775
791
) ;
0 commit comments