Skip to content

Commit

Permalink
refactor: simplify state-reader iteration
Browse files Browse the repository at this point in the history
`prepare_compiled_contract_classes` should know about stuff it
isn't using.
  • Loading branch information
Gilad Chase committed Jul 11, 2024
1 parent 7c08d83 commit 6892605
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/tests-integration/src/state_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ fn initialize_papyrus_test_state(
fund_additional_accounts,
);

let contracts = contract_instances.iter().map(|(contract, _n_instances_of_contract)| *contract);
let (cairo0_contract_classes, cairo1_contract_classes) =
prepare_compiled_contract_classes(contract_instances);
prepare_compiled_contract_classes(contracts);

write_state_to_papyrus_storage(state_diff, &cairo0_contract_classes, &cairo1_contract_classes)
}
Expand Down Expand Up @@ -152,11 +153,11 @@ fn prepare_state_diff(
}

fn prepare_compiled_contract_classes(
contract_instances: &[(FeatureContract, usize)],
contract_instances: impl Iterator<Item = FeatureContract>,
) -> ContractClassesMap {
let mut cairo0_contract_classes = Vec::new();
let mut cairo1_contract_classes = Vec::new();
for (contract, _) in contract_instances.iter() {
for contract in contract_instances {
match contract.cairo_version() {
CairoVersion::Cairo0 => {
cairo0_contract_classes.push((
Expand Down

0 comments on commit 6892605

Please sign in to comment.