Skip to content

Commit

Permalink
chore(starknet_integration_tests): pass relevant ports yet again
Browse files Browse the repository at this point in the history
commit-id:bbc33d55
  • Loading branch information
Itay-Tsabary-Starkware committed Dec 31, 2024
1 parent 9bd9a10 commit 1b925f6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions crates/papyrus_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository.workspace = true
license-file.workspace = true

[features]
testing = ["starknet_sequencer_infra/testing"]
testing = []

[dependencies]
async-stream.workspace = true
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions crates/papyrus_network/src/network_manager/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -180,17 +179,15 @@ pub fn create_connected_network_configs(mut ports: Vec<u16>) -> Vec<NetworkConfi
}

pub fn create_network_configs_connected_to_broadcast_channels<T>(
n_configs: usize,
topic: Topic,
available_ports: &mut AvailablePorts,
ports: Vec<u16>,
) -> (Vec<NetworkConfig>, BroadcastTopicChannels<T>)
where
T: TryFrom<Bytes> + 'static,
Bytes: From<T>,
{
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();

Expand Down
4 changes: 2 additions & 2 deletions crates/starknet_integration_tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ pub fn create_consensus_manager_configs_and_channels(
n_managers: usize,
available_ports: &mut AvailablePorts,
) -> (Vec<ConsensusManagerConfig>, BroadcastTopicChannels<StreamMessage<ProposalPart>>) {
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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::<RpcTransactionWrapper>(
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() };
Expand Down

0 comments on commit 1b925f6

Please sign in to comment.