Skip to content

Commit

Permalink
test(blockifier): track contract 0x1 access via get_block_hash (#3906)
Browse files Browse the repository at this point in the history
  • Loading branch information
aner-starkware authored Feb 5, 2025
1 parent 70ab0cc commit 7b93eb6
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use pretty_assertions::assert_eq;
use starknet_api::abi::abi_utils::selector_from_name;
use starknet_api::block::{BlockHash, BlockNumber};
use starknet_api::execution_utils::format_panic_data;
use starknet_api::state::StorageKey;
use starknet_api::test_utils::CURRENT_BLOCK_NUMBER;
Expand Down Expand Up @@ -54,8 +55,22 @@ fn positive_flow(runnable_version: RunnableCairo1) {
..trivial_external_entry_point_new(test_contract)
};

let call_info = entry_point_call.clone().execute_directly(&mut state).unwrap();

assert_eq!(call_info.storage_access_tracker.accessed_blocks.len(), 1);
assert!(
call_info
.storage_access_tracker
.accessed_blocks
.contains(&BlockNumber(block_number.try_into().unwrap()))
);
assert_eq!(
call_info.storage_access_tracker.read_block_hash_values,
vec![BlockHash(block_hash)]
);

assert_eq!(
entry_point_call.clone().execute_directly(&mut state).unwrap().execution,
call_info.execution,
CallExecution {
gas_consumed: REQUIRED_GAS_GET_BLOCK_HASH_TEST,
..CallExecution::from_retdata(retdata![block_hash])
Expand Down

0 comments on commit 7b93eb6

Please sign in to comment.