@@ -19,7 +19,6 @@ mod checked {
1919 use std:: fs:: File ;
2020 use std:: io:: BufWriter ;
2121 use std:: sync:: Mutex ;
22- use similar:: TextDiff ;
2322 use std:: { cell:: RefCell , collections:: HashSet , rc:: Rc , sync:: Arc } ;
2423 use sui_types:: accumulator_root:: { ACCUMULATOR_ROOT_CREATE_FUNC , ACCUMULATOR_ROOT_MODULE } ;
2524 use sui_types:: balance:: {
@@ -28,6 +27,7 @@ mod checked {
2827 } ;
2928 use sui_types:: execution_params:: ExecutionOrEarlyError ;
3029 use sui_types:: gas_coin:: GAS ;
30+ use sui_types:: gas_model:: tables:: GasDetails ;
3131 use sui_types:: messages_checkpoint:: CheckpointTimestamp ;
3232 use sui_types:: metrics:: LimitsMetrics ;
3333 use sui_types:: object:: OBJECT_START_VERSION ;
@@ -69,7 +69,6 @@ mod checked {
6969 use sui_types:: error:: { ExecutionError , ExecutionErrorKind } ;
7070 use sui_types:: execution:: { ExecutionTiming , ResultWithTimings } ;
7171 use sui_types:: execution_status:: { ExecutionFailureStatus , ExecutionStatus } ;
72- use sui_types:: gas:: GasCostSummary ;
7372 use sui_types:: gas:: SuiGasStatus ;
7473 use sui_types:: gas:: { GasCostSummary , GasUsageReport } ;
7574 use sui_types:: id:: UID ;
@@ -100,7 +99,7 @@ mod checked {
10099 let enc = FrameEncoder :: new ( enc) ;
101100 let mut writer = Writer :: from_writer ( enc) ;
102101 writer
103- . write_record ( & [
102+ . write_record ( [
104103 "tx_digest" ,
105104 "gas_budget" ,
106105 "new_computation_cost" ,
@@ -111,6 +110,13 @@ mod checked {
111110 "old_storage_rebate" ,
112111 "new_gas_used" ,
113112 "old_gas_used" ,
113+ "new_instructions" ,
114+ "old_instructions" ,
115+ "new_stack_height" ,
116+ "old_stack_hight" ,
117+ "new_memory_allocated" ,
118+ "old_memory_allocated" ,
119+ "translation" ,
114120 ] )
115121 . expect ( "failed to write gas header" ) ;
116122 Mutex :: new ( writer)
@@ -120,13 +126,15 @@ mod checked {
120126 transaction_digest : String ,
121127 new_gas : & GasUsageReport ,
122128 old_gas : & GasUsageReport ,
129+ new_details : & GasDetails ,
130+ old_details : & GasDetails ,
123131 ) {
124132 if new_gas. cost_summary == old_gas. cost_summary {
125133 return ;
126134 }
127135 let mut writer = CSV_WRITER . lock ( ) . unwrap ( ) ;
128136 writer
129- . write_record ( & [
137+ . write_record ( [
130138 & transaction_digest,
131139 & new_gas. gas_budget . to_string ( ) ,
132140 & new_gas. cost_summary . computation_cost . to_string ( ) ,
@@ -137,6 +145,13 @@ mod checked {
137145 & old_gas. cost_summary . storage_rebate . to_string ( ) ,
138146 & new_gas. gas_used . to_string ( ) ,
139147 & old_gas. gas_used . to_string ( ) ,
148+ & new_details. instructions_executed . to_string ( ) ,
149+ & old_details. instructions_executed . to_string ( ) ,
150+ & new_details. stack_height . to_string ( ) ,
151+ & old_details. stack_height . to_string ( ) ,
152+ & new_details. memory_allocated . to_string ( ) ,
153+ & old_details. memory_allocated . to_string ( ) ,
154+ & new_details. transl_gas_used . to_string ( ) ,
140155 ] )
141156 . expect ( "failed to write gas row" ) ;
142157 writer. flush ( ) . expect ( "failed to flush gas writer" ) ;
@@ -208,7 +223,8 @@ mod checked {
208223
209224 compare_effects :: < Mode > ( & normal_effects, & new_effects) ;
210225
211- normal_effects
226+ let ( temp_store, gas_status, effects, _gas_details, timing, res) = normal_effects;
227+ ( temp_store, gas_status, effects, timing, res)
212228 }
213229
214230 #[ instrument( name = "new_tx_execute_to_effects" , level = "debug" , skip_all) ]
@@ -232,6 +248,7 @@ mod checked {
232248 InnerTemporaryStore ,
233249 SuiGasStatus ,
234250 TransactionEffects ,
251+ GasDetails ,
235252 Vec < ExecutionTiming > ,
236253 Result < Mode :: ExecutionResults , ExecutionError > ,
237254 ) {
@@ -306,6 +323,8 @@ mod checked {
306323 trace_builder_opt,
307324 ) ;
308325
326+ let gas_details = gas_charger. move_gas_status ( ) . gas_details ( ) ;
327+
309328 let status = if let Err ( error) = & execution_result {
310329 // Elaborate errors in logs if they are unexpected or their status is terse.
311330 use ExecutionErrorKind as K ;
@@ -398,6 +417,7 @@ mod checked {
398417 inner,
399418 gas_charger. into_gas_status ( ) ,
400419 effects,
420+ gas_details,
401421 timings,
402422 execution_result,
403423 )
@@ -408,13 +428,15 @@ mod checked {
408428 InnerTemporaryStore ,
409429 SuiGasStatus ,
410430 TransactionEffects ,
431+ GasDetails ,
411432 Vec < ExecutionTiming > ,
412433 Result < Mode :: ExecutionResults , ExecutionError > ,
413434 ) ,
414435 new_effects : & (
415436 InnerTemporaryStore ,
416437 SuiGasStatus ,
417438 TransactionEffects ,
439+ GasDetails ,
418440 Vec < ExecutionTiming > ,
419441 Result < Mode :: ExecutionResults , ExecutionError > ,
420442 ) ,
@@ -453,6 +475,8 @@ mod checked {
453475 normal_effects. 2 . transaction_digest ( ) . to_string ( ) ,
454476 & new_effects. 1 . gas_usage_report ( ) ,
455477 & normal_effects. 1 . gas_usage_report ( ) ,
478+ & new_effects. 3 ,
479+ & normal_effects. 3 ,
456480 ) ;
457481
458482 if !ok {
0 commit comments