Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
test(concurrency): test the declared_contracts assertion in validate_…
Browse files Browse the repository at this point in the history
…reads
  • Loading branch information
OriStarkware committed Jun 13, 2024
1 parent 4505d16 commit e1cc317
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/blockifier/src/concurrency/versioned_state_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,20 @@ fn test_validate_reads(
);
}

#[rstest]
#[should_panic(expected = "assertion")]
fn test_validate_reads_panic(
safe_versioned_state: ThreadSafeVersionedState<CachedState<DictStateReader>>,
) {
let state_maps_to_validate = StateMaps {
declared_contracts: HashMap::from([(class_hash!(1_u8), false)]),
..Default::default()
};
let version_state_proxy = safe_versioned_state.pin_version(0);
version_state_proxy.state().declared_contracts.write(0, class_hash!(1_u8), true);
assert!(!safe_versioned_state.pin_version(1).validate_reads(&state_maps_to_validate));
}

#[rstest]
fn test_apply_writes(
contract_address: ContractAddress,
Expand Down

0 comments on commit e1cc317

Please sign in to comment.