diff --git a/Cargo.lock b/Cargo.lock index 19282b647..49931a102 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -284,12 +284,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" +checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" dependencies = [ "jobserver", "libc", + "once_cell", ] [[package]] @@ -602,7 +603,7 @@ dependencies = [ [[package]] name = "everscale-types" version = "0.1.0-rc.6" -source = "git+https://github.com/broxus/everscale-types.git?branch=feature/empty-block-collation#3b11c86427fb39ae91c50e071edb43db6795881c" +source = "git+https://github.com/broxus/everscale-types.git?branch=feature/empty-block-collation#1b1170070bf894048355081100acb5b690388541" dependencies = [ "ahash", "base64 0.21.7", @@ -622,7 +623,7 @@ dependencies = [ [[package]] name = "everscale-types-proc" version = "0.1.4" -source = "git+https://github.com/broxus/everscale-types.git?branch=feature/empty-block-collation#3b11c86427fb39ae91c50e071edb43db6795881c" +source = "git+https://github.com/broxus/everscale-types.git?branch=feature/empty-block-collation#1b1170070bf894048355081100acb5b690388541" dependencies = [ "proc-macro2", "quote", @@ -656,9 +657,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" +checksum = "38793c55593b33412e3ae40c2c9781ffaa6f438f6f8c10f24e71846fbd7ae01e" [[package]] name = "futures-core" @@ -784,9 +785,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685a7d121ee3f65ae4fddd72b25a04bb36b6af81bc0828f7d5434c0fe60fa3a2" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -1506,9 +1507,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.32" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", @@ -1519,9 +1520,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.10" +version = "0.21.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" dependencies = [ "log", "ring 0.17.8", @@ -1632,9 +1633,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -1782,18 +1783,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", diff --git a/collator/Cargo.toml b/collator/Cargo.toml index c69dd6fc2..413aecb67 100644 --- a/collator/Cargo.toml +++ b/collator/Cargo.toml @@ -36,6 +36,7 @@ log = "0.4.21" [dev-dependencies] tempfile = { workspace = true } +tokio = { version = "1", features = ["rt-multi-thread"] } tracing-test = { workspace = true } tycho-core = { workspace = true, features = ["test"] } tycho-storage = { workspace = true, features = ["test"] } diff --git a/collator/src/validator/test_impl.rs b/collator/src/validator/test_impl.rs index e7c3607a2..74348d6be 100644 --- a/collator/src/validator/test_impl.rs +++ b/collator/src/validator/test_impl.rs @@ -104,7 +104,6 @@ where &mut self, _session: Arc, ) -> Result { - //STUB: do nothing Ok(ValidatorTaskResult::Void) } diff --git a/collator/src/validator/validator_processor.rs b/collator/src/validator/validator_processor.rs index 05f43e8ad..a4fb9fff2 100644 --- a/collator/src/validator/validator_processor.rs +++ b/collator/src/validator/validator_processor.rs @@ -285,12 +285,11 @@ where Duration::from_millis(0) } else { let exponential_backoff = INITIAL_BACKOFF * BACKOFF_FACTOR.pow(iteration - 1); - let calculated_duration = exponential_backoff + NETWORK_TIMEOUT; - if calculated_duration > MAX_BACKOFF { + if exponential_backoff > MAX_BACKOFF { MAX_BACKOFF } else { - calculated_duration + exponential_backoff } }; @@ -522,7 +521,7 @@ where trace!(target: tracing_targets::VALIDATOR, validator_pubkey=?validator.public_key.as_bytes(), "trying to send request for getting signatures from validator"); let response = tokio::time::timeout( - Duration::from_secs(1), + NETWORK_TIMEOUT, cloned_private_overlay.query( &cloned_network, &PeerId(validator.public_key.to_bytes()), diff --git a/collator/tests/adapter_tests.rs b/collator/tests/adapter_tests.rs index 59e3932d1..eaf473fd4 100644 --- a/collator/tests/adapter_tests.rs +++ b/collator/tests/adapter_tests.rs @@ -9,6 +9,7 @@ use tycho_block_util::state::{MinRefMcStateTracker, ShardStateStuff}; use tycho_collator::state_node::{ StateNodeAdapter, StateNodeAdapterStdImpl, StateNodeEventListener, }; +use tycho_collator::test_utils::prepare_test_storage; use tycho_collator::types::BlockStuffForSync; use tycho_core::block_strider::provider::BlockProvider; use tycho_core::block_strider::subscriber::test::PrintSubscriber; @@ -75,7 +76,7 @@ async fn test_add_and_get_block() { #[tokio::test] async fn test_storage_accessors() { - let (provider, storage) = prepare_state_apply().await.unwrap(); + let (provider, storage) = prepare_test_storage().await.unwrap(); let block_strider = BlockStrider::builder() .with_provider(provider) @@ -84,6 +85,7 @@ async fn test_storage_accessors() { .build_with_state_applier(MinRefMcStateTracker::default(), storage.clone()); block_strider.run().await.unwrap(); + let counter = Arc::new(AtomicUsize::new(0)); let listener = Arc::new(MockEventListener { accepted_count: counter.clone(), diff --git a/collator/tests/validator_tests.rs b/collator/tests/validator_tests.rs index a3d3d5083..bbdefb306 100644 --- a/collator/tests/validator_tests.rs +++ b/collator/tests/validator_tests.rs @@ -277,13 +277,13 @@ async fn test_validator_accept_block_by_state() -> anyhow::Result<()> { Ok(()) } -#[tokio::test] -async fn test_validator_accept_block_by_network() -> anyhow::Result<()> { +#[tokio::test(flavor = "multi_thread", worker_threads = 4)] +async fn test_validator_accept_block_by_network() -> Result<()> { try_init_test_tracing(tracing_subscriber::filter::LevelFilter::DEBUG); tycho_util::test::init_logger("test_validator_accept_block_by_network"); - let network_nodes = make_network(2); - let blocks_amount = 100; + let network_nodes = make_network(20); + let blocks_amount = 10; let sessions = 2; let mut validators = vec![];