Skip to content

Commit 4bdb20a

Browse files
starknet_os: os resources test - add 3 more syscalls
1 parent 18f0bed commit 4bdb20a

6 files changed

Lines changed: 24 additions & 17 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_1 = (
7272
0x06ecb73d21c7d98ddd4148f5bcd91cc2747c65364245fbf32a63b05cca1685c2
7373
);
7474
const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_2 = (
75-
0x028619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0
75+
0x06e0e4653c9bf533daba4c89a969a78f082fd2b7ebd38912ca8138441a897bea
7676
);
7777
const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_LEN = 3;
7878

@@ -110,9 +110,9 @@ const SYSCALL_BASE_GAS_COST = 10000;
110110
const CALL_CONTRACT_GAS_COST = 91360;
111111
const DEPLOY_GAS_COST = 151970;
112112
const DEPLOY_CALLDATA_FACTOR_GAS_COST = 4850;
113-
const GET_BLOCK_HASH_GAS_COST = 10840;
113+
const GET_BLOCK_HASH_GAS_COST = 10810;
114114
const GET_CLASS_HASH_AT_GAS_COST = 10000;
115-
const GET_EXECUTION_INFO_GAS_COST = 12640;
115+
const GET_EXECUTION_INFO_GAS_COST = 11240;
116116
const LIBRARY_CALL_GAS_COST = 88660;
117117
const REPLACE_CLASS_GAS_COST = 10670;
118118
// TODO(Yoni, 1/1/2026): take into account Patricia updates and dict squash.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"os": "0x6c751043e73e061179e08b9bc608ad2abcc46df4e4b552b05ed7ad6915ace0b",
3-
"virtual_os": "0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0",
2+
"os": "0x6953c7279f84f553ce738d580de5df707feef830c3ca1840829b6bbdf79db4e",
3+
"virtual_os": "0x6e0e4653c9bf533daba4c89a969a78f082fd2b7ebd38912ca8138441a897bea",
44
"aggregator": "0x700786d51b3854af43d8e12180380bda3029be6c1767e007858de6ca2edac40",
55
"aggregator_with_prefix": "0xe08d300e3f5996e43d6d7cc5a20068e0e58cf1309089f2348317ac580f6c1f"
66
}

crates/blockifier/resources/blockifier_versioned_constants_0_14_4.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
"allowed_virtual_os_program_hashes": [
129129
"0x3e98c2d7703b03a7edb73ed7f075f97f1dcbaa8f717cdf6e1a57bf058265473",
130130
"0x6ecb73d21c7d98ddd4148f5bcd91cc2747c65364245fbf32a63b05cca1685c2",
131-
"0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0"
131+
"0x6e0e4653c9bf533daba4c89a969a78f082fd2b7ebd38912ca8138441a897bea"
132132
],
133133
"constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
134134
"default_entry_point_selector": "0x0",
@@ -270,10 +270,10 @@
270270
}
271271
},
272272
"GetBlockHash": {
273-
"n_steps": 107,
273+
"n_steps": 106,
274274
"n_memory_holes": 0,
275275
"builtin_instance_counter": {
276-
"range_check_builtin": 2
276+
"range_check_builtin": 3
277277
}
278278
},
279279
"GetBlockNumber": {
@@ -294,7 +294,7 @@
294294
}
295295
},
296296
"GetClassHashAt": {
297-
"n_steps": 89,
297+
"n_steps": 75,
298298
"n_memory_holes": 0,
299299
"builtin_instance_counter": {
300300
"range_check_builtin": 1
@@ -308,7 +308,7 @@
308308
}
309309
},
310310
"GetExecutionInfo": {
311-
"n_steps": 125,
311+
"n_steps": 111,
312312
"n_memory_holes": 0,
313313
"builtin_instance_counter": {
314314
"range_check_builtin": 2

crates/blockifier/resources/versioned_constants_diff_regression/0.14.3_0.14.4.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
+ /os_constants/allowed_virtual_os_program_hashes/2: "0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0"
1+
+ /os_constants/allowed_virtual_os_program_hashes/2: "0x6e0e4653c9bf533daba4c89a969a78f082fd2b7ebd38912ca8138441a897bea"
22
~ /os_resources/execute_syscalls/CallContract/n_steps: 901
33
~ /os_resources/execute_syscalls/Deploy/constant/builtin_instance_counter/pedersen_builtin: 8
44
~ /os_resources/execute_syscalls/Deploy/constant/n_steps: 1183

crates/blockifier_test_utils/resources/feature_contracts/cairo1/os_resources_test_contract.cairo

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ mod OsResourcesTestContract {
44
use starknet::class_hash::ClassHashZero;
55
use starknet::info::SyscallResultTrait;
66
use starknet::syscalls::{
7-
call_contract_syscall, deploy_syscall, emit_event_syscall, library_call_syscall,
7+
call_contract_syscall, deploy_syscall, emit_event_syscall, get_execution_info_v2_syscall,
8+
library_call_syscall,
89
};
9-
use starknet::{ClassHash, ContractAddress};
10+
use starknet::{ClassHash, ContractAddress, get_block_hash_syscall, get_class_hash_at_syscall};
1011

1112
const STABLE_EXTERNAL_ENTRY_POINT_SELECTOR: felt252 = selector!("external");
1213
const EXECUTE_FUNCTION_SELECTOR: felt252 = selector!("__execute__");
@@ -79,5 +80,14 @@ mod OsResourcesTestContract {
7980

8081
// emit event syscall.
8182
emit_event_syscall(array![5].span(), array![7].span()).unwrap_syscall();
83+
84+
// get block hash syscall.
85+
get_block_hash_syscall(0_u64).unwrap_syscall();
86+
87+
// get class hash at syscall.
88+
get_class_hash_at_syscall(stable_address).unwrap_syscall();
89+
90+
// get execution info syscall.
91+
get_execution_info_v2_syscall().unwrap_syscall();
8292
}
8393
}

crates/starknet_os_flow_tests/src/os_resources_test.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,13 @@ use crate::test_manager::{
4343
use crate::tests::NON_TRIVIAL_RESOURCE_BOUNDS;
4444

4545
// TODO(Dori): Delete this, or at least reduce it to a minimal set of unmeasurable syscalls.
46-
const UNMEASURABLE_SYSCALLS: [Selector; 31] = [
46+
const UNMEASURABLE_SYSCALLS: [Selector; 28] = [
4747
Selector::DelegateCall,
4848
Selector::DelegateL1Handler,
49-
Selector::GetBlockHash,
5049
Selector::GetBlockNumber,
5150
Selector::GetBlockTimestamp,
5251
Selector::GetCallerAddress,
53-
Selector::GetClassHashAt,
5452
Selector::GetContractAddress,
55-
Selector::GetExecutionInfo,
5653
Selector::GetSequencerAddress,
5754
Selector::GetTxInfo,
5855
Selector::GetTxSignature,

0 commit comments

Comments
 (0)