22// SPDX-License-Identifier: Apache-2.0
33
44use crate :: {
5- dump_and_compile_from_package_metadata , is_aptos_package , CompilationCache , DataManager ,
6- IndexWriter , PackageInfo , TxnIndex ,
5+ data_state_view :: DataStateView , dump_and_compile_from_package_metadata , is_aptos_package ,
6+ CompilationCache , DataManager , IndexWriter , PackageInfo , TxnIndex ,
77} ;
88use anyhow:: { format_err, Result } ;
99use aptos_framework:: natives:: code:: PackageMetadata ;
@@ -16,9 +16,7 @@ use aptos_types::{
1616 } ,
1717 write_set:: TOTAL_SUPPLY_STATE_KEY ,
1818} ;
19- use aptos_validator_interface:: {
20- AptosValidatorInterface , DebuggerStateView , FilterCondition , RestDebuggerInterface ,
21- } ;
19+ use aptos_validator_interface:: { AptosValidatorInterface , FilterCondition , RestDebuggerInterface } ;
2220use aptos_vm:: { AptosVM , VMExecutor } ;
2321use move_core_types:: account_address:: AccountAddress ;
2422use std:: {
@@ -45,6 +43,7 @@ impl DataCollection {
4543 skip_publish_txns : bool ,
4644 dump_write_set : bool ,
4745 skip_source_code : bool ,
46+ target_account : Option < AccountAddress > ,
4847 ) -> Self {
4948 Self {
5049 debugger,
@@ -55,6 +54,7 @@ impl DataCollection {
5554 skip_failed_txns,
5655 skip_publish_txns,
5756 check_source_code : !skip_source_code,
57+ target_account,
5858 } ,
5959 }
6060 }
@@ -67,6 +67,7 @@ impl DataCollection {
6767 skip_publish_txns : bool ,
6868 dump_write_set : bool ,
6969 skip_source_code : bool ,
70+ target_account : Option < AccountAddress > ,
7071 ) -> Result < Self > {
7172 Ok ( Self :: new (
7273 Arc :: new ( RestDebuggerInterface :: new ( rest_client) ) ,
@@ -76,21 +77,22 @@ impl DataCollection {
7677 skip_publish_txns,
7778 dump_write_set,
7879 skip_source_code,
80+ target_account,
7981 ) )
8082 }
8183
8284 fn execute_transactions_at_version_with_state_view (
8385 txns : Vec < Transaction > ,
84- debugger_stateview : & DebuggerStateView ,
86+ debugger_state_view : & DataStateView ,
8587 ) -> Result < Vec < TransactionOutput > > {
8688 let sig_verified_txns: Vec < SignatureVerifiedTransaction > =
8789 txns. into_iter ( ) . map ( |x| x. into ( ) ) . collect :: < Vec < _ > > ( ) ;
8890 // check whether total supply can be retrieved
8991 // used for debugging the aggregator panic issue, will be removed later
9092 // FIXME(#10412): remove the assert
91- let val = debugger_stateview . get_state_value ( TOTAL_SUPPLY_STATE_KEY . deref ( ) ) ;
93+ let val = debugger_state_view . get_state_value ( TOTAL_SUPPLY_STATE_KEY . deref ( ) ) ;
9294 assert ! ( val. is_ok( ) && val. unwrap( ) . is_some( ) ) ;
93- AptosVM :: execute_block_no_limit ( & sig_verified_txns, debugger_stateview )
95+ AptosVM :: execute_block_no_limit ( & sig_verified_txns, debugger_state_view )
9496 . map_err ( |err| format_err ! ( "Unexpected VM Error: {:?}" , err) )
9597 }
9698
@@ -114,15 +116,14 @@ impl DataCollection {
114116 package_name : package_name. clone ( ) ,
115117 upgrade_number,
116118 } ;
117-
119+ if compilation_cache. failed_packages_v1 . contains ( & package_info) {
120+ return None ;
121+ }
118122 if !is_aptos_package ( & package_name)
119123 && !compilation_cache
120124 . compiled_package_map
121125 . contains_key ( & package_info)
122126 {
123- if compilation_cache. failed_packages . contains ( & package_info) {
124- return None ;
125- }
126127 let res = dump_and_compile_from_package_metadata (
127128 package_info. clone ( ) ,
128129 current_dir,
@@ -131,7 +132,7 @@ impl DataCollection {
131132 None ,
132133 ) ;
133134 if res. is_err ( ) {
134- println ! ( "compile package failed at:{}" , version) ;
135+ eprintln ! ( "{} at: {}" , res . unwrap_err ( ) , version) ;
135136 return None ;
136137 }
137138 }
@@ -167,7 +168,7 @@ impl DataCollection {
167168 let index_writer = Arc :: new ( Mutex :: new ( IndexWriter :: new ( & self . current_dir ) ) ) ;
168169
169170 let mut cur_version = begin;
170-
171+ let mut module_registry_map = HashMap :: new ( ) ;
171172 while cur_version < begin + limit {
172173 let batch = if cur_version + self . batch_size <= begin + limit {
173174 self . batch_size
@@ -176,7 +177,12 @@ impl DataCollection {
176177 } ;
177178 let res_txns = self
178179 . debugger
179- . get_and_filter_committed_transactions ( cur_version, batch, self . filter_condition )
180+ . get_and_filter_committed_transactions (
181+ cur_version,
182+ batch,
183+ self . filter_condition ,
184+ & mut module_registry_map,
185+ )
180186 . await ;
181187 // if error happens when collecting txns, log the version range
182188 if res_txns. is_err ( ) {
@@ -198,7 +204,7 @@ impl DataCollection {
198204 let index = index_writer. clone ( ) ;
199205
200206 let state_view =
201- DebuggerStateView :: new_with_data_reads ( self . debugger . clone ( ) , version) ;
207+ DataStateView :: new_with_data_reads ( self . debugger . clone ( ) , version) ;
202208
203209 let txn_execution_thread = tokio:: task:: spawn_blocking ( move || {
204210 let epoch_result_res =
0 commit comments