@@ -29,7 +29,6 @@ use blockifier::{
29
29
state:: state_api:: State ,
30
30
} ;
31
31
use cairo_vm:: vm:: runners:: cairo_runner:: { CairoRunner , ExecutionResources } ;
32
- use cairo_vm:: vm:: trace:: trace_entry:: RelocatedTraceEntry ;
33
32
use conversions:: FromConv ;
34
33
use conversions:: string:: TryFromHexStr ;
35
34
use shared:: vm:: VirtualMachineExt ;
@@ -40,16 +39,14 @@ use starknet_api::{
40
39
} ;
41
40
use starknet_types_core:: felt:: Felt ;
42
41
use std:: collections:: { HashMap , HashSet } ;
43
- use thiserror:: Error ;
44
42
45
43
pub ( crate ) type ContractClassEntryPointExecutionResult =
46
- Result < CallInfoWithExecutionData , EntryPointExecutionErrorWithTrace > ;
44
+ Result < CallInfoWithExecutionData , EntryPointExecutionError > ;
47
45
48
46
pub ( crate ) struct CallInfoWithExecutionData {
49
47
pub call_info : CallInfo ,
50
48
pub syscall_usage_vm_resources : SyscallUsageMap ,
51
49
pub syscall_usage_sierra_gas : SyscallUsageMap ,
52
- pub vm_trace : Option < Vec < RelocatedTraceEntry > > ,
53
50
}
54
51
55
52
// blockifier/src/execution/entry_point.rs:180 (CallEntryPoint::execute)
@@ -95,7 +92,6 @@ pub fn execute_call_entry_point(
95
92
ret_data : ret_data_f252,
96
93
} ,
97
94
& [ ] ,
98
- None ,
99
95
vec ! [ ] ,
100
96
vec ! [ ] ,
101
97
) ;
@@ -194,21 +190,19 @@ pub fn execute_call_entry_point(
194
190
call_info,
195
191
syscall_usage_vm_resources,
196
192
syscall_usage_sierra_gas,
197
- vm_trace,
198
193
} ) => {
199
194
exit_non_error_call (
200
195
& call_info,
201
196
& syscall_usage_vm_resources,
202
197
& syscall_usage_sierra_gas,
203
198
cheatnet_state,
204
- vm_trace,
205
199
cheated_data. tx_info . signature . unwrap_or_default ( ) ,
206
200
) ;
207
201
update_remaining_gas ( remaining_gas, & call_info) ;
208
202
Ok ( call_info)
209
203
}
210
- Err ( EntryPointExecutionErrorWithTrace { source : err, trace } ) => {
211
- exit_error_call ( & err, cheatnet_state, & entry_point, trace ) ;
204
+ Err ( err) => {
205
+ exit_error_call ( & err, cheatnet_state, & entry_point) ;
212
206
Err ( err)
213
207
}
214
208
}
@@ -227,14 +221,11 @@ fn evaluate_execution_result(
227
221
Ok ( res) => {
228
222
if res. call_info . execution . failed && !is_revertable {
229
223
clear_handled_errors ( & res. call_info , cheatnet_state) ;
230
- return Err ( EntryPointExecutionErrorWithTrace {
231
- source : EntryPointExecutionError :: ExecutionFailed {
232
- error_trace : extract_trailing_cairo1_revert_trace (
233
- & res. call_info ,
234
- Cairo1RevertHeader :: Execution ,
235
- ) ,
236
- } ,
237
- trace : res. vm_trace ,
224
+ return Err ( EntryPointExecutionError :: ExecutionFailed {
225
+ error_trace : extract_trailing_cairo1_revert_trace (
226
+ & res. call_info ,
227
+ Cairo1RevertHeader :: Execution ,
228
+ ) ,
238
229
} ) ;
239
230
}
240
231
Ok ( res)
@@ -247,12 +238,12 @@ fn evaluate_execution_result(
247
238
248
239
#[ expect( clippy:: result_large_err) ]
249
240
fn handle_entry_point_execution_error (
250
- err : EntryPointExecutionErrorWithTrace ,
241
+ err : EntryPointExecutionError ,
251
242
call : ExecutableCallEntryPoint ,
252
243
current_tracked_resource : TrackedResource ,
253
244
is_revertable : bool ,
254
245
) -> ContractClassEntryPointExecutionResult {
255
- if let EntryPointExecutionError :: PreExecutionError ( pre_err) = & err. source {
246
+ if let EntryPointExecutionError :: PreExecutionError ( pre_err) = & err {
256
247
match pre_err {
257
248
PreExecutionError :: EntryPointNotFound ( _)
258
249
| PreExecutionError :: NoEntryPointOfTypeFound ( _)
@@ -296,7 +287,6 @@ fn call_info_from_pre_execution_error(
296
287
} ,
297
288
syscall_usage_vm_resources : SyscallUsageMap :: default ( ) ,
298
289
syscall_usage_sierra_gas : SyscallUsageMap :: default ( ) ,
299
- vm_trace : None ,
300
290
}
301
291
}
302
292
@@ -305,7 +295,6 @@ fn exit_non_error_call(
305
295
syscall_usage_vm_resources : & SyscallUsageMap ,
306
296
syscall_usage_sierra_gas : & SyscallUsageMap ,
307
297
cheatnet_state : & mut CheatnetState ,
308
- vm_trace : Option < Vec < RelocatedTraceEntry > > ,
309
298
signature : Vec < Felt > ,
310
299
) {
311
300
let nested_syscall_usage_vm_resources =
@@ -327,7 +316,6 @@ fn exit_non_error_call(
327
316
syscall_usage_sierra_gas,
328
317
CallResult :: from_non_error ( call_info) ,
329
318
& call_info. execution . l2_to_l1_messages ,
330
- vm_trace,
331
319
signature,
332
320
call_info. execution . events . clone ( ) ,
333
321
) ;
@@ -337,7 +325,6 @@ fn exit_error_call(
337
325
error : & EntryPointExecutionError ,
338
326
cheatnet_state : & mut CheatnetState ,
339
327
entry_point : & ExecutableCallEntryPoint ,
340
- vm_trace : Option < Vec < RelocatedTraceEntry > > ,
341
328
) {
342
329
let identifier = match entry_point. call_type {
343
330
CallType :: Call => AddressOrClassHash :: ContractAddress ( entry_point. storage_address ) ,
@@ -350,7 +337,6 @@ fn exit_error_call(
350
337
SyscallUsageMap :: default ( ) ,
351
338
CallResult :: from_err ( error, & identifier) ,
352
339
& [ ] ,
353
- vm_trace,
354
340
vec ! [ ] ,
355
341
vec ! [ ] ,
356
342
) ;
@@ -445,39 +431,18 @@ fn mocked_call_info(
445
431
}
446
432
}
447
433
448
- #[ derive( Debug , Error ) ]
449
- #[ error( "{}" , source) ]
450
- pub struct EntryPointExecutionErrorWithTrace {
451
- pub source : EntryPointExecutionError ,
452
- pub trace : Option < Vec < RelocatedTraceEntry > > ,
453
- }
454
-
455
- impl < T > From < T > for EntryPointExecutionErrorWithTrace
456
- where
457
- T : Into < EntryPointExecutionError > ,
458
- {
459
- fn from ( value : T ) -> Self {
460
- Self {
461
- source : value. into ( ) ,
462
- trace : None ,
463
- }
464
- }
465
- }
466
-
467
434
pub ( crate ) fn extract_trace_and_register_errors (
468
- source : EntryPointExecutionError ,
469
435
class_hash : ClassHash ,
470
436
runner : & mut CairoRunner ,
471
437
cheatnet_state : & mut CheatnetState ,
472
- ) -> EntryPointExecutionErrorWithTrace {
438
+ ) {
473
439
let trace = get_relocated_vm_trace ( runner) ;
440
+ cheatnet_state
441
+ . trace_data
442
+ . set_vm_trace_for_current_call ( trace) ;
443
+
474
444
let pcs = runner. vm . get_reversed_pc_traceback ( ) ;
475
445
cheatnet_state. register_error ( class_hash, pcs) ;
476
-
477
- EntryPointExecutionErrorWithTrace {
478
- source,
479
- trace : Some ( trace) ,
480
- }
481
446
}
482
447
483
448
/// This helper function is used for backtrace to avoid displaying errors that were already handled
0 commit comments