diff --git a/node/actors/consensus/src/replica/tests.rs b/node/actors/consensus/src/replica/tests.rs index d7307b17..6c9e6e12 100644 --- a/node/actors/consensus/src/replica/tests.rs +++ b/node/actors/consensus/src/replica/tests.rs @@ -1,13 +1,13 @@ use crate::testonly; use rand::Rng; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ctx, scope, time}; use zksync_consensus_network::io::{ConsensusInputMessage, Target}; use zksync_consensus_roles::validator::{self, ViewNumber}; #[tokio::test] async fn start_new_view_not_leader() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::ManualClock::new()); let rng = &mut ctx.rng(); diff --git a/node/actors/consensus/src/tests.rs b/node/actors/consensus/src/tests.rs index e5796389..54fa7f9a 100644 --- a/node/actors/consensus/src/tests.rs +++ b/node/actors/consensus/src/tests.rs @@ -2,11 +2,11 @@ use crate::{ misc::consensus_threshold, testonly::{Behavior, Network, Test}, }; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::ctx; async fn run_test(behavior: Behavior, network: Network) { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::AffineClock::new(1.)); const NODES: usize = 11; diff --git a/node/actors/executor/src/tests.rs b/node/actors/executor/src/tests.rs index ddcb4795..dc69b267 100644 --- a/node/actors/executor/src/tests.rs +++ b/node/actors/executor/src/tests.rs @@ -3,7 +3,7 @@ use super::*; use rand::Rng; use std::collections::HashMap; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::sync; use zksync_consensus_consensus::testonly::make_genesis; use zksync_consensus_network::testonly::Instance; @@ -95,7 +95,7 @@ impl FullValidatorConfig { #[tokio::test] async fn executing_single_validator() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::root(); let rng = &mut ctx.rng(); @@ -123,7 +123,7 @@ async fn executing_single_validator() { #[tokio::test] async fn executing_validator_and_external_node() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::AffineClock::new(20.0)); let rng = &mut ctx.rng(); diff --git a/node/actors/network/src/consensus/handshake/tests.rs b/node/actors/network/src/consensus/handshake/tests.rs index d53bc916..c32228bc 100644 --- a/node/actors/network/src/consensus/handshake/tests.rs +++ b/node/actors/network/src/consensus/handshake/tests.rs @@ -1,7 +1,7 @@ use super::*; use crate::{frame, noise, testonly}; use rand::Rng; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ctx, io, scope}; use zksync_consensus_roles::validator; use zksync_consensus_schema as schema; @@ -14,7 +14,7 @@ fn test_schema_encode_decode() { #[tokio::test] async fn test_session_id_mismatch() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); @@ -81,7 +81,7 @@ async fn test_session_id_mismatch() { #[tokio::test] async fn test_peer_mismatch() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); @@ -111,7 +111,7 @@ async fn test_peer_mismatch() { #[tokio::test] async fn test_invalid_signature() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); diff --git a/node/actors/network/src/consensus/tests.rs b/node/actors/network/src/consensus/tests.rs index 00e51782..fe628bb3 100644 --- a/node/actors/network/src/consensus/tests.rs +++ b/node/actors/network/src/consensus/tests.rs @@ -3,14 +3,14 @@ use crate::{io, preface, rpc, run_network, testonly}; use anyhow::Context as _; use rand::Rng; use tracing::Instrument as _; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ctx, net, scope}; use zksync_consensus_roles::validator; use zksync_consensus_utils::pipe; #[tokio::test] async fn test_one_connection_per_validator() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); @@ -67,7 +67,7 @@ async fn test_one_connection_per_validator() { #[tokio::test(flavor = "multi_thread")] async fn test_address_change() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::AffineClock::new(20.)); let rng = &mut ctx.rng(); @@ -145,7 +145,7 @@ async fn test_address_change() { /// encrypted authenticated multiplexed stream. #[tokio::test] async fn test_transmission() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); diff --git a/node/actors/network/src/gossip/handshake/tests.rs b/node/actors/network/src/gossip/handshake/tests.rs index 7ea1fd14..8894fc1f 100644 --- a/node/actors/network/src/gossip/handshake/tests.rs +++ b/node/actors/network/src/gossip/handshake/tests.rs @@ -2,7 +2,7 @@ use super::*; use crate::{frame, noise, testonly}; use rand::Rng; use std::collections::{HashMap, HashSet}; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ctx, io, scope}; use zksync_consensus_roles::node; use zksync_consensus_schema as schema; @@ -25,7 +25,7 @@ fn make_cfg(rng: &mut R) -> Config { #[tokio::test] async fn test_session_id_mismatch() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); @@ -93,7 +93,7 @@ async fn test_session_id_mismatch() { #[tokio::test] async fn test_peer_mismatch() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); @@ -123,7 +123,7 @@ async fn test_peer_mismatch() { #[tokio::test] async fn test_invalid_signature() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); diff --git a/node/actors/network/src/gossip/tests.rs b/node/actors/network/src/gossip/tests.rs index 8b38d4cf..8a09524e 100644 --- a/node/actors/network/src/gossip/tests.rs +++ b/node/actors/network/src/gossip/tests.rs @@ -9,7 +9,7 @@ use std::{ }; use test_casing::{test_casing, Product}; use tracing::Instrument as _; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ ctx::{self, channel}, oneshot, scope, @@ -22,7 +22,7 @@ use zksync_consensus_utils::pipe; #[tokio::test] async fn test_one_connection_per_node() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); @@ -150,7 +150,7 @@ impl View { #[tokio::test] async fn test_validator_addrs() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let rng = &mut ctx::test_root(&ctx::RealClock).rng(); let keys: Vec = (0..8).map(|_| rng.gen()).collect(); @@ -233,7 +233,7 @@ fn to_addr_map(addrs: &ValidatorAddrs) -> HashMap = testonly::Instance::new(rng, 10, 1); @@ -277,7 +277,7 @@ const NETWORK_CONNECTIVITY_CASES: [(usize, usize); 5] = [(2, 1), (3, 2), (5, 3), #[tokio::test(flavor = "multi_thread")] #[tracing::instrument(level = "trace")] async fn syncing_blocks(node_count: usize, gossip_peers: usize) { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::AffineClock::new(20.0)); let ctx = &ctx.with_timeout(time::Duration::seconds(200)); @@ -398,7 +398,7 @@ async fn uncoordinated_block_syncing( (node_count, gossip_peers): (usize, usize), state_generation_interval: time::Duration, ) { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::AffineClock::new(20.0)); let ctx = &ctx.with_timeout(time::Duration::seconds(200)); @@ -482,7 +482,7 @@ async fn run_mock_uncoordinated_dispatcher( #[test_casing(5, NETWORK_CONNECTIVITY_CASES)] #[tokio::test] async fn getting_blocks_from_peers(node_count: usize, gossip_peers: usize) { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::ManualClock::new()); let rng = &mut ctx.rng(); @@ -595,7 +595,7 @@ async fn run_get_block_dispatcher( /// the AccountData that is present in the network from the previous run. #[tokio::test] async fn validator_node_restart() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let clock = &ctx::ManualClock::new(); let ctx = &ctx::test_root(clock); let rng = &mut ctx.rng(); @@ -679,7 +679,7 @@ async fn validator_node_restart() { /// to receive all updates in 2 rounds of communication. #[tokio::test] async fn rate_limiting() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let clock = &ctx::ManualClock::new(); let ctx = &ctx::test_root(clock); let rng = &mut ctx.rng(); diff --git a/node/actors/network/src/mux/tests.rs b/node/actors/network/src/mux/tests.rs index a1b397fb..3bea05f6 100644 --- a/node/actors/network/src/mux/tests.rs +++ b/node/actors/network/src/mux/tests.rs @@ -8,7 +8,7 @@ use std::{ Arc, }, }; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ctx, scope}; use zksync_consensus_schema as schema; use zksync_consensus_schema::proto::network::mux_test as proto; @@ -195,8 +195,8 @@ fn expected(res: Result<(), mux::RunError>) -> Result<(), mux::RunError> { // checking 1 property at a time should be added. #[test] fn mux_with_noise() { - concurrency::testonly::abort_on_panic(); - concurrency::testonly::with_runtimes(|| async { + abort_on_panic(); + zksync_concurrency::testonly::with_runtimes(|| async { let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); @@ -285,7 +285,7 @@ fn mux_with_noise() { #[tokio::test] async fn test_transport_closed() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let cap: mux::CapabilityId = 0; let cfg = Arc::new(mux::Config { diff --git a/node/actors/network/src/noise/tests.rs b/node/actors/network/src/noise/tests.rs index c2372aa8..cacfbbca 100644 --- a/node/actors/network/src/noise/tests.rs +++ b/node/actors/network/src/noise/tests.rs @@ -1,12 +1,12 @@ use crate::noise; use rand::Rng; use tracing::instrument::Instrument as _; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ctx, io, scope}; #[tokio::test] async fn transmit_ok() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let (mut s1, mut s2) = noise::testonly::pipe(ctx).await; let msg = "hello"; @@ -45,7 +45,7 @@ async fn transmit_ok() { #[tokio::test] async fn transmit_sender_dies() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let (mut s1, mut s2) = noise::testonly::pipe(ctx).await; let msg = "hello"; @@ -75,7 +75,7 @@ async fn transmit_sender_dies() { #[tokio::test] async fn transmit_receiver_dies() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); let (s1, s2) = noise::testonly::pipe(ctx).await; diff --git a/node/actors/network/src/rpc/tests.rs b/node/actors/network/src/rpc/tests.rs index 7a71e252..e79aea03 100644 --- a/node/actors/network/src/rpc/tests.rs +++ b/node/actors/network/src/rpc/tests.rs @@ -5,7 +5,7 @@ use std::{ collections::HashSet, sync::atomic::{AtomicU64, Ordering}, }; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ctx, time}; /// CAPABILITY_ID should uniquely identify the RPC. @@ -35,7 +35,7 @@ fn expected(res: Result<(), mux::RunError>) -> Result<(), mux::RunError> { #[tokio::test] async fn test_ping() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let clock = ctx::ManualClock::new(); let ctx = &ctx::test_root(&clock); let (s1, s2) = noise::testonly::pipe(ctx).await; @@ -87,7 +87,7 @@ impl Handler for PingServer { #[tokio::test] async fn test_ping_loop() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let clock = ctx::ManualClock::new(); clock.set_advance_on_sleep(); let ctx = &ctx::test_root(&clock); @@ -151,7 +151,7 @@ impl Handler for ExampleServer { #[tokio::test] async fn test_inflight() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let (s1, s2) = noise::testonly::pipe(ctx).await; let client = Client::::new(ctx); diff --git a/node/actors/network/src/tests.rs b/node/actors/network/src/tests.rs index 93269d1e..2226219f 100644 --- a/node/actors/network/src/tests.rs +++ b/node/actors/network/src/tests.rs @@ -1,6 +1,6 @@ use crate::{run_network, testonly}; use tracing::Instrument as _; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{ctx, scope}; use zksync_consensus_utils::pipe; @@ -8,7 +8,7 @@ use zksync_consensus_utils::pipe; /// (won't panic during registration). #[tokio::test] async fn test_metrics() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &mut ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); let nodes = testonly::Instance::new(rng, 3, 1); diff --git a/node/actors/sync_blocks/src/peers/tests.rs b/node/actors/sync_blocks/src/peers/tests.rs index 485c97dd..57e9cd4d 100644 --- a/node/actors/sync_blocks/src/peers/tests.rs +++ b/node/actors/sync_blocks/src/peers/tests.rs @@ -5,7 +5,7 @@ use async_trait::async_trait; use rand::{rngs::StdRng, seq::IteratorRandom, Rng}; use std::{collections::HashSet, fmt}; use test_casing::{test_casing, Product}; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::time; use zksync_consensus_roles::validator; use zksync_consensus_storage::{BlockStore, InMemoryStorage}; @@ -85,7 +85,7 @@ async fn wait_for_peer_update( #[instrument(level = "trace")] async fn test_peer_states(test: T) { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock).with_timeout(TEST_TIMEOUT); let clock = ctx::ManualClock::new(); diff --git a/node/actors/sync_blocks/src/tests/end_to_end.rs b/node/actors/sync_blocks/src/tests/end_to_end.rs index a1ad1dbe..c54bfdd6 100644 --- a/node/actors/sync_blocks/src/tests/end_to_end.rs +++ b/node/actors/sync_blocks/src/tests/end_to_end.rs @@ -6,7 +6,7 @@ use rand::seq::SliceRandom; use std::fmt; use test_casing::test_casing; use tracing::Instrument; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::ctx::channel; use zksync_consensus_network as network; use zksync_consensus_network::testonly::Instance as NetworkInstance; @@ -229,7 +229,7 @@ trait GossipNetworkTest: fmt::Debug + Send { async fn test_sync_blocks(test: T) { const CLOCK_SPEEDUP: u32 = 25; - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::AffineClock::new(CLOCK_SPEEDUP as f64)) .with_timeout(TEST_TIMEOUT * CLOCK_SPEEDUP); diff --git a/node/actors/sync_blocks/src/tests/mod.rs b/node/actors/sync_blocks/src/tests/mod.rs index a590ea3f..6fc7b445 100644 --- a/node/actors/sync_blocks/src/tests/mod.rs +++ b/node/actors/sync_blocks/src/tests/mod.rs @@ -5,7 +5,7 @@ use rand::{ Rng, }; use std::iter; -use zksync_concurrency as concurrency; +use zksync_concurrency::testonly::abort_on_panic; use zksync_concurrency::{oneshot, time}; use zksync_consensus_network::io::{GetBlockError, GetBlockResponse, SyncBlocksRequest}; use zksync_consensus_roles::validator::{ @@ -104,7 +104,7 @@ impl TestValidators { #[tokio::test] async fn subscribing_to_state_updates() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng(); @@ -179,7 +179,7 @@ async fn subscribing_to_state_updates() { #[tokio::test] async fn getting_blocks() { - concurrency::testonly::abort_on_panic(); + abort_on_panic(); let ctx = &ctx::test_root(&ctx::RealClock); let rng = &mut ctx.rng();