Skip to content

Commit e55a063

Browse files
starknet_os: os resources test - add 3 more syscalls
1 parent cd7ac82 commit e55a063

5 files changed

Lines changed: 28 additions & 18 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ const SYSCALL_BASE_GAS_COST = 10000;
105105

106106
// Syscall gas costs.
107107
const CALL_CONTRACT_GAS_COST = 91160;
108-
const DEPLOY_GAS_COST = 151670;
109-
const DEPLOY_CALLDATA_FACTOR_GAS_COST = 5050;
110-
const GET_BLOCK_HASH_GAS_COST = 10840;
108+
const DEPLOY_GAS_COST = 151870;
109+
const DEPLOY_CALLDATA_FACTOR_GAS_COST = 4650;
110+
const GET_BLOCK_HASH_GAS_COST = 10810;
111111
const GET_CLASS_HASH_AT_GAS_COST = 10000;
112-
const GET_EXECUTION_INFO_GAS_COST = 12640;
112+
const GET_EXECUTION_INFO_GAS_COST = 11240;
113113
const LIBRARY_CALL_GAS_COST = 88460;
114114
const REPLACE_CLASS_GAS_COST = 10670;
115115
// 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": "0x5b8231cecc8a39079e941218abfc486097369f888638f9675b1f04bb24af57",
3-
"virtual_os": "0x1689e4a3bb32dd81c66ee660a9ca05aad72309b38ba5cbac0ffec782e5b8154",
2+
"os": "0x769d28e62bb261f8b7a535c9007361344abd5458f559bcbaee8f9b4897864f6",
3+
"virtual_os": "0x4ccaaed5759efad1372b08a0719839fcf22c28f1ae8b0744a4ad95a20a628ff",
44
"aggregator": "0x700786d51b3854af43d8e12180380bda3029be6c1767e007858de6ca2edac40",
55
"aggregator_with_prefix": "0xe08d300e3f5996e43d6d7cc5a20068e0e58cf1309089f2348317ac580f6c1f"
66
}

crates/blockifier/resources/blockifier_versioned_constants_0_14_3.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,15 @@
247247
},
248248
"Deploy": {
249249
"constant": {
250-
"n_steps": 1178,
250+
"n_steps": 1180,
251251
"n_memory_holes": 0,
252252
"builtin_instance_counter": {
253253
"range_check_builtin": 21,
254254
"pedersen_builtin": 8
255255
}
256256
},
257257
"calldata_factor": {
258-
"n_steps": 10,
258+
"n_steps": 6,
259259
"n_memory_holes": 0,
260260
"builtin_instance_counter": {
261261
"pedersen_builtin": 1
@@ -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_test_utils/resources/feature_contracts/cairo1/os_resources_test_contract.cairo

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ 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,
8+
deploy_syscall,
9+
emit_event_syscall,
10+
get_execution_info_v2_syscall,
11+
library_call_syscall,
812
};
9-
use starknet::{ClassHash, ContractAddress};
13+
use starknet::{ClassHash, ContractAddress, get_block_hash_syscall, get_class_hash_at_syscall};
1014

1115
const EMPTY_FUNCTION_SELECTOR: felt252 = selector!("empty_function");
1216
const EXECUTE_FUNCTION_SELECTOR: felt252 = selector!("__execute__");
@@ -86,6 +90,15 @@ mod OsResourcesTestContract {
8690

8791
// emit event syscall.
8892
emit_event_syscall(array![5].span(), array![7].span()).unwrap_syscall();
93+
94+
// get block hash syscall.
95+
get_block_hash_syscall(0_u64).unwrap_syscall();
96+
97+
// get class hash at syscall.
98+
get_class_hash_at_syscall(self_address).unwrap_syscall();
99+
100+
// get execution info syscall.
101+
get_execution_info_v2_syscall().unwrap_syscall();
89102
}
90103

91104
// Target for call_contract and library_call — accepts no arguments.

crates/starknet_os_flow_tests/src/os_resources_test.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,13 @@ use crate::tests::NON_TRIVIAL_RESOURCE_BOUNDS;
3131
use crate::utils::get_class_hash_of_feature_contract;
3232

3333
// TODO(Dori): Delete this, or at least reduce it to a minimal set of unmeasurable syscalls.
34-
const UNMEASURABLE_SYSCALLS: [Selector; 30] = [
34+
const UNMEASURABLE_SYSCALLS: [Selector; 27] = [
3535
Selector::DelegateCall,
3636
Selector::DelegateL1Handler,
37-
Selector::GetBlockHash,
3837
Selector::GetBlockNumber,
3938
Selector::GetBlockTimestamp,
4039
Selector::GetCallerAddress,
41-
Selector::GetClassHashAt,
4240
Selector::GetContractAddress,
43-
Selector::GetExecutionInfo,
4441
Selector::GetSequencerAddress,
4542
Selector::GetTxInfo,
4643
Selector::GetTxSignature,

0 commit comments

Comments
 (0)