Skip to content

Commit

Permalink
chore(starknet_integration_tests): remove task_executor
Browse files Browse the repository at this point in the history
commit-id:5e93def8
  • Loading branch information
Itay-Tsabary-Starkware committed Dec 16, 2024
1 parent 0a60f8f commit 14d119b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 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.

1 change: 0 additions & 1 deletion crates/starknet_integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 3 additions & 15 deletions crates/starknet_integration_tests/src/flow_test_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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,

Expand All @@ -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();
Expand All @@ -58,7 +52,6 @@ impl FlowTestSetup {
accounts.clone(),
SEQUENCER_0,
chain_info.clone(),
&task_executor,
sequencer_0_consensus_manager_config,
)
.await;
Expand All @@ -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 {
Expand All @@ -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<Contract>,
sequencer_index: usize,
chain_info: ChainInfo,
task_executor: &TokioExecutor,
consensus_manager_config: ConsensusManagerConfig,
) -> Self {
let storage_for_test = StorageTestSetup::new(accounts, &chain_info);
Expand Down Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 14d119b

Please sign in to comment.