Skip to content

Commit 51e2863

Browse files
apollo_starknet_os_program: prune deprecated syscalls code from the virtual OS (#11509)
1 parent 3da6da4 commit 51e2863

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

crates/apollo_starknet_os_program/src/cairo/starkware/starknet/core/os/os.cairo

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ from starkware.starknet.core.os.contract_class.compiled_class import (
3030
from starkware.starknet.core.os.contract_class.deprecated_compiled_class import (
3131
deprecated_load_compiled_class_facts,
3232
)
33-
from starkware.starknet.core.os.execution.deprecated_execute_syscalls import (
34-
execute_deprecated_syscalls,
35-
)
3633
from starkware.starknet.core.os.execution.execute_syscalls import execute_syscalls
3734
from starkware.starknet.core.os.execution.execute_transactions import execute_transactions
3835
from starkware.starknet.core.os.os_config.os_config import (
@@ -42,6 +39,7 @@ from starkware.starknet.core.os.os_config.os_config import (
4239
)
4340
from starkware.starknet.core.os.os_utils import (
4441
get_block_os_output_header,
42+
get_execute_deprecated_syscalls_ptr,
4543
get_virtual_os_config,
4644
pre_process_block,
4745
process_os_output,
@@ -310,9 +308,7 @@ func get_os_global_context{
310308

311309
// Function pointers.
312310
let (execute_syscalls_ptr) = get_label_location(label_value=execute_syscalls);
313-
let (execute_deprecated_syscalls_ptr) = get_label_location(
314-
label_value=execute_deprecated_syscalls
315-
);
311+
let (execute_deprecated_syscalls_ptr) = get_execute_deprecated_syscalls_ptr();
316312

317313
let virtual_os_config = get_virtual_os_config();
318314
tempvar os_global_context: OsGlobalContext* = new OsGlobalContext(

crates/apollo_starknet_os_program/src/cairo/starkware/starknet/core/os/os_utils.cairo

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from starkware.cairo.common.cairo_builtins import EcOpBuiltin, PoseidonBuiltin
33
from starkware.cairo.common.dict import dict_update
44
from starkware.cairo.common.dict_access import DictAccess
55
from starkware.cairo.common.math_cmp import is_nn
6+
from starkware.cairo.common.registers import get_label_location
67
from starkware.starknet.core.aggregator.combine_blocks import combine_blocks
78
from starkware.starknet.core.os.block_context import BlockContext, OsGlobalContext, VirtualOsConfig
89
from starkware.starknet.core.os.block_hash import get_block_hashes
@@ -17,6 +18,9 @@ from starkware.starknet.core.os.contract_class.compiled_class import CompiledCla
1718
from starkware.starknet.core.os.contract_class.poseidon_compiled_class_hash import (
1819
compiled_class_hash as poseidon_compiled_class_hash,
1920
)
21+
from starkware.starknet.core.os.execution.deprecated_execute_syscalls import (
22+
execute_deprecated_syscalls,
23+
)
2024
from starkware.starknet.core.os.output import OsOutput, OsOutputHeader, serialize_os_output
2125
from starkware.starknet.core.os.state.commitment import CommitmentUpdate, StateEntry
2226

@@ -193,3 +197,8 @@ func get_virtual_os_config() -> VirtualOsConfig* {
193197
);
194198
return virtual_os_config;
195199
}
200+
201+
// Returns a function pointer to execute_deprecated_syscalls.
202+
func get_execute_deprecated_syscalls_ptr() -> (res: felt*) {
203+
return get_label_location(label_value=execute_deprecated_syscalls);
204+
}

crates/apollo_starknet_os_program/src/cairo/starkware/starknet/core/os/os_utils__virtual.cairo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,9 @@ func get_virtual_os_config() -> VirtualOsConfig* {
9999
// The authorized account address will be set during transaction execution.
100100
return virtual_os_config;
101101
}
102+
103+
// Returns a function pointer to execute_deprecated_syscalls.
104+
// In virtual OS mode, deprecated syscalls are not supported, so we return 0.
105+
func get_execute_deprecated_syscalls_ptr() -> (res: felt*) {
106+
return (res=cast(0, felt*));
107+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"os": "0x7edaf9251ec7a175fe40f6831b301938db479ff67a3c817dc44ad1443188d52",
3-
"virtual_os": "0x3f526c2c3d0b4c2cd32817a976604f5ea84db5e1f947d8b61f5e666b9bc2d4c",
2+
"os": "0x61c7948fcef576eb2ebc29e32935936fce23a096df5f082a789d5088ca84a7b",
3+
"virtual_os": "0x49068c40ae9cc36fa84cd89ea7a2e6b66c4b257e9449235d6a68360e910716e",
44
"aggregator": "0x63868c8dbf389119d95bae88b80043f5d237d3ddec072fb8f2095fcfacb9b1c",
55
"aggregator_with_prefix": "0xd892fd2fd978d8c2749a6678457ca99161f3d1822e4c3b8c03914817c6de1a"
66
}

crates/apollo_starknet_os_program/src/virtual_os_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ fn test_virtual_os_swapped_files() {
1717
#[test]
1818
fn test_program_bytecode_lengths() {
1919
expect![[r#"
20-
15555
20+
15558
2121
"#]]
2222
.assert_debug_eq(&OS_PROGRAM.data_len());
2323
expect![[r#"
24-
12971
24+
12133
2525
"#]]
2626
.assert_debug_eq(&VIRTUAL_OS_PROGRAM.data_len());
2727
}

0 commit comments

Comments
 (0)