From 234aedf17b3d6ea61c6894675444773979563178 Mon Sep 17 00:00:00 2001 From: gabriele-0201 Date: Thu, 22 Feb 2024 15:29:32 +0100 Subject: [PATCH] xtask: migrating from duct to xshell xshell does not handle any async, so it also required the addition of tokio --- Cargo.lock | 426 +++++++++++++++++++---------------------- Cargo.toml | 5 +- xtask/Cargo.toml | 6 +- xtask/src/build.rs | 44 ++--- xtask/src/logging.rs | 127 +++++++----- xtask/src/main.rs | 145 ++++++++------ xtask/src/shim.rs | 45 +++-- xtask/src/sovereign.rs | 132 +++++++------ xtask/src/zombienet.rs | 50 +++-- 9 files changed, 509 insertions(+), 471 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7eef865..828eb0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" dependencies = [ "cfg-if", "getrandom 0.2.12", @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" dependencies = [ "anstyle", "anstyle-parse", @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "approx" @@ -214,7 +214,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -606,7 +606,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 5.0.0", + "event-listener 5.1.0", "event-listener-strategy 0.5.0", "futures-core", "pin-project-lite 0.2.13", @@ -670,7 +670,7 @@ dependencies = [ "futures-io", "futures-lite 2.2.0", "parking", - "polling 3.4.0", + "polling 3.5.0", "rustix 0.38.31", "slab", "tracing", @@ -757,7 +757,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -916,7 +916,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -1213,9 +1213,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "byte-slice-cast" @@ -1297,7 +1297,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -1305,11 +1305,10 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730" dependencies = [ - "jobserver", "libc", ] @@ -1388,7 +1387,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -1446,9 +1445,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.0" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -1456,9 +1455,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.0" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -1476,7 +1475,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -1900,16 +1899,6 @@ dependencies = [ "cipher 0.4.4", ] -[[package]] -name = "ctrlc" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b467862cc8610ca6fc9a1532d7777cee0804e678ab45410897b9396495994a0b" -dependencies = [ - "nix 0.27.1", - "windows-sys 0.52.0", -] - [[package]] name = "cumulus-client-cli" version = "0.1.0" @@ -2203,7 +2192,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2537,7 +2526,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2555,9 +2544,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aff472b83efd22bfc0176aa8ba34617dd5c17364670eb201a5f06d339b8abf7" +checksum = "0c15f3b597018782655a05d417f28bac009f6eb60f4b6703eb818998c1aaa16a" dependencies = [ "cc", "cxxbridge-flags", @@ -2567,9 +2556,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf6e7a52c19013a9a0ec421c7d9c2d1125faf333551227e0a017288d71b47c3" +checksum = "81699747d109bba60bd6f87e7cb24b626824b8427b32f199b95c7faa06ee3dc9" dependencies = [ "cc", "codespan-reporting", @@ -2577,24 +2566,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "cxxbridge-flags" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589e83d02fc1d4fb78f5ad56ca08835341e23499d086d2821315869426d618dc" +checksum = "7a7eb4c4fd18505f5a935f9c2ee77780350dcdb56da7cd037634e806141c5c43" [[package]] name = "cxxbridge-macro" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2cb1fd8ffae4230c7cfbbaf3698dbeaf750fa8c5dadf7ed897df581b9b572a5" +checksum = "5d914fcc6452d133236ee067a9538be25ba6a644a450e1a6c617da84bf029854" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2609,12 +2598,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.5" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" +checksum = "3a5d17510e4a1a87f323de70b7b1eaac1ee0e37866c6720b2d279452d0edf389" dependencies = [ - "darling_core 0.20.5", - "darling_macro 0.20.5", + "darling_core 0.20.7", + "darling_macro 0.20.7", ] [[package]] @@ -2633,16 +2622,16 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.5" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" +checksum = "a98eea36a7ff910fa751413d0895551143a8ea41d695d9798ec7d665df7f7f5e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2658,13 +2647,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.5" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" +checksum = "d6a366a3f90c5d59a4b91169775f88e52e8f71a0e7804cc98a8db2932cf4ed57" dependencies = [ - "darling_core 0.20.5", + "darling_core 0.20.7", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2847,7 +2836,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2887,7 +2876,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.48", + "syn 2.0.50", "termcolor", "toml 0.8.10", "walkdir", @@ -2911,18 +2900,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" -[[package]] -name = "duct" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ab5718d1224b63252cd0c6f74f6480f9ffeb117438a2e0f5cf6d9a4798929c" -dependencies = [ - "libc", - "once_cell", - "os_pipe", - "shared_child", -] - [[package]] name = "dyn-clonable" version = "0.9.0" @@ -3078,7 +3055,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3089,7 +3066,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3167,9 +3144,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72557800024fabbaa2449dd4bf24e37b93702d457a4d4f2b0dd1f0f039f20c1" +checksum = "b7ad6fd685ce13acd6d9541a30f6db6567a7a24c9ffd4ba2955d29e3f22c8b27" dependencies = [ "concurrent-queue", "parking", @@ -3192,7 +3169,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" dependencies = [ - "event-listener 5.0.0", + "event-listener 5.1.0", "pin-project-lite 0.2.13", ] @@ -3227,7 +3204,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3507,7 +3484,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3646,7 +3623,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing 9.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.6.0)", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3658,7 +3635,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3668,7 +3645,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3847,7 +3824,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3875,9 +3852,9 @@ checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" @@ -4153,7 +4130,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.9", ] [[package]] @@ -4162,7 +4139,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.9", "allocator-api2", "serde", ] @@ -4184,9 +4161,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -4889,15 +4866,6 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" -[[package]] -name = "jobserver" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.68" @@ -5921,7 +5889,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -5935,7 +5903,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -5946,7 +5914,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -5957,7 +5925,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -6347,9 +6315,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.32.3" +version = "0.32.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" +checksum = "4541eb06dce09c0241ebbaab7102f0a01a0c8994afed2e5d0d66775016e25ac2" dependencies = [ "approx", "matrixmultiply", @@ -6714,16 +6682,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "os_pipe" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "overload" version = "0.1.1" @@ -7633,7 +7591,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -8111,7 +8069,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -8152,7 +8110,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -8196,9 +8154,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" @@ -9294,7 +9252,7 @@ dependencies = [ "polkavm-common", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -9304,7 +9262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15e85319a0d5129dc9f021c62607e0804f5fb777a05cdda44d750ac0732def66" dependencies = [ "polkavm-derive-impl", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -9325,9 +9283,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30054e72317ab98eddd8561db0f6524df3367636884b7b21b703e4b280a84a14" +checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" dependencies = [ "cfg-if", "concurrent-queue", @@ -9425,7 +9383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -9542,7 +9500,7 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -9588,7 +9546,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -9942,7 +9900,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -10054,16 +10012,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom 0.2.12", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -10263,7 +10222,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.21", + "semver 1.0.22", ] [[package]] @@ -10335,7 +10294,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring 0.17.7", + "ring 0.17.8", "rustls-webpki", "sct", ] @@ -10367,7 +10326,7 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -10413,9 +10372,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "safe_arch" @@ -10545,7 +10504,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -10825,7 +10784,7 @@ name = "sc-consensus-grandpa" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.6.0#61801ce324f18eacb9c29e2f674f0d262a00bd4d" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.9", "array-bytes 6.2.2", "async-trait", "dyn-clone", @@ -11102,7 +11061,7 @@ name = "sc-network-gossip" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.6.0#61801ce324f18eacb9c29e2f674f0d262a00bd4d" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.9", "futures", "futures-timer", "libp2p", @@ -11514,7 +11473,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -11702,7 +11661,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.9", "cfg-if", "hashbrown 0.13.2", ] @@ -11777,7 +11736,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -11883,9 +11842,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] @@ -11898,9 +11857,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -11916,20 +11875,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -12024,16 +11983,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared_child" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "shlex" version = "1.3.0" @@ -12330,7 +12279,7 @@ dependencies = [ "chacha20poly1305", "curve25519-dalek 4.1.2", "rand_core 0.6.4", - "ring 0.17.7", + "ring 0.17.8", "rustc_version", "sha2 0.10.8", "subtle 2.5.0", @@ -12424,7 +12373,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -12695,13 +12644,13 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "quote", "sp-core-hashing 9.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.6.0)", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -12735,17 +12684,17 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -12762,7 +12711,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" dependencies = [ "environmental", "parity-scale-codec", @@ -12980,7 +12929,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13006,20 +12955,20 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" dependencies = [ "Inflector", "expander 2.0.0", "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -13110,7 +13059,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" [[package]] name = "sp-storage" @@ -13128,7 +13077,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13166,7 +13115,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" dependencies = [ "parity-scale-codec", "sp-std 14.0.0", @@ -13204,7 +13153,7 @@ name = "sp-trie" version = "22.0.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.6.0#61801ce324f18eacb9c29e2f674f0d262a00bd4d" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.9", "hash-db", "lazy_static", "memory-db", @@ -13248,7 +13197,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -13267,7 +13216,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b79bf4fb1fec1f7a7483f9a2baa0a1e7a4fcb9c8" +source = "git+https://github.com/paritytech/polkadot-sdk#e4b6b8cd7973633f86d1b92a56abf2a946b7be84" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13518,7 +13467,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -13684,7 +13633,7 @@ dependencies = [ "quote", "scale-info", "subxt-metadata", - "syn 2.0.48", + "syn 2.0.50", "thiserror", "tokio", ] @@ -13712,10 +13661,10 @@ version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12e8be9ab6fe88b8c13edbe15911e148482cfb905a8b8d5b8d766a64c54be0bd" dependencies = [ - "darling 0.20.5", + "darling 0.20.7", "proc-macro-error", "subxt-codegen", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -13766,9 +13715,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -13816,9 +13765,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "temp-dir" @@ -13889,7 +13838,7 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -13900,7 +13849,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -13911,9 +13860,9 @@ checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -14044,7 +13993,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14113,7 +14062,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.5", + "toml_edit 0.22.6", ] [[package]] @@ -14160,15 +14109,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" dependencies = [ "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.0", + "winnow 0.6.2", ] [[package]] @@ -14236,7 +14185,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14279,7 +14228,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14721,7 +14670,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", "wasm-bindgen-shared", ] @@ -14755,7 +14704,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -15117,7 +15066,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -15342,7 +15291,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -15369,7 +15318,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -15404,17 +15353,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.3", + "windows_aarch64_msvc 0.52.3", + "windows_i686_gnu 0.52.3", + "windows_i686_msvc 0.52.3", + "windows_x86_64_gnu 0.52.3", + "windows_x86_64_gnullvm 0.52.3", + "windows_x86_64_msvc 0.52.3", ] [[package]] @@ -15431,9 +15380,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" [[package]] name = "windows_aarch64_msvc" @@ -15449,9 +15398,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" [[package]] name = "windows_i686_gnu" @@ -15467,9 +15416,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" [[package]] name = "windows_i686_msvc" @@ -15485,9 +15434,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" [[package]] name = "windows_x86_64_gnu" @@ -15503,9 +15452,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" [[package]] name = "windows_x86_64_gnullvm" @@ -15521,9 +15470,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" [[package]] name = "windows_x86_64_msvc" @@ -15539,9 +15488,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" [[package]] name = "winnow" @@ -15554,9 +15503,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1dbce9e90e5404c5a52ed82b1d13fc8cfbdad85033b6f57546ffd1265f8451" +checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178" dependencies = [ "memchr", ] @@ -15629,19 +15578,36 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", +] + +[[package]] +name = "xshell" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2107fe03e558353b4c71ad7626d58ed82efaf56c54134228608893c77023ad" +dependencies = [ + "xshell-macros", ] +[[package]] +name = "xshell-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e2c411759b501fb9501aac2b1b2d287a6e93e5bdcf13c25306b23e1b716dd0e" + [[package]] name = "xtask" version = "0.1.0" dependencies = [ "anyhow", "clap", - "ctrlc", - "duct", + "nix 0.27.1", + "serde_json", + "tokio", "tracing", "tracing-subscriber 0.3.18", + "xshell", ] [[package]] @@ -15690,7 +15656,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -15710,7 +15676,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d8807f4..91929d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ futures = { version = "0.3.29" } jsonrpsee = { version = "0.20.3" } tracing = { version = "0.1.40" } tracing-subscriber = { version = "0.3.18" } -tokio = { version = "1.34.0" } +tokio = { version = "1.36.0" } async-trait = { version = "0.1.74" } fex = { version = "0.4.3" } hex-literal = { version = "0.4.1" } @@ -181,5 +181,6 @@ pallet-ikura-blobs = { path = "ikura/chain/pallets/blobs", default-features = fa pallet-ikura-length-fee-adjustment = { path = "ikura/chain/pallets/length-fee-adjustment", default-features = false } # xtask -duct = { version = "0.13.7" } +xshell = { version = "0.2.5" } +nix = { version = "0.27.1" } ctrlc = { version = "3.4.2" } diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 6fca116..d5c583d 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -10,9 +10,11 @@ license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -duct = { workspace = true } +xshell = { workspace = true } +nix = { workspace = true, features = ["signal", "process"] } +tokio = { workspace = true, features = ["rt", "macros", "rt-multi-thread", "time", "process", "sync", "signal"] } clap = { workspace = true, features = ["derive"] } anyhow = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } -ctrlc = { workspace = true } +serde_json = { workspace = true } diff --git a/xtask/src/build.rs b/xtask/src/build.rs index dd684bb..becc716 100644 --- a/xtask/src/build.rs +++ b/xtask/src/build.rs @@ -1,44 +1,42 @@ -use crate::{cli::BuildParams, logging::create_with_logs}; -use duct::cmd; +use crate::{cli::BuildParams, logging::create_log_file, run_with_logs}; // TODO: https://github.com/thrumdev/blobs/issues/225 -pub fn build(project_path: &std::path::Path, params: BuildParams) -> anyhow::Result<()> { +pub async fn build(project_path: &std::path::Path, params: BuildParams) -> anyhow::Result<()> { if params.skip { return Ok(()); } + let sh = xshell::Shell::new()?; + tracing::info!("Building logs redirected {}", params.log_path); - let with_logs = create_with_logs(project_path, params.log_path); + let log_path = dbg!(create_log_file(project_path, ¶ms.log_path)); // `it is advisable to use CARGO environmental variable to get the right cargo` // quoted by xtask readme let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_string()); - with_logs( + run_with_logs!( "Building ikura-node", - cmd!(&cargo, "build", "-p", "ikura-node", "--release"), - ) - .run()?; + sh, + "{cargo} build -p ikura-node --release", + log_path + )?; - with_logs( + run_with_logs!( "Building ikura-shim", - cmd!(&cargo, "build", "-p", "ikura-shim", "--release"), - ) - .run()?; + sh, + "{cargo} build -p ikura-node --release", + log_path + )?; - let sov_demo_rollup_path = project_path.join("demo/sovereign/demo-rollup/"); - #[rustfmt::skip] - with_logs( + sh.change_dir(project_path.join("demo/sovereign/demo-rollup/")); + run_with_logs!( "Building sovereign demo-rollup", - cmd!( - "sh", "-c", - format!( - "cd {} && {cargo} build --release", - sov_demo_rollup_path.to_string_lossy() - ) - ), - ).run()?; + sh, + "{cargo} build --release", + log_path + )?; Ok(()) } diff --git a/xtask/src/logging.rs b/xtask/src/logging.rs index 76bdbdb..9bc3471 100644 --- a/xtask/src/logging.rs +++ b/xtask/src/logging.rs @@ -1,11 +1,10 @@ -use std::path::Path; -use std::{io::Write, path::PathBuf}; -use tracing::{info, warn}; +use std::path::{Path, PathBuf}; +use tracing::warn; // If log_path is relative it will be made absolute relative to the project_path // // The absolute path of where the log file is created is returned -fn create_log_file(project_path: &Path, log_path: &String) -> std::io::Result { +pub fn create_log_file(project_path: &Path, log_path: &String) -> Option { let mut log_path: PathBuf = Path::new(&log_path).to_path_buf(); if log_path.is_relative() { @@ -13,53 +12,89 @@ fn create_log_file(project_path: &Path, log_path: &String) -> std::io::Result Box duct::Expression> { - let without_logs = |description: &str, cmd: duct::Expression| -> duct::Expression { - info!("{description}"); - cmd - }; - - let log_path = match create_log_file(project_path, &log_path) { - Ok(log_path) => log_path, - Err(e) => { - warn!("Impossible redirect logs, using stdout instead. Error: {e}"); - return Box::new(without_logs); - } - }; +// The description will be logged with the info log level, and the command will be created +// using the provided shell and converted to a tokio::process::Command to redirect stdout and stderr. +// +// If log is None, then things will be redirected to stdout. +// Instead, if it contains a path, it will be used to redirect the command's output. +// +// The provided path needs to be a valid path, `create_log_file` should be used before use this macro +#[macro_export] +macro_rules! cmd_with_logs { + ($description:expr, $sh:expr, $cmd:literal, $log:expr $(,$gpid:literal)?) => {{ + use std::process::Stdio; + tracing::info!("{}", $description); + let (stdout, stderr) = match $log { + None => (Stdio::inherit(), Stdio::inherit()), + Some(ref log_path) => { + // redirecting stdout and stderr into log_path + let mut log_out_file = std::fs::File::options() + .append(true) + .create(true) + .open(&log_path) + .expect("Log file does not exist"); + let log_err_file = log_out_file.try_clone()?; - let with_logs = move |description: &str, cmd: duct::Expression| -> duct::Expression { - // The file has just been created - let mut log_file = std::fs::File::options() - .append(true) - .open(&log_path) - .unwrap(); + use std::io::Write; + let _ = log_out_file + .write(format!("{}\n", $description).as_bytes()) + .map_err(|e| tracing::warn!("Error writing into {log_path}, error: {e}")); + let _ = log_out_file + .flush() + .map_err(|e| tracing::warn!("Error writing into {log_path}, error: {e}")); + (Stdio::from(log_out_file), Stdio::from(log_err_file)) + } + }; + #[allow(unused_mut)] + let mut std_cmd = std::process::Command::from(xshell::cmd!($sh, $cmd)); + $( + use std::os::unix::process::CommandExt; + std_cmd.process_group($gpid); + )? + tokio::process::Command::from(std_cmd) + .stderr(stderr) + .stdout(stdout) + }}; +} - info!("{description}"); - let log_path = log_path.to_string_lossy(); - let _ = log_file - .write(format!("{}\n", description).as_bytes()) - .map_err(|e| warn!("Error writing into {log_path}, error: {e}",)); - let _ = log_file - .flush() - .map_err(|e| warn!("Error writing into {log_path}, error: {e}",)); - cmd.stderr_to_stdout().stdout_file(log_file) - }; +#[macro_export] +macro_rules! spawn_with_logs { + ($description:expr, $sh:expr, $cmd:literal, $log:expr) => {{ + crate::cmd_with_logs!($description, $sh, $cmd, $log) + .kill_on_drop(true) + .spawn() + }}; +} - Box::new(with_logs) +#[macro_export] +macro_rules! run_with_logs { + ($description:expr, $sh:expr, $cmd:literal, $log:expr) => {{ + let exit_status: anyhow::Result = + crate::spawn_with_logs!($description, $sh, $cmd, $log)? + .wait() + .await + .map_err(|e| e.into()); + match exit_status?.code() { + Some(code) if code != 0 => Err(anyhow::anyhow!( + "{}, exit with status code: {code}", + $description + )), + _ => Ok(()), + } + }}; } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 4dbf0c3..ea02b5f 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -7,73 +7,107 @@ mod zombienet; use clap::Parser; use cli::{test, Cli, Commands}; -use std::{ - path::{Path, PathBuf}, - str, -}; +use std::{path::PathBuf, str}; +use tokio::sync::mpsc; +use xshell::{cmd, Shell}; -fn main() -> anyhow::Result<()> { +#[tokio::main] +async fn main() -> anyhow::Result<()> { init_logging()?; let cli = Cli::parse(); match cli.command { - Commands::Test(params) => test(params)?, - Commands::Zombienet(params) => zombienet(params)?, - } + Commands::Test(params) => test(params).await?, + Commands::Zombienet(params) => zombienet(params).await?, + }; Ok(()) } -fn test(params: test::Params) -> anyhow::Result<()> { - let project_path = obtain_project_path()?; +async fn test(params: test::Params) -> anyhow::Result<()> { + // Create the ctrl_c handle and the channel used to communicate the pgid that needs to be killed + let (ctrl_c_handle, tx) = ctrl_c_handler(); + tokio::select!( + _ = ctrl_c_handle => Ok(()), + res = test_procedure(params, tx) => res + ) +} +async fn test_procedure(params: test::Params, tx: mpsc::Sender) -> anyhow::Result<()> { + let project_path = obtain_project_path()?; init_env(&project_path, params.no_infer_bin_path)?; - build::build(&project_path, params.build)?; + build::build(&project_path, params.build).await?; // the variables must be kept alive and not dropped // otherwise the child process will be killed - let _zombienet = zombienet::Zombienet::try_new(&project_path, params.zombienet)?; - let _shim = shim::Shim::try_new(&project_path, params.shim)?; - let sovereign = sovereign::Sovereign::try_new(&project_path, params.sovereign)?; + let _zombienet = zombienet::Zombienet::try_new(&project_path, params.zombienet, tx).await?; + let _shim = shim::Shim::try_new(&project_path, params.shim).await?; + let sovereign = sovereign::Sovereign::try_new(&project_path, params.sovereign).await?; - // TODO: https://github.com/thrumdev/blobs/issues/226 - // Wait for the sovereign rollup to be ready - std::thread::sleep(std::time::Duration::from_secs(20)); + //// TODO: https://github.com/thrumdev/blobs/issues/226 + //// Wait for the sovereign rollup to be ready + tokio::time::sleep(std::time::Duration::from_secs(30)).await; - sovereign.test_sovereign_rollup()?; + sovereign.test_sovereign_rollup().await?; Ok(()) } -fn zombienet(params: crate::cli::zombienet::Params) -> anyhow::Result<()> { +async fn zombienet(params: crate::cli::zombienet::Params) -> anyhow::Result<()> { let project_path = obtain_project_path()?; - build::build(&project_path, params.build)?; - let _zombienet = zombienet::Zombienet::try_new(&project_path, params.zombienet)?; - wait_interrupt(); + build::build(&project_path, params.build).await?; + // Create the ctrl_c handle and the channel used to communicate the pgid that needs to be killed + let (ctrl_c_handle, tx) = ctrl_c_handler(); + let _zombienet = zombienet::Zombienet::try_new(&project_path, params.zombienet, tx).await?; + ctrl_c_handle.await?; Ok(()) } -fn obtain_project_path() -> anyhow::Result { - #[rustfmt::skip] - let project_path = duct::cmd!( - "sh", "-c", - "cargo metadata --format-version 1 | jq -r '.workspace_root'" - ) - .stdout_capture() - .run()?; - Ok(PathBuf::from(str::from_utf8(&project_path.stdout)?.trim())) +// Spawn a new task to wait for the ctrl_c event (SIGINT signal). +// Upon receipt, it will kill any processes that would not normally be terminated when handling SIGINT. +// +// A channel is used to send group IDs of processes that need to be terminated on ctrl_c. +// +// This is necessary because typically, a shell receiving a ctrl_c (SIGINT) signal will terminate +// the process and its children but not the processes spawned by them. +// +// In this testing tool, grandchild processes are required and need to be managed. +// One approach is to use the process group ID (pgid) and the `killpg` syscall +// to terminate all processes under the same pgid. +// +// The channel is used collect all pgids that need to be terminated upon the ctrl_c event; +// otherwise, some processes could remain as zombie processes. +// +// The task will manage the receiver of the channel, while the sender will receive the handle of the task for reference. +fn ctrl_c_handler() -> (tokio::task::JoinHandle<()>, mpsc::Sender) { + let (tx, mut rx) = mpsc::channel::(100); + + let handle = tokio::task::spawn(async move { + tokio::signal::ctrl_c() + .await + .expect("Failed to listen for ctrl_c (SIGINT) signal"); + + while let Some(gpid) = rx.recv().await { + use nix::{sys::signal, unistd::Pid}; + signal::killpg(Pid::from_raw(gpid as i32), Some(signal::Signal::SIGKILL)) + .expect("Failed kill {gpid} process group id"); + } + }); + (handle, tx) } -/// Blocks until ^C signal is delivered to this process. Uses global resource, don't proliferate. -fn wait_interrupt() { - use std::sync::mpsc; - let (tx, rx) = mpsc::channel(); - ctrlc::set_handler(move || { - let _ = tx.send(()); - }) - .unwrap(); - let _ = rx.recv(); +// Extract from cargo metadata the specified key using the provided Shell +fn from_cargo_metadata(sh: &Shell, key: &str) -> anyhow::Result { + let cargo_metadata = cmd!(sh, "cargo metadata --format-version 1").read()?; + let mut json: serde_json::Value = serde_json::from_str(&cargo_metadata)?; + serde_json::from_value(json[key].take()).map_err(|e| e.into()) +} + +fn obtain_project_path() -> anyhow::Result { + let sh = xshell::Shell::new()?; + let project_path = from_cargo_metadata(&sh, "workspace_root")?; + Ok(PathBuf::from(project_path.trim())) } // Set up environment variables needed by the compilation and testing process. @@ -97,23 +131,13 @@ fn init_env(project_path: &PathBuf, no_infer_bin_path: bool) -> anyhow::Result<( let path = std::env::var("PATH").unwrap_or_else(|_| "".to_string()); - #[rustfmt::skip] - let chain_target_path = duct::cmd!( - "sh", "-c", - "cargo metadata --format-version 1 | jq -r '.target_directory'" - ) - .stdout_capture() - .run()?; - let chain_target_path = str::from_utf8(&chain_target_path.stdout)?.trim(); - - #[rustfmt::skip] - let sovereign_target_path = duct::cmd!( - "sh", "-c", - "cd demo/sovereign && cargo metadata --format-version 1 | jq -r '.target_directory'" - ) - .stdout_capture() - .run()?; - let sovereign_target_path = str::from_utf8(&sovereign_target_path.stdout)?.trim(); + let sh = xshell::Shell::new()?; + + sh.change_dir(project_path); + let chain_target_path = from_cargo_metadata(&sh, "target_directory")?; + + sh.change_dir(project_path.join("demo/sovereign")); + let sovereign_target_path = from_cargo_metadata(&sh, "target_directory")?; std::env::set_var( "PATH", @@ -137,8 +161,11 @@ fn init_logging() -> anyhow::Result<()> { } fn check_binary(binary: &'static str, error_msg: &'static str) -> anyhow::Result<()> { - if let Err(_) = duct::cmd!("sh", "-c", format!("command -v {}", binary)) - .stdout_null() + let sh = xshell::Shell::new()?; + if let Err(_) = xshell::cmd!(sh, "sh -c") + .arg(format!("command -v {binary}")) + .quiet() + .ignore_stdout() .run() { anyhow::bail!(error_msg); diff --git a/xtask/src/shim.rs b/xtask/src/shim.rs index 5f1af56..3ebc878 100644 --- a/xtask/src/shim.rs +++ b/xtask/src/shim.rs @@ -1,12 +1,15 @@ -use crate::{check_binary, cli::test::ShimParams, logging::create_with_logs}; -use duct::cmd; -use tracing::info; +use crate::{ + check_binary, cli::test::ShimParams, logging::create_log_file, run_with_logs, spawn_with_logs, +}; -pub struct Shim(duct::Handle); +pub struct Shim(tokio::process::Child); impl Shim { // Try launching the shim, it requires an up an running ikura-node - pub fn try_new(project_path: &std::path::Path, params: ShimParams) -> anyhow::Result { + pub async fn try_new( + project_path: &std::path::Path, + params: ShimParams, + ) -> anyhow::Result { check_binary( "ikura-shim", "'ikura-node' is not found in PATH. \n \ @@ -14,29 +17,25 @@ impl Shim { )?; tracing::info!("Shim logs redirected to {}", params.log_path); - let with_logs = create_with_logs(project_path, params.log_path); + let log_path = create_log_file(project_path, ¶ms.log_path); + + let sh = xshell::Shell::new()?; // Wait for the shim to be connected, which indicates that the network is ready - with_logs( + run_with_logs!( "Wait for the network to be ready", - cmd!("ikura-shim", "query", "block", "--wait", "1"), - ) - .run()?; + sh, + "ikura-shim query block --wait 1", + log_path + )?; - let shim_handle = with_logs( + let shim_process = spawn_with_logs!( "Launching Shim", - cmd!("ikura-shim", "serve", "--submit-dev-alice"), - ) - .start()?; - - Ok(Self(shim_handle)) - } -} + sh, + "ikura-shim serve --submit-dev-alice", + log_path + )?; -impl Drop for Shim { - // duct::Handle does not implement kill on drop - fn drop(&mut self) { - info!("Shim process is going to be killed"); - let _ = self.0.kill(); + Ok(Self(shim_process)) } } diff --git a/xtask/src/sovereign.rs b/xtask/src/sovereign.rs index fec32cf..66c6a71 100644 --- a/xtask/src/sovereign.rs +++ b/xtask/src/sovereign.rs @@ -1,23 +1,29 @@ -use crate::{check_binary, cli::test::SovereignParams, logging::create_with_logs}; +use crate::{ + check_binary, cli::test::SovereignParams, logging::create_log_file, run_with_logs, + spawn_with_logs, +}; use anyhow::bail; -use duct::cmd; use std::path::{Path, PathBuf}; use tracing::info; pub struct Sovereign { - process: duct::Handle, - with_logs: Box duct::Expression>, + pub rollup_process: tokio::process::Child, + log_path: Option, project_path: PathBuf, } impl Sovereign { // Try launching the sovereing rollup using zombienet - pub fn try_new(project_path: &Path, params: SovereignParams) -> anyhow::Result { - info!("Deleting rollup db if it already exists"); + pub async fn try_new(project_path: &Path, params: SovereignParams) -> anyhow::Result { + let sh = xshell::Shell::new()?; + info!("Deleting rollup db if it already exists"); let sovereign_demo_data = project_path.join("demo/sovereign/demo-rollup/demo_data"); if sovereign_demo_data.as_path().exists() { - cmd!("rm", "-r", sovereign_demo_data).run()?; + xshell::cmd!(sh, "rm -r {sovereign_demo_data}") + .quiet() + .ignore_status() + .run()?; } check_binary( @@ -27,31 +33,27 @@ impl Sovereign { )?; info!("Sovereign logs redirected to {}", params.log_path); - let with_logs = create_with_logs(project_path, params.log_path.clone()); + let log_path = create_log_file(project_path, ¶ms.log_path); - let sov_demo_rollup_path = project_path.join("demo/sovereign/demo-rollup/"); //TODO: https://github.com/thrumdev/blobs/issues/227 - #[rustfmt::skip] - let sovereign_handle = with_logs( + let sov_demo_rollup_path = project_path.join("demo/sovereign/demo-rollup/"); + sh.change_dir(sov_demo_rollup_path); + let rollup_process = spawn_with_logs!( "Launching sovereign rollup", - cmd!( - "sh", "-c", - format!( - "cd {} && sov-demo-rollup", - sov_demo_rollup_path.to_string_lossy() - ) - ), - ).start()?; + sh, + "sov-demo-rollup", + log_path + )?; Ok(Self { - process: sovereign_handle, - with_logs, + rollup_process, + log_path, project_path: project_path.to_path_buf(), }) } // All the networks must be up (relaychain and ikura-node), including the sovereign rollup." - pub fn test_sovereign_rollup(&self) -> anyhow::Result<()> { + pub async fn test_sovereign_rollup(&self) -> anyhow::Result<()> { check_binary( "sov-cli", "'sov-cli' is not found in PATH. \n \ @@ -61,60 +63,62 @@ impl Sovereign { info!("Running sovereign rollup test"); //TODO: https://github.com/thrumdev/blobs/issues/227 + let sh = xshell::Shell::new()?; let sov_demo_rollup_path = self.project_path.join("demo/sovereign/demo-rollup/"); + sh.change_dir(sov_demo_rollup_path); + let test_data_path = "../test-data/"; - let run_cli_cmd = - |description: &str, args: &str| -> std::io::Result { - let args = [ - "-c", - &format!( - "cd {} && sov-cli {args}", - sov_demo_rollup_path.to_string_lossy() - ), - ]; - - (self.with_logs)(description, duct::cmd("sh", args)).run() - }; - - run_cli_cmd("setup rpc endpoint", "rpc set-url http://127.0.0.1:12345")?; - - run_cli_cmd( + run_with_logs!( + "setup rpc endpoint", + sh, + "sov-cli rpc set-url http://127.0.0.1:12345", + self.log_path + )?; + + run_with_logs!( "import keys", - &format!("keys import --nickname token_deployer --path {}keys/token_deployer_private_key.json", test_data_path), + sh, + "sov-cli keys import --nickname token_deployer --path {test_data_path}keys/token_deployer_private_key.json", + self.log_path )?; - run_cli_cmd( + run_with_logs!( "create a new token", - &format!( - "transactions import from-file bank --path {}requests/create_token.json", - test_data_path - ), + sh, + "sov-cli transactions import from-file bank --path {test_data_path}requests/create_token.json", + self.log_path )?; - run_cli_cmd( + run_with_logs!( "mint just created token", - &format!( - "transactions import from-file bank --path {}requests/mint.json", - test_data_path - ), + sh, + "sov-cli transactions import from-file bank --path {test_data_path}requests/mint.json", + self.log_path )?; - run_cli_cmd( + run_with_logs!( "submit batch with two transactions", - "rpc submit-batch by-nickname token_deployer", + sh, + "sov-cli rpc submit-batch by-nickname token_deployer", + self.log_path )?; // TODO: https://github.com/thrumdev/blobs/issues/226 info!("waiting for the rollup to process the transactions"); - std::thread::sleep(std::time::Duration::from_secs(30)); - - let response = cmd!("sh", "-c", "curl -s -X POST -H \ - \"Content-Type: application/json\" \ - -d '{\"jsonrpc\":\"2.0\",\"method\":\"bank_supplyOf\",\ - \"params\":[\"sov1zdwj8thgev2u3yyrrlekmvtsz4av4tp3m7dm5mx5peejnesga27svq9m72\"],\ - \"id\":1}' http://127.0.0.1:12345").stdout_capture().run()?; - - if let None = String::from_utf8(response.stdout)?.find("\"amount\":4000") { + tokio::time::sleep(std::time::Duration::from_secs(30)).await; + + let response = xshell::cmd!(sh, "sh -c") + .arg( + "curl -s -X POST -H \ + \"Content-Type: application/json\" \ + -d '{\"jsonrpc\":\"2.0\",\"method\":\"bank_supplyOf\",\ + \"params\":[\"sov1zdwj8thgev2u3yyrrlekmvtsz4av4tp3m7dm5mx5peejnesga27svq9m72\"],\ + \"id\":1}' http://127.0.0.1:12345", + ) + .quiet() + .read()?; + + if let None = response.find("\"amount\":4000") { bail!("Tokens not properly minted in the rollup") } @@ -123,11 +127,3 @@ impl Sovereign { Ok(()) } } - -impl Drop for Sovereign { - // duct::Handle does not implement kill on drop - fn drop(&mut self) { - info!("Sovereign rollup process is going to be killed"); - let _ = self.process.kill(); - } -} diff --git a/xtask/src/zombienet.rs b/xtask/src/zombienet.rs index 9eef5de..d0033d9 100644 --- a/xtask/src/zombienet.rs +++ b/xtask/src/zombienet.rs @@ -1,9 +1,8 @@ -use crate::{check_binary, cli::ZombienetParams, logging::create_with_logs}; -use duct::cmd; +use crate::{check_binary, cli::ZombienetParams, cmd_with_logs, logging::create_log_file}; use std::path::Path; use tracing::info; -pub struct Zombienet(duct::Handle); +pub struct Zombienet(tokio::process::Child); impl Zombienet { // Try launching the network using zombienet @@ -11,11 +10,20 @@ impl Zombienet { // The binaries for zombienet and polkadot are expected to be in the PATH, // while polkadot-execute-worker and polkadot-prepare-worker // need to be in the same directory as the polkadot binary. - pub fn try_new(project_path: &Path, params: ZombienetParams) -> anyhow::Result { + pub async fn try_new( + project_path: &Path, + params: ZombienetParams, + tx: tokio::sync::mpsc::Sender, + ) -> anyhow::Result { + let sh = xshell::Shell::new()?; + info!("Deleting the zombienet folder if it already exists"); let zombienet_folder = project_path.join("zombienet"); if zombienet_folder.as_path().exists() { - cmd!("rm", "-r", zombienet_folder).run()?; + xshell::cmd!(sh, "rm -r {zombienet_folder}") + .quiet() + .ignore_status() + .run()?; } info!("Checking binaries availability"); @@ -38,26 +46,32 @@ impl Zombienet { )?; tracing::info!("Zombienet logs redirected to {}", params.log_path); - let with_logs = create_with_logs(project_path, params.log_path); + let log_path = create_log_file(project_path, ¶ms.log_path); - #[rustfmt::skip] - let zombienet_handle = with_logs( + sh.change_dir(project_path); + let zombienet_process = cmd_with_logs!( "Launching zombienet", - cmd!( - "sh", "-c", - format!("cd {} && zombienet spawn -p native --dir zombienet testnet.toml", project_path.to_string_lossy()) - ), - ).start()?; + sh, + "zombienet spawn -p native --dir zombienet testnet.toml", + log_path, + 0 // argument for .process_group() + ) + .spawn()?; + + let Some(id) = zombienet_process.id() else { + anyhow::bail!("Failed to fectch zombienet process id (PID)") + }; + tx.send(id).await.expect("ctrl_c handler must be alive"); - Ok(Self(zombienet_handle)) + Ok(Self(zombienet_process)) } } impl Drop for Zombienet { - // duct::Handle does not implement kill on drop fn drop(&mut self) { - // TODO: https://github.com/thrumdev/blobs/issues/228 - info!("Zombienet process is going to be killed"); - let _ = self.0.kill(); + use nix::{sys::signal, unistd::Pid}; + let Some(id) = self.0.id() else { return }; + signal::killpg(Pid::from_raw(id as i32), Some(signal::Signal::SIGKILL)) + .expect("Failed kill zombienet process"); } }