From 207da80201e06a9166690dd6e1e29147819e5fa0 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Wed, 25 Dec 2024 18:01:17 +0200 Subject: [PATCH] chore(starknet_integration_tests): pass relevant ports to mempool p2p config gen fn commit-id:e3100dbe --- crates/starknet_integration_tests/src/flow_test_setup.rs | 7 ++----- .../src/integration_test_setup.rs | 9 ++++----- crates/starknet_integration_tests/src/utils.rs | 7 +------ 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/crates/starknet_integration_tests/src/flow_test_setup.rs b/crates/starknet_integration_tests/src/flow_test_setup.rs index c57e94bb2d..707fb5bbd7 100644 --- a/crates/starknet_integration_tests/src/flow_test_setup.rs +++ b/crates/starknet_integration_tests/src/flow_test_setup.rs @@ -59,11 +59,8 @@ impl FlowTestSetup { let [sequencer_0_consensus_manager_config, sequencer_1_consensus_manager_config]: [ConsensusManagerConfig; 2] = consensus_manager_configs.try_into().unwrap(); - let mempool_p2p_configs = create_mempool_p2p_configs( - SEQUENCER_INDICES.len(), - chain_info.chain_id.clone(), - &mut available_ports, - ); + let ports = available_ports.get_next_ports(SEQUENCER_INDICES.len()); + let mempool_p2p_configs = create_mempool_p2p_configs(chain_info.chain_id.clone(), ports); let [sequencer_0_mempool_p2p_config, sequencer_1_mempool_p2p_config]: [MempoolP2pConfig; 2] = mempool_p2p_configs.try_into().unwrap(); diff --git a/crates/starknet_integration_tests/src/integration_test_setup.rs b/crates/starknet_integration_tests/src/integration_test_setup.rs index 0f49378be2..736ff7674f 100644 --- a/crates/starknet_integration_tests/src/integration_test_setup.rs +++ b/crates/starknet_integration_tests/src/integration_test_setup.rs @@ -52,11 +52,10 @@ impl IntegrationTestSetup { let (mut consensus_manager_configs, consensus_proposals_channels) = create_consensus_manager_configs_and_channels(n_sequencers, &mut available_ports); - let mut mempool_p2p_configs = create_mempool_p2p_configs( - n_sequencers, - chain_info.chain_id.clone(), - &mut available_ports, - ); + + let ports = available_ports.get_next_ports(n_sequencers); + let mut mempool_p2p_configs = + create_mempool_p2p_configs(chain_info.chain_id.clone(), ports); let mut sequencers = vec![]; for (sequencer_id, component_config) in component_configs.iter().enumerate() { diff --git a/crates/starknet_integration_tests/src/utils.rs b/crates/starknet_integration_tests/src/utils.rs index 12734f27e0..d81263c1fd 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -145,12 +145,7 @@ pub fn test_rpc_state_reader_config(rpc_server_addr: SocketAddr) -> RpcStateRead RpcStateReaderConfig::from_url(format!("http://{rpc_server_addr:?}/rpc/{RPC_SPEC_VERSION}")) } -pub fn create_mempool_p2p_configs( - n_mempools: usize, - chain_id: ChainId, - available_ports: &mut AvailablePorts, -) -> Vec { - let ports = available_ports.get_next_ports(n_mempools); +pub fn create_mempool_p2p_configs(chain_id: ChainId, ports: Vec) -> Vec { create_connected_network_configs(ports) .into_iter() .map(|mut network_config| {