Skip to content

Commit

Permalink
refactor(starknet_integration_tests): move indexed_component config c…
Browse files Browse the repository at this point in the history
…alculation to seperate function

commit-id:51c0eb4c
  • Loading branch information
nadin-Starkware committed Jan 19, 2025
1 parent 1504674 commit 526f954
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions crates/starknet_integration_tests/src/sequencer_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,20 +257,7 @@ pub(crate) async fn get_sequencer_setup_configs(
);

// Flatten while enumerating sequencer and sequencer part indices.
let indexed_component_configs: Vec<(SequencerExecutionId, ComponentConfig)> = component_configs
.into_iter()
.enumerate()
.flat_map(|(sequencer_index, parts_component_configs)| {
parts_component_configs.into_iter().enumerate().map(
move |(sequencer_part_index, parts_component_config)| {
(
SequencerExecutionId::new(sequencer_index, sequencer_part_index),
parts_component_config,
) // Combine indices with the value
},
)
})
.collect();
let indexed_component_configs = get_indexed_component_configs(component_configs);

// TODO(Nadin/Tsabary): There are redundant p2p configs here, as each distributed node
// needs only one of them, but the current setup creates one per part. Need to refactor.
Expand Down Expand Up @@ -335,6 +322,25 @@ async fn create_sequencer_setups(
.await
}

fn get_indexed_component_configs(
component_configs: Vec<ComposedComponentConfigs>,
) -> Vec<(SequencerExecutionId, ComponentConfig)> {
component_configs
.into_iter()
.enumerate()
.flat_map(|(sequencer_index, parts_component_configs)| {
parts_component_configs.into_iter().enumerate().map(
move |(sequencer_part_index, parts_component_config)| {
(
SequencerExecutionId::new(sequencer_index, sequencer_part_index),
parts_component_config,
) // Combine indices with the value
},
)
})
.collect()
}

/// Generates configurations for a specified number of distributed sequencer nodes,
/// each consisting of an HTTP component configuration and a non-HTTP component configuration.
/// returns a vector of vectors, where each inner vector contains the two configurations.
Expand Down

0 comments on commit 526f954

Please sign in to comment.