From c5ee7918bbaa415edac6c3eed5bab1052fd5b9af Mon Sep 17 00:00:00 2001 From: Itay-Tsabary-Starkware <106665835+Itay-Tsabary-Starkware@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:59:50 +0200 Subject: [PATCH] chore(starknet_integration_tests): remove task_executor (#2685) commit-id:5e93def8 --- Cargo.lock | 1 - crates/starknet_integration_tests/Cargo.toml | 1 - .../src/flow_test_setup.rs | 18 +++--------------- .../tests/mempool_p2p_flow_test.rs | 10 ++-------- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d9e9d4161..546c487a4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10489,7 +10489,6 @@ dependencies = [ "starknet_sequencer_infra", "starknet_sequencer_node", "starknet_state_sync", - "starknet_task_executor", "strum 0.25.0", "tempfile", "tokio", diff --git a/crates/starknet_integration_tests/Cargo.toml b/crates/starknet_integration_tests/Cargo.toml index 826c29df9e..95a07bf215 100644 --- a/crates/starknet_integration_tests/Cargo.toml +++ b/crates/starknet_integration_tests/Cargo.toml @@ -38,7 +38,6 @@ starknet_monitoring_endpoint = { workspace = true, features = ["testing"] } starknet_sequencer_infra = { workspace = true, features = ["testing"] } starknet_sequencer_node = { workspace = true, features = ["testing"] } starknet_state_sync.workspace = true -starknet_task_executor.workspace = true strum.workspace = true tempfile.workspace = true tokio.workspace = true diff --git a/crates/starknet_integration_tests/src/flow_test_setup.rs b/crates/starknet_integration_tests/src/flow_test_setup.rs index 86916afea9..c81c68c1d6 100644 --- a/crates/starknet_integration_tests/src/flow_test_setup.rs +++ b/crates/starknet_integration_tests/src/flow_test_setup.rs @@ -14,9 +14,7 @@ use starknet_mempool_p2p::config::MempoolP2pConfig; use starknet_sequencer_node::config::node_config::SequencerNodeConfig; use starknet_sequencer_node::servers::run_component_servers; use starknet_sequencer_node::utils::create_node_modules; -use starknet_task_executor::tokio_executor::TokioExecutor; use tempfile::TempDir; -use tokio::runtime::Handle; use tokio::task::JoinHandle; use tracing::{debug, instrument}; @@ -33,8 +31,6 @@ const SEQUENCER_1: usize = 1; const SEQUENCER_INDICES: [usize; 2] = [SEQUENCER_0, SEQUENCER_1]; pub struct FlowTestSetup { - // TODO(Tsabary): Remove this field. - pub task_executor: TokioExecutor, pub sequencer_0: SequencerSetup, pub sequencer_1: SequencerSetup, @@ -45,8 +41,6 @@ pub struct FlowTestSetup { impl FlowTestSetup { #[instrument(skip(tx_generator), level = "debug")] pub async fn new_from_tx_generator(tx_generator: &MultiAccountTransactionGenerator) -> Self { - let handle = Handle::current(); - let task_executor = TokioExecutor::new(handle); let chain_info = create_chain_info(); let accounts = tx_generator.accounts(); @@ -65,7 +59,6 @@ impl FlowTestSetup { accounts.clone(), SEQUENCER_0, chain_info.clone(), - &task_executor, sequencer_0_consensus_manager_config, sequencer_0_mempool_p2p_config, ) @@ -74,13 +67,12 @@ impl FlowTestSetup { accounts, SEQUENCER_1, chain_info, - &task_executor, sequencer_1_consensus_manager_config, sequencer_1_mempool_p2p_config, ) .await; - Self { task_executor, sequencer_0, sequencer_1, consensus_proposals_channels } + Self { sequencer_0, sequencer_1, consensus_proposals_channels } } pub async fn assert_add_tx_error(&self, tx: RpcTransaction) -> GatewaySpecError { @@ -107,15 +99,11 @@ pub struct SequencerSetup { } impl SequencerSetup { - #[instrument( - skip(accounts, chain_info, task_executor, consensus_manager_config), - level = "debug" - )] + #[instrument(skip(accounts, chain_info, consensus_manager_config), level = "debug")] pub async fn new( accounts: Vec, sequencer_index: usize, chain_info: ChainInfo, - task_executor: &TokioExecutor, consensus_manager_config: ConsensusManagerConfig, mempool_p2p_config: MempoolP2pConfig, ) -> Self { @@ -149,7 +137,7 @@ impl SequencerSetup { // Build and run the sequencer node. let sequencer_node_future = run_component_servers(servers); - let sequencer_node_handle = task_executor.spawn_with_handle(sequencer_node_future); + let sequencer_node_handle = tokio::spawn(sequencer_node_future); // Wait for server to spin up. // TODO(Gilad): Replace with a persistent Client with a built-in retry to protect against CI 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 93e090543b..32977ceada 100644 --- a/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs +++ b/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs @@ -39,8 +39,6 @@ use starknet_sequencer_node::config::component_execution_config::{ use starknet_sequencer_node::config::node_config::SequencerNodeConfig; use starknet_sequencer_node::servers::run_component_servers; use starknet_sequencer_node::utils::create_node_modules; -use starknet_task_executor::tokio_executor::TokioExecutor; -use tokio::runtime::Handle; #[fixture] fn tx_generator() -> MultiAccountTransactionGenerator { @@ -105,8 +103,6 @@ async fn setup( #[rstest] #[tokio::test] async fn test_mempool_sends_tx_to_other_peer(mut tx_generator: MultiAccountTransactionGenerator) { - let handle = Handle::current(); - let task_executor = TokioExecutor::new(handle); let (config, mut broadcast_channels) = setup(&tx_generator).await; let (_clients, servers) = create_node_modules(&config); @@ -115,7 +111,7 @@ async fn test_mempool_sends_tx_to_other_peer(mut tx_generator: MultiAccountTrans // Build and run the sequencer node. let sequencer_node_future = run_component_servers(servers); - let _sequencer_node_handle = task_executor.spawn_with_handle(sequencer_node_future); + let _sequencer_node_handle = tokio::spawn(sequencer_node_future); // Wait for server to spin up and for p2p to discover other peer. // TODO(Gilad): Replace with a persistent Client with a built-in retry to protect against CI @@ -147,14 +143,12 @@ async fn test_mempool_receives_tx_from_other_peer( const RECEIVED_TX_POLL_INTERVAL: u64 = 100; // milliseconds between calls to read received txs from the broadcast channel const TXS_RETRIVAL_TIMEOUT: u64 = 2000; // max milliseconds spent polling the received txs before timing out - let handle = Handle::current(); - let task_executor = TokioExecutor::new(handle); let (config, mut broadcast_channels) = setup(&tx_generator).await; let (clients, servers) = create_node_modules(&config); let mempool_client = clients.get_mempool_shared_client().unwrap(); // Build and run the sequencer node. let sequencer_node_future = run_component_servers(servers); - let _sequencer_node_handle = task_executor.spawn_with_handle(sequencer_node_future); + let _sequencer_node_handle = tokio::spawn(sequencer_node_future); // Wait for server to spin up and for p2p to discover other peer. // TODO(Gilad): Replace with a persistent Client with a built-in retry to protect against CI // flakiness.