1
1
use blockifier:: execution:: deprecated_syscalls:: deprecated_syscall_executor:: execute_next_deprecated_syscall;
2
2
use blockifier:: execution:: deprecated_syscalls:: hint_processor:: DeprecatedSyscallExecutionError ;
3
3
use blockifier:: execution:: deprecated_syscalls:: DeprecatedSyscallSelector ;
4
- use blockifier:: execution:: execution_utils:: felt_from_ptr;
5
4
use blockifier:: state:: state_api:: StateReader ;
6
5
use cairo_vm:: hint_processor:: builtin_hint_processor:: hint_utils:: get_ptr_from_var_name;
7
6
use paste:: paste;
8
7
9
- use crate :: hints:: error:: OsHintError :: DeprecatedSyscallExecution ;
10
8
use crate :: hints:: error:: OsHintResult ;
11
9
use crate :: hints:: types:: HintArgs ;
12
10
use crate :: hints:: vars:: { Ids , Scope } ;
@@ -22,11 +20,37 @@ use crate::syscall_handler_utils::SyscallHandlerType;
22
20
/// Expands to:
23
21
///
24
22
/// pub(crate) fn get_block_number<S: StateReader>(
25
- /// HintArgs { hint_processor, vm, ids_data, ap_tracking, .. }: HintArgs<'_, '_, S>,
23
+ /// HintArgs { hint_processor, vm, ids_data, ap_tracking, exec_scopes, .. }: HintArgs<'_, '_, S>,
26
24
/// ) -> OsHintResult
27
25
/// {
26
+ /// assert_eq!(
27
+ /// exec_scopes.get(Scope::SyscallHandlerType.into())?,
28
+ /// SyscallHandlerType::DeprecatedSyscallHandler
29
+ /// );
28
30
/// let syscall_hint_processor = &mut hint_processor.deprecated_syscall_hint_processor;
29
- /// Ok(execute_next_deprecated_syscall(syscall_hint_processor, vm, ids_data, ap_tracking)?)
31
+ /// let syscall_ptr = get_ptr_from_var_name(
32
+ /// Ids::SyscallPtr.into(), vm, ids_data, ap_tracking)?;
33
+ /// let syscall_selector = DeprecatedSyscallSelector::try_from(
34
+ /// vm.get_integer(syscall_ptr)?.into_owned()
35
+ /// )?;
36
+ /// let expected_selector = paste! { DeprecatedSyscallSelector::[$name:camel] };
37
+ /// if syscall_selector != expected_selector {
38
+ /// return Err(
39
+ /// DeprecatedSyscallExecutionError::BadSyscallSelector {
40
+ /// expected_selector,
41
+ /// actual_selector: syscall_selector,
42
+ /// }.into()
43
+ /// );
44
+ /// }
45
+ /// syscall_hint_processor.set_syscall_ptr(syscall_ptr);
46
+ /// Ok(
47
+ /// execute_next_deprecated_syscall(
48
+ /// syscall_hint_processor,
49
+ /// vm,
50
+ /// ids_data,
51
+ /// ap_tracking
52
+ /// )?
53
+ /// )
30
54
/// }
31
55
macro_rules! create_syscall_func {
32
56
( $( $name: ident) ,+) => {
@@ -55,12 +79,10 @@ macro_rules! create_syscall_func {
55
79
let expected_selector = paste! { DeprecatedSyscallSelector :: [ <$name: camel>] } ;
56
80
if syscall_selector != expected_selector {
57
81
return Err (
58
- DeprecatedSyscallExecution (
59
- DeprecatedSyscallExecutionError :: BadSyscallSelector {
60
- expected_selector,
61
- actual_selector: syscall_selector,
62
- }
63
- )
82
+ DeprecatedSyscallExecutionError :: BadSyscallSelector {
83
+ expected_selector,
84
+ actual_selector: syscall_selector,
85
+ } . into( )
64
86
) ;
65
87
}
66
88
syscall_hint_processor. set_syscall_ptr( syscall_ptr) ;
0 commit comments