From 1b925f68a0b392f3a41c538299c038465069e545 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Wed, 25 Dec 2024 18:04:21 +0200 Subject: [PATCH] chore(starknet_integration_tests): pass relevant ports yet again commit-id:bbc33d55 --- Cargo.lock | 1 - crates/papyrus_network/Cargo.toml | 4 +--- crates/papyrus_network/src/network_manager/test_utils.rs | 5 +---- crates/starknet_integration_tests/src/utils.rs | 4 ++-- .../tests/mempool_p2p_flow_test.rs | 4 ++-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d40ac7b42d..6802f02255 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7519,7 +7519,6 @@ dependencies = [ "replace_with", "serde", "starknet_api", - "starknet_sequencer_infra", "thiserror", "tokio", "tokio-retry", diff --git a/crates/papyrus_network/Cargo.toml b/crates/papyrus_network/Cargo.toml index 1da1d6288b..04a22212a7 100644 --- a/crates/papyrus_network/Cargo.toml +++ b/crates/papyrus_network/Cargo.toml @@ -6,7 +6,7 @@ repository.workspace = true license-file.workspace = true [features] -testing = ["starknet_sequencer_infra/testing"] +testing = [] [dependencies] async-stream.workspace = true @@ -35,7 +35,6 @@ papyrus_network_types.workspace = true replace_with.workspace = true serde = { workspace = true, features = ["derive"] } starknet_api.workspace = true -starknet_sequencer_infra = { workspace = true, optional = true, features = ["testing"] } thiserror.workspace = true tokio = { workspace = true, features = ["full", "sync"] } tokio-retry.workspace = true @@ -51,7 +50,6 @@ defaultmap.workspace = true libp2p-swarm-test.workspace = true mockall.workspace = true pretty_assertions.workspace = true -starknet_sequencer_infra = { workspace = true, features = ["testing"] } tokio = { workspace = true, features = ["full", "sync", "test-util"] } tokio-stream.workspace = true void.workspace = true diff --git a/crates/papyrus_network/src/network_manager/test_utils.rs b/crates/papyrus_network/src/network_manager/test_utils.rs index 977a5a6703..4bda9a0546 100644 --- a/crates/papyrus_network/src/network_manager/test_utils.rs +++ b/crates/papyrus_network/src/network_manager/test_utils.rs @@ -11,7 +11,6 @@ use libp2p::core::multiaddr::Protocol; use libp2p::gossipsub::SubscriptionError; use libp2p::identity::Keypair; use libp2p::{Multiaddr, PeerId}; -use starknet_sequencer_infra::test_utils::AvailablePorts; use super::{ BroadcastReceivedMessagesConverterFn, @@ -180,9 +179,8 @@ pub fn create_connected_network_configs(mut ports: Vec) -> Vec( - n_configs: usize, topic: Topic, - available_ports: &mut AvailablePorts, + ports: Vec, ) -> (Vec, BroadcastTopicChannels) where T: TryFrom + 'static, @@ -190,7 +188,6 @@ where { const BUFFER_SIZE: usize = 1000; - let ports = available_ports.get_next_ports(n_configs + 1); let mut channels_configs = create_connected_network_configs(ports); let broadcast_channels = channels_configs.pop().unwrap(); diff --git a/crates/starknet_integration_tests/src/utils.rs b/crates/starknet_integration_tests/src/utils.rs index 4c059fe0cd..7fbc508388 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -105,13 +105,13 @@ pub fn create_consensus_manager_configs_and_channels( n_managers: usize, available_ports: &mut AvailablePorts, ) -> (Vec, BroadcastTopicChannels>) { + let ports = available_ports.get_next_ports(n_managers + 1); let (network_configs, broadcast_channels) = create_network_configs_connected_to_broadcast_channels( - n_managers, papyrus_network::gossipsub_impl::Topic::new( starknet_consensus_manager::consensus_manager::CONSENSUS_PROPOSALS_TOPIC, ), - available_ports, + ports, ); // TODO: Need to also add a channel for votes, in addition to the proposals channel. diff --git a/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs b/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs index c69b39b056..6c35fe3da9 100644 --- a/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs +++ b/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs @@ -89,11 +89,11 @@ async fn setup( let http_server_config = create_http_server_config(available_ports.get_next_local_host_socket()); let rpc_state_reader_config = test_rpc_state_reader_config(rpc_server_addr); + let ports = available_ports.get_next_ports(2); let (mut network_configs, broadcast_channels) = create_network_configs_connected_to_broadcast_channels::( - 1, Topic::new(MEMPOOL_TOPIC), - &mut available_ports, + ports, ); let network_config = network_configs.pop().unwrap(); let mempool_p2p_config = MempoolP2pConfig { network_config, ..Default::default() };