From 169a57d0fbde64c688541bd4e918abc51d3bf16d Mon Sep 17 00:00:00 2001 From: AvivYossef-starkware Date: Tue, 19 Nov 2024 16:10:24 +0200 Subject: [PATCH] test(blockifier): replace class revert test(blockifier): replace class revert --- .../blockifier/feature_contracts/cairo1/test_contract.cairo | 4 +++- .../src/execution/syscalls/syscall_tests/call_contract.rs | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/blockifier/feature_contracts/cairo1/test_contract.cairo b/crates/blockifier/feature_contracts/cairo1/test_contract.cairo index 5b1994aa2a..67ca9db437 100644 --- a/crates/blockifier/feature_contracts/cairo1/test_contract.cairo +++ b/crates/blockifier/feature_contracts/cairo1/test_contract.cairo @@ -624,6 +624,7 @@ mod TestContract { entry_point_selector: felt252, calldata: Array:: ) { + let class_hash_before_call = syscalls::get_class_hash_at_syscall(contract_address).unwrap_syscall(); match syscalls::call_contract_syscall( contract_address, entry_point_selector, calldata.span()) { @@ -642,7 +643,8 @@ mod TestContract { } }, }; - // TODO(Yoni, 1/12/2024): test replace class once get_class_hash_at syscall is supported. + let class_hash_after_call = syscalls::get_class_hash_at_syscall(contract_address).unwrap_syscall(); assert(self.my_storage_var.read() == 0, 'values should not change.'); + assert(class_hash_before_call == class_hash_after_call, 'class hash should not change.'); } } diff --git a/crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs b/crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs index cd34175b7a..b3d64d74a2 100644 --- a/crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs +++ b/crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs @@ -16,7 +16,6 @@ use crate::execution::call_info::CallExecution; use crate::execution::contract_class::TrackedResource; use crate::execution::entry_point::CallEntryPoint; use crate::retdata; -use crate::state::state_api::StateReader; use crate::test_utils::contracts::FeatureContract; use crate::test_utils::initial_test_state::test_state; use crate::test_utils::syscall::build_recurse_calldata; @@ -62,10 +61,6 @@ fn test_call_contract_that_panics() { ); assert!(inner_call.execution.events.is_empty()); assert!(inner_call.execution.l2_to_l1_messages.is_empty()); - assert_eq!( - state.get_class_hash_at(inner_call.call.storage_address).unwrap(), - test_contract.get_class_hash() - ); } #[cfg_attr(