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 = (
0x028619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0
0x06e0e4653c9bf533daba4c89a969a78f082fd2b7ebd38912ca8138441a897bea
);
const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_LEN = 3;

Expand Down Expand Up @@ -110,9 +110,9 @@ const SYSCALL_BASE_GAS_COST = 10000;
const CALL_CONTRACT_GAS_COST = 91360;
const DEPLOY_GAS_COST = 147120;
const DEPLOY_CALLDATA_FACTOR_GAS_COST = 4850;
const GET_BLOCK_HASH_GAS_COST = 10840;
const GET_BLOCK_HASH_GAS_COST = 10810;
const GET_CLASS_HASH_AT_GAS_COST = 10000;
const GET_EXECUTION_INFO_GAS_COST = 12640;
const GET_EXECUTION_INFO_GAS_COST = 11240;
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.
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": "0x3b216483cdefd7903a48dd65009f8a02dd5e069419d91e2ea4e5a9f22217cf5",
"virtual_os": "0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0",
"os": "0xb641e53a41bb87cb8f71b6e80fda261c4ab2cde062235cacbe79e2c88564de",
"virtual_os": "0x6e0e4653c9bf533daba4c89a969a78f082fd2b7ebd38912ca8138441a897bea",
"aggregator": "0x700786d51b3854af43d8e12180380bda3029be6c1767e007858de6ca2edac40",
"aggregator_with_prefix": "0xe08d300e3f5996e43d6d7cc5a20068e0e58cf1309089f2348317ac580f6c1f"
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"allowed_virtual_os_program_hashes": [
"0x3e98c2d7703b03a7edb73ed7f075f97f1dcbaa8f717cdf6e1a57bf058265473",
"0x6ecb73d21c7d98ddd4148f5bcd91cc2747c65364245fbf32a63b05cca1685c2",
"0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0"
"0x6e0e4653c9bf533daba4c89a969a78f082fd2b7ebd38912ca8138441a897bea"
],
"constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
"default_entry_point_selector": "0x0",
Expand Down Expand Up @@ -271,10 +271,10 @@
}
},
"GetBlockHash": {
"n_steps": 107,
"n_steps": 106,
"n_memory_holes": 0,
"builtin_instance_counter": {
"range_check_builtin": 2
"range_check_builtin": 3
}
},
"GetBlockNumber": {
Expand All @@ -295,7 +295,7 @@
}
},
"GetClassHashAt": {
"n_steps": 89,
"n_steps": 75,
"n_memory_holes": 0,
"builtin_instance_counter": {
"range_check_builtin": 1
Expand All @@ -309,7 +309,7 @@
}
},
"GetExecutionInfo": {
"n_steps": 125,
"n_steps": 111,
"n_memory_holes": 0,
"builtin_instance_counter": {
"range_check_builtin": 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
+ /os_constants/allowed_virtual_os_program_hashes/2: "0x28619dbc9767792fb536aaba7a2d55f70faadf808c95ec66b956d33fdee1bc0"
+ /os_constants/allowed_virtual_os_program_hashes/2: "0x6e0e4653c9bf533daba4c89a969a78f082fd2b7ebd38912ca8138441a897bea"
Comment thread
cursor[bot] marked this conversation as resolved.
~ /os_resources/execute_syscalls/CallContract/n_steps: 901
~ /os_resources/execute_syscalls/EmitEvent/n_steps: 47
~ /os_resources/execute_syscalls/GetBlockHash/builtin_instance_counter/range_check_builtin: 3
~ /os_resources/execute_syscalls/GetBlockHash/n_steps: 106
~ /os_resources/execute_syscalls/GetClassHashAt/n_steps: 75
~ /os_resources/execute_syscalls/GetExecutionInfo/n_steps: 111
~ /os_resources/execute_syscalls/LibraryCall/n_steps: 874
~ /os_resources/execute_syscalls/MetaTxV0/constant/n_steps: 1307
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub const REQUIRED_GAS_GET_BLOCK_HASH_TEST: u64 = 10840;
pub const REQUIRED_GAS_GET_BLOCK_HASH_TEST: u64 = 10810;
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn positive_flow(runnable_version: RunnableCairo1) {
l2_to_l1_messages: [],
cairo_native: false,
failed: false,
gas_consumed: 14850,
gas_consumed: 14820,
}
"#]]
.assert_debug_eq(&call_info.execution);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ fn test_meta_tx_v0(
assert_eq!(call_info.execution.gas_consumed, 0);
expect![[r#"
DeterministicExecutionResources {
n_steps: 14851,
n_steps: 14795,
n_memory_holes: 10,
builtin_instance_counter: {
"pedersen_builtin": 12,
Expand All @@ -197,7 +197,7 @@ fn test_meta_tx_v0(
l2_to_l1_messages: [],
cairo_native: false,
failed: false,
gas_consumed: 1538850,
gas_consumed: 1533250,
}
"#]]
.assert_debug_eq(&call_info.execution);
Expand Down
6 changes: 3 additions & 3 deletions crates/blockifier/src/transaction/transactions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ fn expected_fee_transfer_call_info(
};
let expected_gas_consumed = match cairo_version {
CairoVersion::Cairo0 => 0_u64,
CairoVersion::Cairo1(_) => 414470_u64,
CairoVersion::Cairo1(_) => 413070_u64,
};
let expected_resources = match cairo_version {
CairoVersion::Cairo0 => Prices::FeeTransfer(account_address, *fee_type).into(),
Expand Down Expand Up @@ -591,15 +591,15 @@ fn add_kzg_da_resources_to_resources_mapping(
resources: ExtendedExecutionResources::default(),
validate_gas_consumed: 7820, // The gas consumption results from parsing the input
// arguments.
execute_gas_consumed: 113720,
execute_gas_consumed: 112320,
},
CairoVersion::Cairo1(RunnableCairo1::Casm))]
#[cfg_attr(feature = "cairo_native", case::with_cairo1_native_account(
ExpectedResultTestInvokeTx{
resources: ExtendedExecutionResources::default(),
validate_gas_consumed: 7820, // The gas consumption results from parsing the input
// arguments.
execute_gas_consumed: 113720,
execute_gas_consumed: 112320,
},
CairoVersion::Cairo1(RunnableCairo1::Native)))]
// TODO(Tzahi): Add calls to cairo1 test contracts (where gas flows to and from the inner call).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
mod OsResourcesTestContract {
use starknet::info::SyscallResultTrait;
use starknet::syscalls::{
call_contract_syscall, deploy_syscall, emit_event_syscall, library_call_syscall,
call_contract_syscall, deploy_syscall, emit_event_syscall, get_execution_info_v3_syscall,
library_call_syscall,
};
use starknet::{ClassHash, ContractAddress};
use starknet::{ClassHash, ContractAddress, get_block_hash_syscall, get_class_hash_at_syscall};

const STABLE_EXTERNAL_ENTRY_POINT_SELECTOR: felt252 = selector!("external");
const EXECUTE_FUNCTION_SELECTOR: felt252 = selector!("__execute__");
Expand Down Expand Up @@ -83,5 +84,18 @@ mod OsResourcesTestContract {

// emit event syscall.
emit_event_syscall(array![5].span(), array![7].span()).unwrap_syscall();

// get block hash syscall.
// Only block numbers between `CURRENT_BLOCK_NUMBER - BLOCK_HASH_HISTORY_RANGE` and
// `CURRENT_BLOCK_NUMBER - 10` are set in storage during OS flow tests; at the time of
// writing this contract, `CURRENT_BLOCK_NUMBER` is 2001 and `BLOCK_HASH_HISTORY_RANGE` is
// 51.
get_block_hash_syscall(1970_u64).unwrap_syscall();

// get class hash at syscall.
get_class_hash_at_syscall(stable_address).unwrap_syscall();

// get execution info syscall.
get_execution_info_v3_syscall().unwrap_syscall();
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
29
31
10 changes: 5 additions & 5 deletions crates/central_systest_blobs/resources/preconfirmed_block.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"timestamp": 1013,
"transaction_receipts": [
{
"actual_fee": "0x108751",
"actual_fee": "0x1076e9",
"events": [
{
"data": [
"0x3d3759cf036b96f8105f40dcf3fe0c209be3419154aa458d03336ad0443ce81",
"0x1000",
"0x108751",
"0x1076e9",
"0x0"
],
"from_address": "0x6c6a50ee425e9ff35846be376051b8cdbdc1aadc6c954209fe3fd247a571b33",
Expand All @@ -51,7 +51,7 @@
"total_gas_consumed": {
"l1_data_gas": 0,
"l1_gas": 1652,
"l2_gas": 1081565
"l2_gas": 1077365
}
},
"execution_status": "SUCCEEDED",
Expand All @@ -74,11 +74,11 @@
"0x6c6a50ee425e9ff35846be376051b8cdbdc1aadc6c954209fe3fd247a571b33": [
{
"key": "0x2cbac7495ce24b399327e9282b09d029b1dd772b24b7e8dcd0467fedab5af58",
"value": "0xfffffffffffffffffffffffff98b7ba3"
"value": "0xfffffffffffffffffffffffff98c1fb3"
},
{
"key": "0x723973208639b7839ce298f7ffea61e3f9533872defd7abdb91023db4658812",
"value": "0x674845c"
"value": "0x673e04c"
}
]
}
Expand Down
5 changes: 1 addition & 4 deletions crates/starknet_os_flow_tests/src/os_resources_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,13 @@ use crate::test_manager::{
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; 31] = [
const UNMEASURABLE_SYSCALLS: [Selector; 28] = [
Selector::DelegateCall,
Selector::DelegateL1Handler,
Selector::GetBlockHash,
Selector::GetBlockNumber,
Selector::GetBlockTimestamp,
Selector::GetCallerAddress,
Selector::GetClassHashAt,
Selector::GetContractAddress,
Selector::GetExecutionInfo,
Selector::GetSequencerAddress,
Selector::GetTxInfo,
Selector::GetTxSignature,
Expand Down
Loading