Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_1 = (
0x06ecb73d21c7d98ddd4148f5bcd91cc2747c65364245fbf32a63b05cca1685c2
);
const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_2 = (
0x059a0052ae80a978ca71126c9774a17c67c19f79b14bb9d1ea96fb77dc6032d8
0x028619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0
);
const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_LEN = 3;

Expand Down Expand Up @@ -113,7 +113,7 @@ const DEPLOY_CALLDATA_FACTOR_GAS_COST = 4850;
const GET_BLOCK_HASH_GAS_COST = 10840;
const GET_CLASS_HASH_AT_GAS_COST = 10000;
const GET_EXECUTION_INFO_GAS_COST = 12640;
const LIBRARY_CALL_GAS_COST = 89160;
const LIBRARY_CALL_GAS_COST = 88660;
const REPLACE_CLASS_GAS_COST = 10670;
// TODO(Yoni, 1/1/2026): take into account Patricia updates and dict squash.
const STORAGE_READ_GAS_COST = 24070;
Expand Down
4 changes: 2 additions & 2 deletions crates/apollo_starknet_os_program/src/program_hash.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"os": "0x47f5b47e73f1736037ea946704c57d9072f26d12beee01a55d947d87f779436",
"virtual_os": "0x59a0052ae80a978ca71126c9774a17c67c19f79b14bb9d1ea96fb77dc6032d8",
"os": "0x7b762f60dc1f9ecb199322522749de4e926c1eee33454764ae8974744ef0c5a",
"virtual_os": "0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0",
"aggregator": "0x700786d51b3854af43d8e12180380bda3029be6c1767e007858de6ca2edac40",
"aggregator_with_prefix": "0xe08d300e3f5996e43d6d7cc5a20068e0e58cf1309089f2348317ac580f6c1f"
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"allowed_virtual_os_program_hashes": [
"0x3e98c2d7703b03a7edb73ed7f075f97f1dcbaa8f717cdf6e1a57bf058265473",
"0x6ecb73d21c7d98ddd4148f5bcd91cc2747c65364245fbf32a63b05cca1685c2",
"0x59a0052ae80a978ca71126c9774a17c67c19f79b14bb9d1ea96fb77dc6032d8"
"0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0"
],
"constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
"default_entry_point_selector": "0x0",
Expand Down Expand Up @@ -346,7 +346,7 @@
}
},
"LibraryCall": {
"n_steps": 879,
"n_steps": 874,
"n_memory_holes": 0,
"builtin_instance_counter": {
"range_check_builtin": 18
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
+ /os_constants/allowed_virtual_os_program_hashes/2: "0x59a0052ae80a978ca71126c9774a17c67c19f79b14bb9d1ea96fb77dc6032d8"
+ /os_constants/allowed_virtual_os_program_hashes/2: "0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0"
~ /os_resources/execute_syscalls/CallContract/n_steps: 901
~ /os_resources/execute_syscalls/LibraryCall/n_steps: 874
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn test_library_call(runnable_version: RunnableCairo1) {
l2_to_l1_messages: [],
cairo_native: false,
failed: false,
gas_consumed: 189170,
gas_consumed: 188670,
}
"#]]
.assert_debug_eq(&execution);
Expand Down Expand Up @@ -108,7 +108,7 @@ fn test_library_call_assert_fails(runnable_version: RunnableCairo1) {
l2_to_l1_messages: [],
cairo_native: false,
failed: true,
gas_consumed: 109750,
gas_consumed: 109250,
}
"#]]
.assert_debug_eq(&call_info.execution);
Expand Down Expand Up @@ -153,7 +153,7 @@ fn test_nested_library_call(runnable_version: RunnableCairo1) {
..trivial_external_entry_point_new(test_contract)
};
let expected_nested_initial_gas = expect![[r#"
9999085250
9999086250
"#]];
let nested_storage_entry_point = CallEntryPoint {
entry_point_selector: inner_entry_point_selector,
Expand All @@ -165,7 +165,7 @@ fn test_nested_library_call(runnable_version: RunnableCairo1) {
..trivial_external_entry_point_new(test_contract)
};
let expected_library_initial_gas = expect![[r#"
9999185000
9999185500
"#]];
let library_entry_point = CallEntryPoint {
entry_point_selector: outer_entry_point_selector,
Expand All @@ -183,7 +183,7 @@ fn test_nested_library_call(runnable_version: RunnableCairo1) {
..trivial_external_entry_point_new(test_contract)
};
let expected_storage_initial_gas = expect![[r#"
9998916670
9998918170
"#]];
let storage_entry_point = CallEntryPoint {
calldata: calldata![felt!(key), felt!(value)],
Expand Down Expand Up @@ -223,7 +223,7 @@ fn test_nested_library_call(runnable_version: RunnableCairo1) {
};

let expected_library_call_gas_consumed = expect![[r#"
189170
188670
"#]];
let library_call_info = CallInfo {
call: library_entry_point,
Expand Down Expand Up @@ -269,7 +269,7 @@ fn test_nested_library_call(runnable_version: RunnableCairo1) {
};

let expected_main_gas_consumed = expect![[r#"
465190
463690
"#]];
let expected_call_info = CallInfo {
call: main_entry_point.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[starknet::contract(account)]
mod OsResourcesTestContract {
use starknet::info::SyscallResultTrait;
use starknet::syscalls::call_contract_syscall;
use starknet::syscalls::{call_contract_syscall, library_call_syscall};
use starknet::{ClassHash, ContractAddress};

const STABLE_EXTERNAL_ENTRY_POINT_SELECTOR: felt252 = selector!("external");
Expand Down Expand Up @@ -34,5 +34,11 @@ mod OsResourcesTestContract {
stable_address, STABLE_EXTERNAL_ENTRY_POINT_SELECTOR, array![0].span(),
)
.unwrap_syscall();

// library_call syscall — calls empty_function on stable class hash.
library_call_syscall(
stable_class_hash, STABLE_EXTERNAL_ENTRY_POINT_SELECTOR, array![0].span(),
)
.unwrap_syscall();
}
}
3 changes: 1 addition & 2 deletions crates/starknet_os_flow_tests/src/os_resources_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::test_manager::{TestBuilder, TestBuilderConfig, FUNDED_ACCOUNT_ADDRESS
use crate::tests::NON_TRIVIAL_RESOURCE_BOUNDS;

// TODO(Dori): Delete this, or at least reduce it to a minimal set of unmeasurable syscalls.
const UNMEASURABLE_SYSCALLS: [Selector; 35] = [
const UNMEASURABLE_SYSCALLS: [Selector; 34] = [
Selector::DelegateCall,
Selector::DelegateL1Handler,
Selector::Deploy,
Expand All @@ -55,7 +55,6 @@ const UNMEASURABLE_SYSCALLS: [Selector; 35] = [
Selector::KeccakRound,
Selector::Sha256ProcessBlock,
Selector::Sha512ProcessBlock,
Selector::LibraryCall,
Selector::LibraryCallL1Handler,
Selector::MetaTxV0,
Selector::ReplaceClass,
Expand Down
Loading