@@ -52,7 +52,7 @@ pub struct OpcodeTracer<Gas, GasMapper> {
52
52
failed : bool ,
53
53
54
54
/// The return value of the transaction.
55
- return_value : Vec < u8 > ,
55
+ return_value : Bytes ,
56
56
57
57
/// Pending step that's waiting for gas cost to be recorded.
58
58
pending_step : Option < OpcodeStep < Gas > > ,
@@ -78,22 +78,17 @@ impl<Gas, GasMapper> OpcodeTracer<Gas, GasMapper> {
78
78
step_count : 0 ,
79
79
total_gas_used : Gas :: default ( ) ,
80
80
failed : false ,
81
- return_value : Vec :: new ( ) ,
81
+ return_value : Bytes :: default ( ) ,
82
82
pending_step : None ,
83
83
pending_gas_before : None ,
84
84
storages_per_call : alloc:: vec![ Default :: default ( ) ] ,
85
85
}
86
86
}
87
87
88
88
/// Collect the traces and return them.
89
- pub fn collect_trace ( & mut self ) -> OpcodeTrace < Gas >
90
- where
91
- Gas : Copy ,
92
- {
93
- let struct_logs = core:: mem:: take ( & mut self . steps ) ;
94
- let return_value = crate :: evm:: Bytes ( self . return_value . clone ( ) ) ;
95
-
96
- OpcodeTrace { gas : self . total_gas_used , failed : self . failed , return_value, struct_logs }
89
+ pub fn collect_trace ( self ) -> OpcodeTrace < Gas > {
90
+ let Self { steps : struct_logs, return_value, total_gas_used : gas, failed, .. } = self ;
91
+ OpcodeTrace { gas, failed, return_value, struct_logs }
97
92
}
98
93
99
94
/// Record an error in the current step.
@@ -105,7 +100,7 @@ impl<Gas, GasMapper> OpcodeTracer<Gas, GasMapper> {
105
100
106
101
/// Record return data.
107
102
pub fn record_return_data ( & mut self , data : & [ u8 ] ) {
108
- self . return_value = data. to_vec ( ) ;
103
+ self . return_value = Bytes ( data. to_vec ( ) ) ;
109
104
}
110
105
111
106
/// Mark the transaction as failed.
0 commit comments