Skip to content

Commit 8be4f98

Browse files
starknet_os: os resources test - add replace_class
1 parent 61ef5ef commit 8be4f98

5 files changed

Lines changed: 8 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const GET_BLOCK_HASH_GAS_COST = 10810;
114114
const GET_CLASS_HASH_AT_GAS_COST = 10000;
115115
const GET_EXECUTION_INFO_GAS_COST = 11240;
116116
const LIBRARY_CALL_GAS_COST = 88660;
117-
const REPLACE_CLASS_GAS_COST = 10670;
117+
const REPLACE_CLASS_GAS_COST = 10000;
118118
// TODO(Yoni, 1/1/2026): take into account Patricia updates and dict squash.
119119
const STORAGE_READ_GAS_COST = 24070;
120120
const STORAGE_WRITE_GAS_COST = 59970;

crates/apollo_starknet_os_program/src/program_hash.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"os": "0x643d546d56b7ff2fcf7a78062cc331fbfc5c53405741dd566c9f67cde6954da",
2+
"os": "0x3ab760e55c8e6396b6b37f16076c9038ef6750bcebed93827b884194940fd53",
33
"virtual_os": "0x66a46bb88553c4dafd12959575033660780d689c99659ab3620e2f524f71701",
44
"aggregator": "0x700786d51b3854af43d8e12180380bda3029be6c1767e007858de6ca2edac40",
55
"aggregator_with_prefix": "0xe08d300e3f5996e43d6d7cc5a20068e0e58cf1309089f2348317ac580f6c1f"

crates/blockifier/resources/blockifier_versioned_constants_0_14_4.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@
377377
}
378378
},
379379
"ReplaceClass": {
380-
"n_steps": 106,
380+
"n_steps": 92,
381381
"n_memory_holes": 0,
382382
"builtin_instance_counter": {
383383
"range_check_builtin": 1

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod OsResourcesTestContract {
77
use starknet::info::SyscallResultTrait;
88
use starknet::syscalls::{
99
call_contract_syscall, deploy_syscall, emit_event_syscall, get_execution_info_v2_syscall,
10-
keccak_syscall, library_call_syscall, sha256_process_block_syscall,
10+
keccak_syscall, library_call_syscall, replace_class_syscall, sha256_process_block_syscall,
1111
};
1212
use starknet::{ClassHash, ContractAddress, get_block_hash_syscall, get_class_hash_at_syscall};
1313

@@ -118,6 +118,9 @@ mod OsResourcesTestContract {
118118
let mut input = BoxTrait::new([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
119119
let mut state = sha256_state_handle_init(BoxTrait::new(SHA256_INITIAL_STATE));
120120
let _ = sha256_process_block_syscall(state, input).unwrap_syscall();
121+
122+
// replace class syscall.
123+
replace_class_syscall(self_class_hash).unwrap_syscall();
121124
}
122125

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

crates/starknet_os_flow_tests/src/os_resources_test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use crate::tests::NON_TRIVIAL_RESOURCE_BOUNDS;
4545
use crate::utils::get_class_hash_of_feature_contract;
4646

4747
// TODO(Dori): Delete this, or at least reduce it to a minimal set of unmeasurable syscalls.
48-
const UNMEASURABLE_SYSCALLS: [Selector; 25] = [
48+
const UNMEASURABLE_SYSCALLS: [Selector; 24] = [
4949
Selector::DelegateCall,
5050
Selector::DelegateL1Handler,
5151
Selector::GetBlockNumber,
@@ -57,7 +57,6 @@ const UNMEASURABLE_SYSCALLS: [Selector; 25] = [
5757
Selector::GetTxSignature,
5858
Selector::Sha512ProcessBlock,
5959
Selector::LibraryCallL1Handler,
60-
Selector::ReplaceClass,
6160
Selector::Secp256k1Add,
6261
Selector::Secp256k1GetPointFromX,
6362
Selector::Secp256k1GetXy,

0 commit comments

Comments
 (0)