From 3147dd3da99f502df664834fc39e4ea7cf9263f1 Mon Sep 17 00:00:00 2001 From: gabriele-0201 Date: Tue, 27 Feb 2024 19:58:02 +0100 Subject: [PATCH] xtask: migrating from duct to xshell xshell does not handle async, so it also requires the addition of Tokio. process group IDs are used to kill all xtask subprocesses --- Cargo.lock | 434 +++++++++++++++++++---------------------- Cargo.toml | 5 +- xtask/Cargo.toml | 6 +- xtask/src/build.rs | 49 ++--- xtask/src/logging.rs | 178 ++++++++++++----- xtask/src/main.rs | 124 +++++++----- xtask/src/shim.rs | 44 ++--- xtask/src/sovereign.rs | 137 ++++++------- xtask/src/zombienet.rs | 49 +++-- 9 files changed, 539 insertions(+), 487 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 71f3754..db93115 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", @@ -762,7 +762,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -779,7 +779,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -983,7 +983,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -1280,9 +1280,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" @@ -1364,7 +1364,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -1372,11 +1372,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", ] @@ -1455,7 +1454,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -1513,9 +1512,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", @@ -1523,9 +1522,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", @@ -1543,7 +1542,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -1967,16 +1966,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" @@ -2270,7 +2259,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2604,7 +2593,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2622,9 +2611,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", @@ -2634,9 +2623,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", @@ -2644,24 +2633,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]] @@ -2676,12 +2665,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]] @@ -2700,16 +2689,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]] @@ -2725,13 +2714,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]] @@ -2914,7 +2903,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2954,7 +2943,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.48", + "syn 2.0.50", "termcolor", "toml 0.8.10", "walkdir", @@ -2978,18 +2967,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" @@ -3145,7 +3122,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3156,7 +3133,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3234,9 +3211,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", @@ -3259,7 +3236,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", ] @@ -3294,7 +3271,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3574,7 +3551,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3713,7 +3690,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]] @@ -3725,7 +3702,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3735,7 +3712,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]] @@ -3914,7 +3891,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3942,9 +3919,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" @@ -4220,7 +4197,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]] @@ -4229,7 +4206,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", ] @@ -4251,9 +4228,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" @@ -4959,15 +4936,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" @@ -5991,7 +5959,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -6005,7 +5973,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -6016,7 +5984,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -6027,7 +5995,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -6429,9 +6397,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", @@ -6796,16 +6764,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" @@ -7715,7 +7673,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -8193,7 +8151,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -8234,7 +8192,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -8278,9 +8236,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" @@ -9376,7 +9334,7 @@ dependencies = [ "polkavm-common", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -9386,7 +9344,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]] @@ -9407,9 +9365,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", @@ -9507,7 +9465,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]] @@ -9624,7 +9582,7 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -9670,7 +9628,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -9752,7 +9710,7 @@ dependencies = [ "prost 0.12.3", "prost-types 0.12.3", "regex", - "syn 2.0.48", + "syn 2.0.50", "tempfile", "which", ] @@ -9780,7 +9738,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -10078,7 +10036,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -10190,16 +10148,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]] @@ -10399,7 +10358,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]] @@ -10471,7 +10430,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", ] @@ -10503,7 +10462,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", ] @@ -10549,9 +10508,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" @@ -10681,7 +10640,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -10961,7 +10920,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", @@ -11238,7 +11197,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", @@ -11650,7 +11609,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -11838,7 +11797,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", ] @@ -11913,7 +11872,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", ] @@ -12019,9 +11978,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", ] @@ -12034,9 +11993,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", ] @@ -12052,20 +12011,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", @@ -12160,16 +12119,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" @@ -12466,7 +12415,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", @@ -12560,7 +12509,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -12831,13 +12780,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", @@ -12871,17 +12820,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]] @@ -12898,7 +12847,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", @@ -13116,7 +13065,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", @@ -13142,20 +13091,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]] @@ -13246,7 +13195,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" @@ -13264,7 +13213,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", @@ -13302,7 +13251,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", @@ -13340,7 +13289,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", @@ -13384,7 +13333,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -13403,7 +13352,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", @@ -13654,7 +13603,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -13820,7 +13769,7 @@ dependencies = [ "quote", "scale-info", "subxt-metadata", - "syn 2.0.48", + "syn 2.0.50", "thiserror", "tokio", ] @@ -13848,10 +13797,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]] @@ -13902,9 +13851,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", @@ -13958,9 +13907,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" @@ -14031,7 +13980,7 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14042,7 +13991,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14053,9 +14002,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", @@ -14196,7 +14145,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14265,7 +14214,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.5", + "toml_edit 0.22.6", ] [[package]] @@ -14312,15 +14261,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]] @@ -14360,7 +14309,7 @@ dependencies = [ "proc-macro2", "prost-build 0.12.3", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14433,7 +14382,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14476,7 +14425,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -14918,7 +14867,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", "wasm-bindgen-shared", ] @@ -14952,7 +14901,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -15314,7 +15263,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", ] @@ -15539,7 +15488,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]] @@ -15566,7 +15515,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]] @@ -15601,17 +15550,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]] @@ -15628,9 +15577,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" @@ -15646,9 +15595,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" @@ -15664,9 +15613,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" @@ -15682,9 +15631,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" @@ -15700,9 +15649,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" @@ -15718,9 +15667,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" @@ -15736,9 +15685,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" @@ -15751,9 +15700,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", ] @@ -15826,19 +15775,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]] @@ -15887,7 +15853,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -15907,7 +15873,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 8ee2fca..4c2bcff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,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" } @@ -184,5 +184,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..dfab309 100644 --- a/xtask/src/build.rs +++ b/xtask/src/build.rs @@ -1,44 +1,37 @@ -use crate::{cli::BuildParams, logging::create_with_logs}; -use duct::cmd; +use crate::{ + cli::BuildParams, + logging::{create_log_file, WithLogs}, +}; +use xshell::cmd; // 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 = 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( - "Building ikura-node", - cmd!(&cargo, "build", "-p", "ikura-node", "--release"), - ) - .run()?; - - with_logs( - "Building ikura-shim", - cmd!(&cargo, "build", "-p", "ikura-shim", "--release"), - ) - .run()?; - - let sov_demo_rollup_path = project_path.join("demo/sovereign/demo-rollup/"); - #[rustfmt::skip] - with_logs( - "Building sovereign demo-rollup", - cmd!( - "sh", "-c", - format!( - "cd {} && {cargo} build --release", - sov_demo_rollup_path.to_string_lossy() - ) - ), - ).run()?; + cmd!(sh, "{cargo} build -p ikura-node --release") + .run_with_logs("Building ikura-node", &log_path) + .await??; + + cmd!(sh, "{cargo} build -p ikura-node --release") + .run_with_logs("Building ikura-shim", &log_path) + .await??; + + sh.change_dir(project_path.join("demo/sovereign/demo-rollup/")); + cmd!(sh, "{cargo} build --release") + .run_with_logs("Building sovereign demo-rollup", &log_path) + .await??; Ok(()) } diff --git a/xtask/src/logging.rs b/xtask/src/logging.rs index 76bdbdb..a371647 100644 --- a/xtask/src/logging.rs +++ b/xtask/src/logging.rs @@ -1,11 +1,19 @@ -use std::path::Path; -use std::{io::Write, path::PathBuf}; -use tracing::{info, warn}; +use std::{ + fs::{create_dir_all, File}, + io::Write, + path::{Path, PathBuf}, + process::{Command as StdCommand, Stdio}, +}; +use tokio::{ + process::{Child, Command as TokioCommand}, + task::JoinHandle, +}; +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 +21,133 @@ 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 - }; +// The description will be logged at the info log level. The command will be modified and converted to +// a tokio::process::Command, redirecting stdout and stderr. +// +// If the log is None, stdout and stderr will be redirected to the caller's stdout. +// If it contains a path, an attempt will be made to use it to redirect the command's +// stdout and stderr. If, for any reason, the log file cannot be opened or created, +// redirection will default back to the caller's stdout. +pub trait WithLogs { + fn with_logs(self, description: &str, log_path: &Option) -> TokioCommand; + fn spawn_with_logs( + self, + description: &str, + log_path: &Option, + ) -> anyhow::Result; + fn run_with_logs( + self, + description: &str, + log_path: &Option, + ) -> JoinHandle>; +} + +impl WithLogs for StdCommand { + fn with_logs(self, description: &str, log_path: &Option) -> TokioCommand { + tracing::info!("{description}"); + + let (stdout, stderr) = log_path + .as_ref() + .and_then(|log_path| { + match std::fs::File::options() + .append(true) + .create(true) + .open(log_path.clone()) + { + // If log file exists then use it + Ok(mut log_out_file) => { + let Ok(log_err_file) = log_out_file.try_clone() else { + return Some((Stdio::inherit(), Stdio::inherit())); + }; + + let _ = log_out_file + .write(format!("{}\n", description).as_bytes()) + .map_err(|e| { + warn!("Error writing into {}, error: {e}", log_path.display()) + }); + let _ = log_out_file.flush().map_err(|e| { + warn!("Error writing into {}, error: {e}", log_path.display()) + }); + Some((Stdio::from(log_out_file), Stdio::from(log_err_file))) + } + // If log file does not exist then use inherited stdout and stderr + Err(_) => Some((Stdio::inherit(), Stdio::inherit())), + } + }) + // If log file is not specified use inherited stdout and stderr + .unwrap_or((Stdio::inherit(), Stdio::inherit())); + + let mut command = TokioCommand::from(self); + command.stderr(stderr).stdout(stdout); + command + } + + fn spawn_with_logs( + self, + description: &str, + log_path: &Option, + ) -> anyhow::Result { + self.with_logs(description, log_path) + .kill_on_drop(true) + .spawn() + .map_err(|e| e.into()) + } - 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); - } - }; + fn run_with_logs( + self, + description: &str, + log_path: &Option, + ) -> tokio::task::JoinHandle> { + let description = String::from(description); + let log_path = log_path.clone(); + tokio::task::spawn(async move { + let exit_status: anyhow::Result = self + .spawn_with_logs(&description, &log_path)? + .wait() + .await + .map_err(|e| e.into()); + match exit_status?.code() { + Some(code) if code != 0 => Err(anyhow::anyhow!( + "{description}, exit with status code: {code}", + )), + _ => Ok(()), + } + }) + } +} - 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(); +impl<'a> WithLogs for xshell::Cmd<'a> { + fn with_logs(self, description: &str, log_path: &Option) -> TokioCommand { + StdCommand::from(self).with_logs(description, log_path) + } - 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) - }; + fn spawn_with_logs( + self, + description: &str, + log_path: &Option, + ) -> anyhow::Result { + StdCommand::from(self).spawn_with_logs(description, log_path) + } - Box::new(with_logs) + fn run_with_logs( + self, + description: &str, + log_path: &Option, + ) -> tokio::task::JoinHandle> { + StdCommand::from(self).run_with_logs(description, log_path) + } } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 3c03330..6026b34 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -7,70 +7,76 @@ mod zombienet; use clap::Parser; use cli::{test, Cli, Commands}; +use std::{os::unix::process::CommandExt, process::Command as StdCommand}; use std::{path::PathBuf, str}; +use tokio::{signal, task}; +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<()> { + tokio::select!( + _ = wait_interrupt() => Ok(()), + res = test_procedure(params) => res + ) +} +async fn test_procedure(params: test::Params) -> 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).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)); + 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?; + let _zombienet = zombienet::Zombienet::try_new(&project_path, params.zombienet).await?; + wait_interrupt().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())) +// Wait until ^C signal is delivered to this process +fn wait_interrupt() -> task::JoinHandle> { + task::spawn(async { signal::ctrl_c().await.map_err(|e| e.into()) }) } -/// 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. @@ -94,23 +100,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", @@ -134,11 +130,33 @@ 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); } Ok(()) } + +// 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. +// Spawn a process with a group ID (pgid) and then call the `killpg` syscall +// to terminate all processes under the same pgid. +pub trait ProcessGroupId { + // Convert Self into an std::process::Command with the specified pgid + fn process_group(self, pgid: i32) -> StdCommand; +} + +impl<'a> ProcessGroupId for xshell::Cmd<'a> { + fn process_group(self, pgid: i32) -> StdCommand { + let mut command = StdCommand::from(self); + command.process_group(pgid); + command + } +} diff --git a/xtask/src/shim.rs b/xtask/src/shim.rs index 4568b45..dea3104 100644 --- a/xtask/src/shim.rs +++ b/xtask/src/shim.rs @@ -1,12 +1,17 @@ -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, WithLogs}, +}; -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 +19,18 @@ 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); - // Wait for the shim to be connected, which indicates that the network is ready - with_logs( - "Wait for the network to be ready", - cmd!("ikura-shim", "query", "block", "--wait", "1"), - ) - .run()?; + let sh = xshell::Shell::new()?; - let shim_handle = with_logs( - "Launching Shim", - cmd!("ikura-shim", "serve", "sov", "--submit-dev-alice"), - ) - .start()?; + // Wait for the shim to be connected, which indicates that the network is ready + xshell::cmd!(sh, "ikura-shim query block --wait 1") + .run_with_logs("Wait for the network to be ready", &log_path) + .await??; - Ok(Self(shim_handle)) - } -} + let shim_process = xshell::cmd!(sh, "ikura-shim serve sov --submit-dev-alice") + .spawn_with_logs("Launching Shim", &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..0fae945 100644 --- a/xtask/src/sovereign.rs +++ b/xtask/src/sovereign.rs @@ -1,23 +1,31 @@ -use crate::{check_binary, cli::test::SovereignParams, logging::create_with_logs}; +use crate::{ + check_binary, + cli::test::SovereignParams, + logging::{create_log_file, WithLogs}, +}; use anyhow::bail; -use duct::cmd; use std::path::{Path, PathBuf}; use tracing::info; +use xshell::cmd; 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()?; + cmd!(sh, "rm -r {sovereign_demo_data}") + .quiet() + .ignore_status() + .run()?; } check_binary( @@ -27,31 +35,23 @@ 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( - "Launching sovereign rollup", - cmd!( - "sh", "-c", - format!( - "cd {} && sov-demo-rollup", - sov_demo_rollup_path.to_string_lossy() - ) - ), - ).start()?; + let sov_demo_rollup_path = project_path.join("demo/sovereign/demo-rollup/"); + sh.change_dir(sov_demo_rollup_path); + let rollup_process = + cmd!(sh, "sov-demo-rollup").spawn_with_logs("Launching sovereign 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 +61,51 @@ 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( - "import keys", - &format!("keys import --nickname token_deployer --path {}keys/token_deployer_private_key.json", test_data_path), - )?; - run_cli_cmd( - "create a new token", - &format!( - "transactions import from-file bank --path {}requests/create_token.json", - test_data_path - ), - )?; + cmd!(sh, "sov-cli rpc set-url http://127.0.0.1:12345") + .run_with_logs("setup rpc endpoint", &self.log_path) + .await??; - run_cli_cmd( - "mint just created token", - &format!( - "transactions import from-file bank --path {}requests/mint.json", - test_data_path - ), - )?; + cmd!(sh, "sov-cli keys import --nickname token_deployer --path {test_data_path}keys/token_deployer_private_key.json") + .run_with_logs("import keys", &self.log_path) + .await??; - run_cli_cmd( - "submit batch with two transactions", - "rpc submit-batch by-nickname token_deployer", - )?; + cmd!(sh, "sov-cli transactions import from-file bank --path {test_data_path}requests/create_token.json") + .run_with_logs("create a new token", &self.log_path) + .await??; - // 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)); + cmd!( + sh, + "sov-cli transactions import from-file bank --path {test_data_path}requests/mint.json" + ) + .run_with_logs("mint just created token", &self.log_path) + .await??; - 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()?; + cmd!(sh, "sov-cli rpc submit-batch by-nickname token_deployer") + .run_with_logs("submit batch with two transactions", &self.log_path) + .await??; - if let None = String::from_utf8(response.stdout)?.find("\"amount\":4000") { + // TODO: https://github.com/thrumdev/blobs/issues/226 + info!("waiting for the rollup to process the transactions"); + tokio::time::sleep(std::time::Duration::from_secs(30)).await; + + let response = 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 +114,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..1a65f63 100644 --- a/xtask/src/zombienet.rs +++ b/xtask/src/zombienet.rs @@ -1,9 +1,14 @@ -use crate::{check_binary, cli::ZombienetParams, logging::create_with_logs}; -use duct::cmd; +use crate::{ + check_binary, + cli::ZombienetParams, + logging::{create_log_file, WithLogs}, + ProcessGroupId, +}; use std::path::Path; use tracing::info; +use xshell::cmd; -pub struct Zombienet(duct::Handle); +pub struct Zombienet(tokio::process::Child); impl Zombienet { // Try launching the network using zombienet @@ -11,11 +16,16 @@ 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) -> 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()?; + cmd!(sh, "rm -r {zombienet_folder}") + .quiet() + .ignore_status() + .run()?; } info!("Checking binaries availability"); @@ -38,26 +48,23 @@ impl Zombienet { )?; tracing::info!("Zombienet logs redirected to {}", params.log_path); - let with_logs = create_with_logs(project_path, params.log_path); - - #[rustfmt::skip] - let zombienet_handle = with_logs( - "Launching zombienet", - cmd!( - "sh", "-c", - format!("cd {} && zombienet spawn -p native --dir zombienet testnet.toml", project_path.to_string_lossy()) - ), - ).start()?; - - Ok(Self(zombienet_handle)) + let log_path = create_log_file(project_path, ¶ms.log_path); + + sh.change_dir(project_path); + + let zombienet_process = cmd!(sh, "zombienet spawn -p native --dir zombienet testnet.toml") + .process_group(0) + .spawn_with_logs("Launching zombienet", &log_path)?; + + 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"); } }