@@ -35,6 +35,8 @@ pub struct DataCollection {
3535 current_dir : PathBuf ,
3636 batch_size : u64 ,
3737 dump_write_set : bool ,
38+ skip_txn_execution : bool ,
39+ skip_source_compilation : bool ,
3840 filter_condition : FilterCondition ,
3941 enable_features : Vec < FeatureFlag > ,
4042 disable_features : Vec < FeatureFlag > ,
@@ -48,6 +50,8 @@ impl DataCollection {
4850 skip_failed_txns : bool ,
4951 skip_publish_txns : bool ,
5052 dump_write_set : bool ,
53+ skip_txn_execution : bool ,
54+ skip_source_compilation : bool ,
5155 skip_source_code : bool ,
5256 target_account : Option < AccountAddress > ,
5357 enable_features : Vec < FeatureFlag > ,
@@ -58,6 +62,8 @@ impl DataCollection {
5862 current_dir,
5963 batch_size,
6064 dump_write_set,
65+ skip_txn_execution,
66+ skip_source_compilation,
6167 filter_condition : FilterCondition {
6268 skip_failed_txns,
6369 skip_publish_txns,
@@ -76,6 +82,8 @@ impl DataCollection {
7682 skip_failed_txns : bool ,
7783 skip_publish_txns : bool ,
7884 dump_write_set : bool ,
85+ skip_txn_execution : bool ,
86+ skip_source_compilation : bool ,
7987 skip_source_code : bool ,
8088 target_account : Option < AccountAddress > ,
8189 enable_features : Vec < FeatureFlag > ,
@@ -88,6 +96,8 @@ impl DataCollection {
8896 skip_failed_txns,
8997 skip_publish_txns,
9098 dump_write_set,
99+ skip_txn_execution,
100+ skip_source_compilation,
91101 skip_source_code,
92102 target_account,
93103 enable_features,
@@ -128,6 +138,7 @@ impl DataCollection {
128138 compilation_cache : & mut CompilationCache ,
129139 current_dir : PathBuf ,
130140 base_experiments : & [ String ] ,
141+ skip_source_compilation : bool ,
131142 ) -> Option < PackageInfo > {
132143 let upgrade_number = if is_aptos_package ( & package_name) {
133144 None
@@ -160,6 +171,7 @@ impl DataCollection {
160171 None ,
161172 base_experiments,
162173 & [ ] ,
174+ skip_source_compilation,
163175 ) ;
164176 if let Err ( err) = res {
165177 eprintln ! ( "{} at: {}" , err, version) ;
@@ -205,12 +217,16 @@ impl DataCollection {
205217 return Err ( anyhow:: Error :: msg ( "aptos packages are missing" ) ) ;
206218 }
207219 let mut compiled_cache = CompilationCache :: default ( ) ;
208- compile_aptos_packages (
209- & aptos_commons_path,
210- & mut compiled_cache. base_compiled_package_cache ,
211- & base_experiments,
212- "base" ,
213- ) ?;
220+ // The compiled framework is only injected into the state view for txn
221+ // execution; source-only collection does not need it.
222+ if !self . skip_txn_execution {
223+ compile_aptos_packages (
224+ & aptos_commons_path,
225+ & mut compiled_cache. base_compiled_package_cache ,
226+ & base_experiments,
227+ "base" ,
228+ ) ?;
229+ }
214230 let compilation_cache: Arc < Mutex < CompilationCache > > = Arc :: new ( Mutex :: new ( compiled_cache) ) ;
215231 let data_manager = Arc :: new ( Mutex :: new ( DataManager :: new_with_dir_creation (
216232 & self . current_dir ,
@@ -253,40 +269,52 @@ impl DataCollection {
253269 let data_manager = data_manager. clone ( ) ;
254270 let index = index_writer. clone ( ) ;
255271 let base_experiments = base_experiments. clone ( ) ;
256- let data_state = InMemoryStateStore :: default ( ) ;
257- let features_to_enable = self . enable_features . clone ( ) ;
258- let features_to_disable = self . disable_features . clone ( ) ;
259- let cache_v1 = compilation_cache
260- . lock ( )
261- . unwrap ( )
262- . base_compiled_package_cache
263- . clone ( ) ;
264- add_aptos_packages_to_state_store ( & data_state, & cache_v1) ;
265- let state_view = DataStateView :: new_with_data_reads_and_code (
266- self . debugger . clone ( ) ,
267- version,
268- data_state,
269- features_to_enable,
270- features_to_disable,
271- ) ;
272+ let skip_source_compilation = self . skip_source_compilation ;
273+ // Source-only collection skips execution, so it needs no
274+ // state view (and none of its remote state reads).
275+ let state_view_opt = if self . skip_txn_execution {
276+ None
277+ } else {
278+ let data_state = InMemoryStateStore :: default ( ) ;
279+ let features_to_enable = self . enable_features . clone ( ) ;
280+ let features_to_disable = self . disable_features . clone ( ) ;
281+ let cache_v1 = compilation_cache
282+ . lock ( )
283+ . unwrap ( )
284+ . base_compiled_package_cache
285+ . clone ( ) ;
286+ add_aptos_packages_to_state_store ( & data_state, & cache_v1) ;
287+ Some ( DataStateView :: new_with_data_reads_and_code (
288+ self . debugger . clone ( ) ,
289+ version,
290+ data_state,
291+ features_to_enable,
292+ features_to_disable,
293+ ) )
294+ } ;
272295
273296 let txn_execution_thread = tokio:: task:: spawn_blocking ( move || {
274- // Use default info to improve performance
275- let aux_info = PersistedAuxiliaryInfo :: None ;
297+ let epoch_result_opt = if let Some ( state_view) = & state_view_opt {
298+ // Use default info to improve performance
299+ let aux_info = PersistedAuxiliaryInfo :: None ;
276300
277- let epoch_result_res =
278- Self :: execute_transactions_at_version_with_state_view (
301+ match Self :: execute_transactions_at_version_with_state_view (
279302 vec ! [ txn. clone( ) ] ,
280303 vec ! [ aux_info] ,
281- & state_view,
282- ) ;
283- if let Err ( err) = epoch_result_res {
284- println ! (
285- "execution error during transaction at version:{} :{}" ,
286- version, err
287- ) ;
288- return ;
289- }
304+ state_view,
305+ ) {
306+ Ok ( outputs) => Some ( outputs) ,
307+ Err ( err) => {
308+ println ! (
309+ "execution error during transaction at version:{} :{}" ,
310+ version, err
311+ ) ;
312+ return ;
313+ } ,
314+ }
315+ } else {
316+ None
317+ } ;
290318
291319 let mut version_idx = TxnIndex {
292320 version,
@@ -304,21 +332,26 @@ impl DataCollection {
304332 & mut compilation_cache. lock ( ) . unwrap ( ) ,
305333 current_dir. clone ( ) ,
306334 & base_experiments,
335+ skip_source_compilation,
307336 ) ;
308337 if package_info_opt. is_none ( ) {
309338 return ;
310339 }
311340 version_idx. package_info = package_info_opt. unwrap ( ) ;
312341 }
313342
314- // dump through data_manager
315- Self :: dump_txn_index (
316- & mut data_manager. lock ( ) . unwrap ( ) ,
317- version_idx,
318- & state_view. get_state_keys ( ) . lock ( ) . unwrap ( ) ,
319- epoch_result_res,
320- dump_write_set,
321- ) ;
343+ // dump through data_manager (skipped in source-only mode)
344+ if let ( Some ( state_view) , Some ( outputs) ) =
345+ ( state_view_opt, epoch_result_opt)
346+ {
347+ Self :: dump_txn_index (
348+ & mut data_manager. lock ( ) . unwrap ( ) ,
349+ version_idx,
350+ & state_view. get_state_keys ( ) . lock ( ) . unwrap ( ) ,
351+ Ok ( outputs) ,
352+ dump_write_set,
353+ ) ;
354+ }
322355
323356 // Log version
324357 index. lock ( ) . unwrap ( ) . add_version ( version) ;
0 commit comments