From 14d119b20f3e8b1d372672c04cdf21c9df549217 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Sun, 15 Dec 2024 22:35:55 +0200 Subject: [PATCH] chore(starknet_integration_tests): remove task_executor 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 ec72ce93fc..c65ef4fa57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10487,7 +10487,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 c2ae15fca8..10124deb99 100644 --- a/crates/starknet_integration_tests/src/flow_test_setup.rs +++ b/crates/starknet_integration_tests/src/flow_test_setup.rs @@ -13,9 +13,7 @@ use starknet_http_server::test_utils::HttpTestClient; 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}; @@ -31,8 +29,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, @@ -43,8 +39,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(); @@ -58,7 +52,6 @@ impl FlowTestSetup { accounts.clone(), SEQUENCER_0, chain_info.clone(), - &task_executor, sequencer_0_consensus_manager_config, ) .await; @@ -68,12 +61,11 @@ impl FlowTestSetup { accounts, SEQUENCER_1, chain_info, - &task_executor, sequencer_1_consensus_manager_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 { @@ -100,15 +92,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, ) -> Self { let storage_for_test = StorageTestSetup::new(accounts, &chain_info); @@ -140,7 +128,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.