From 76e82637fea2dd48540769c41319f7098267f40f Mon Sep 17 00:00:00 2001 From: Hugo Caillard <911307+hugocaillard@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:25:43 +0200 Subject: [PATCH 1/2] refactor: clean and update dependencies --- Cargo.lock | 1187 ++++--------------------------------------------- Cargo.toml | 25 +- src/config.rs | 1 + src/lib.rs | 14 +- 4 files changed, 111 insertions(+), 1116 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d9d8b9..fc15ed2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,41 +26,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array 0.14.7", -] - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "aes-gcm" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle 2.6.1", -] - [[package]] name = "ahash" version = "0.8.11" @@ -113,55 +78,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "anstream" -version = "0.6.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" - -[[package]] -name = "anstyle-parse" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - [[package]] name = "anyhow" version = "1.0.89" @@ -186,12 +102,6 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - [[package]] name = "async-stream" version = "0.3.5" @@ -211,7 +121,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -222,7 +132,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -412,18 +322,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "block-buffer" version = "0.7.3" @@ -463,33 +361,12 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "tinyvec", -] - [[package]] name = "bumpalo" version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - [[package]] name = "byte-tools" version = "0.3.1" @@ -525,26 +402,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - -[[package]] -name = "chainhook-types" -version = "1.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f0d358e5c530dd6888e4678ef4ba3f7782525653a1012d33e96a48020c418d" -dependencies = [ - "hex", - "schemars", - "serde", - "serde_derive", - "serde_json", - "strum 0.23.0", -] - [[package]] name = "chrono" version = "0.4.38" @@ -560,78 +417,10 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - -[[package]] -name = "clap" -version = "4.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "syn 2.0.79", -] - -[[package]] -name = "clap_lex" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" - -[[package]] -name = "clar2wasm" -version = "0.1.0" -source = "git+https://github.com/stacks-network/clarity-wasm.git?branch=main#3d8adaa7ba7656b0d9e87f299344cfb9f4ceac7c" -dependencies = [ - "chrono", - "clap", - "clarity", - "lazy_static", - "regex", - "rusqlite", - "sha2 0.10.8", - "stacks-common", - "walrus", - "wasmtime", - "wat", -] - [[package]] name = "clarinet-deployments" -version = "2.9.0" -source = "git+https://github.com/hirosystems/clarinet.git?rev=7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b#7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" +version = "2.10.0" +source = "git+https://github.com/hirosystems/clarinet.git?rev=323e24844cbec88b488c89c61fe8649bddc9bda9#323e24844cbec88b488c89c61fe8649bddc9bda9" dependencies = [ "base58 0.2.0", "base64 0.21.7", @@ -656,12 +445,11 @@ dependencies = [ [[package]] name = "clarinet-files" -version = "2.9.0" -source = "git+https://github.com/hirosystems/clarinet.git?rev=7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b#7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" +version = "2.10.0" +source = "git+https://github.com/hirosystems/clarinet.git?rev=323e24844cbec88b488c89c61fe8649bddc9bda9#323e24844cbec88b488c89c61fe8649bddc9bda9" dependencies = [ "bip39", "bitcoin", - "chainhook-types", "clarinet-utils", "clarity", "clarity-repl", @@ -671,14 +459,14 @@ dependencies = [ "serde_derive", "serde_json", "tiny-hderive", - "toml 0.5.11", + "toml", "url", ] [[package]] name = "clarinet-utils" version = "1.0.0" -source = "git+https://github.com/hirosystems/clarinet.git?rev=7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b#7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" +source = "git+https://github.com/hirosystems/clarinet.git?rev=323e24844cbec88b488c89c61fe8649bddc9bda9#323e24844cbec88b488c89c61fe8649bddc9bda9" dependencies = [ "hmac 0.12.1", "pbkdf2", @@ -688,7 +476,7 @@ dependencies = [ [[package]] name = "clarity" version = "2.3.0" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat%2Fclarity-wasm-develop#8ad0d2a2ecc767c4d1adb8d163bfdd59b4ccc523" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat%2Fclarity-wasm-develop#a4925be0779f046b0244e5dd331170b326d48773" dependencies = [ "hashbrown 0.14.5", "integer-sqrt", @@ -696,8 +484,6 @@ dependencies = [ "rand 0.8.5", "rand_chacha 0.3.1", "regex", - "rstest", - "rstest_reuse", "rusqlite", "serde", "serde_derive", @@ -710,53 +496,27 @@ dependencies = [ [[package]] name = "clarity-repl" -version = "2.9.0" -source = "git+https://github.com/hirosystems/clarinet.git?rev=7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b#7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" +version = "2.10.0" +source = "git+https://github.com/hirosystems/clarinet.git?rev=323e24844cbec88b488c89c61fe8649bddc9bda9#323e24844cbec88b488c89c61fe8649bddc9bda9" dependencies = [ "ansi_term", "atty", - "bytes", "chrono", - "clar2wasm", "clarity", "colored", - "debug_types", - "futures", "getrandom 0.2.15", - "hiro-system-kit 0.1.0 (git+https://github.com/hirosystems/clarinet.git?rev=7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b)", - "httparse", + "hiro-system-kit 0.1.0 (git+https://github.com/hirosystems/clarinet.git?rev=323e24844cbec88b488c89c61fe8649bddc9bda9)", "lazy_static", - "log", - "memchr", - "pico-args", "pox-locking", "prettytable-rs", "regex", "reqwest", - "rustyline", "serde", "serde_derive", "serde_json", "sha2 0.10.8", - "tokio", - "tokio-util", ] -[[package]] -name = "clipboard-win" -version = "5.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15efe7a882b08f34e38556b14f2fb3daa98769d06c7f0c1b076dfd0d983bc892" -dependencies = [ - "error-code", -] - -[[package]] -name = "colorchoice" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" - [[package]] name = "colored" version = "2.1.0" @@ -902,7 +662,7 @@ dependencies = [ "itertools", "log", "smallvec", - "wasmparser 0.116.1", + "wasmparser", "wasmtime-types", ] @@ -962,7 +722,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array 0.14.7", - "rand_core 0.6.4", "typenum", ] @@ -1007,15 +766,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - [[package]] name = "curve25519-dalek" version = "2.0.0" @@ -1054,7 +804,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1070,17 +820,6 @@ dependencies = [ "parking_lot_core", ] -[[package]] -name = "debug_types" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2613f33760bd27a70ee84f5a8c0bd97e874fa6f89e205356ef8325786dd22cef" -dependencies = [ - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "debugid" version = "0.8.0" @@ -1180,12 +919,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "dyn-clone" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" - [[package]] name = "ed25519" version = "2.2.3" @@ -1224,12 +957,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" -[[package]] -name = "endian-type" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" - [[package]] name = "equivalent" version = "1.0.1" @@ -1246,24 +973,12 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "error-code" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" - [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - [[package]] name = "fallible-iterator" version = "0.3.0" @@ -1276,41 +991,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" -[[package]] -name = "fastrand" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" - -[[package]] -name = "fd-lock" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5768da2206272c81ef0b5e951a41862938a6070da63bcea197899942d3b947" -dependencies = [ - "cfg-if", - "rustix", - "windows-sys 0.52.0", -] - [[package]] name = "fiat-crypto" version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", - "static_assertions", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1341,17 +1027,11 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1364,9 +1044,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1374,15 +1054,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1391,44 +1071,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-timer" -version = "3.0.3" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1507,34 +1181,13 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "ghash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" -dependencies = [ - "opaque-debug 0.3.1", - "polyval", -] - -[[package]] -name = "gimli" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" -dependencies = [ - "fallible-iterator 0.2.0", - "indexmap 1.9.3", - "stable_deref_trait", -] - [[package]] name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ - "fallible-iterator 0.3.0", + "fallible-iterator", "indexmap 2.5.0", "stable_deref_trait", ] @@ -1599,27 +1252,12 @@ dependencies = [ "hashbrown 0.14.5", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - [[package]] name = "hermit-abi" version = "0.1.19" @@ -1641,12 +1279,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - [[package]] name = "hex-conservative" version = "0.1.2" @@ -1681,7 +1313,7 @@ dependencies = [ [[package]] name = "hiro-system-kit" version = "0.1.0" -source = "git+https://github.com/hirosystems/clarinet.git?rev=7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b#7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" +source = "git+https://github.com/hirosystems/clarinet.git?rev=323e24844cbec88b488c89c61fe8649bddc9bda9#323e24844cbec88b488c89c61fe8649bddc9bda9" dependencies = [ "ansi_term", "atty", @@ -1740,15 +1372,6 @@ dependencies = [ "hmac 0.8.1", ] -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "http" version = "0.2.12" @@ -1972,26 +1595,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "indexmap" version = "1.9.3" @@ -2013,15 +1616,6 @@ dependencies = [ "serde", ] -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array 0.14.7", -] - [[package]] name = "instant" version = "0.1.13" @@ -2057,12 +1651,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - [[package]] name = "itertools" version = "0.10.5" @@ -2413,15 +2001,6 @@ dependencies = [ "libc", ] -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - [[package]] name = "memchr" version = "2.7.4" @@ -2488,15 +2067,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "nibble_vec" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" -dependencies = [ - "smallvec", -] - [[package]] name = "nix" version = "0.23.2" @@ -2510,28 +2080,6 @@ dependencies = [ "memoffset 0.6.5", ] -[[package]] -name = "nix" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-conv" version = "0.1.0" @@ -2591,9 +2139,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -2612,14 +2160,14 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -2636,60 +2184,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "p256k1" -version = "7.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40a031a559eb38c35a14096f21c366254501a06d41c4b327d2a7515d713a5b7" -dependencies = [ - "bitvec", - "bs58 0.4.0", - "cc", - "hex", - "itertools", - "num-traits", - "primitive-types", - "proc-macro2", - "quote", - "rand_core 0.6.4", - "rustfmt-wrapper", - "serde", - "sha2 0.10.8", - "syn 2.0.79", -] - -[[package]] -name = "parity-scale-codec" -version = "3.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "parking_lot" version = "0.12.3" @@ -2757,12 +2251,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pico-args" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" - [[package]] name = "pin-project" version = "1.1.5" @@ -2780,7 +2268,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2811,28 +2299,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "polynomial" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27abb6e4638dcecc65a92b50d7f1d87dd6dea987ba71db987b6bf881f4877e9d" -dependencies = [ - "num-traits", - "serde", -] - -[[package]] -name = "polyval" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug 0.3.1", - "universal-hash", -] - [[package]] name = "portable-atomic" version = "1.9.0" @@ -2848,7 +2314,7 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "pox-locking" version = "2.4.0" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat%2Fclarity-wasm-develop#8ad0d2a2ecc767c4d1adb8d163bfdd59b4ccc523" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat%2Fclarity-wasm-develop#a4925be0779f046b0244e5dd331170b326d48773" dependencies = [ "clarity", "slog", @@ -2878,26 +2344,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "primitive-types" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" -dependencies = [ - "fixed-hash", - "impl-codec", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" -dependencies = [ - "toml_edit", -] - [[package]] name = "proc-macro2" version = "1.0.86" @@ -2973,22 +2419,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "radix_trie" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" -dependencies = [ - "endian-type", - "nibble_vec", -] - [[package]] name = "rand" version = "0.7.3" @@ -3127,17 +2557,8 @@ checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.8", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -3148,15 +2569,9 @@ checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.5" @@ -3215,57 +2630,19 @@ dependencies = [ "cc", "cfg-if", "getrandom 0.2.15", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "ripemd" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "rstest" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de1bb486a691878cd320c2f0d319ba91eeaa2e894066d8b5f8f117c000e9d962" -dependencies = [ - "futures", - "futures-timer", - "rstest_macros", - "rustc_version", -] - -[[package]] -name = "rstest_macros" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290ca1a1c8ca7edb7c3283bd44dc35dd54fdec6253a3912e201ba1072018fca8" -dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "rustc_version", - "syn 1.0.109", - "unicode-ident", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", ] [[package]] -name = "rstest_reuse" -version = "0.5.0" +name = "ripemd" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f80dcc84beab3a327bbe161f77db25f336a1452428176787c8c79ac79d7073" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "quote", - "rand 0.8.5", - "rustc_version", - "syn 1.0.109", + "digest 0.10.7", ] [[package]] @@ -3275,7 +2652,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ "bitflags 2.6.0", - "fallible-iterator 0.3.0", + "fallible-iterator", "fallible-streaming-iterator", "hashlink", "libsqlite3-sys", @@ -3301,12 +2678,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - [[package]] name = "rustc_version" version = "0.4.1" @@ -3316,19 +2687,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rustfmt-wrapper" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1adc9dfed5cc999077978cc7163b9282c5751c8d39827c4ea8c8c220ca5a440" -dependencies = [ - "serde", - "tempfile", - "thiserror", - "toml 0.8.19", - "toolchain_find", -] - [[package]] name = "rustix" version = "0.38.37" @@ -3388,67 +2746,12 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" -[[package]] -name = "rustyline" -version = "14.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e8936da37efd9b6d4478277f4b2b9bb5cdb37a113e8d63222e58da647e63" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "clipboard-win", - "fd-lock", - "home", - "libc", - "log", - "memchr", - "nix 0.28.0", - "radix_trie", - "unicode-segmentation", - "unicode-width", - "utf8parse", - "windows-sys 0.52.0", -] - [[package]] name = "ryu" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schemars" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" -dependencies = [ - "dyn-clone", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 2.0.79", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -3513,9 +2816,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" dependencies = [ "serde_derive", ] @@ -3532,31 +2835,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", -] - -[[package]] -name = "serde_derive_internals" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "indexmap 2.5.0", "itoa", @@ -3565,15 +2857,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - [[package]] name = "serde_stacker" version = "0.1.11" @@ -3643,7 +2926,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3702,15 +2985,6 @@ dependencies = [ "keccak", ] -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - [[package]] name = "shlex" version = "1.3.0" @@ -3873,18 +3147,17 @@ dependencies = [ [[package]] name = "stacks-codec" -version = "2.9.0" -source = "git+https://github.com/hirosystems/clarinet.git?rev=7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b#7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" +version = "2.10.0" +source = "git+https://github.com/hirosystems/clarinet.git?rev=323e24844cbec88b488c89c61fe8649bddc9bda9#323e24844cbec88b488c89c61fe8649bddc9bda9" dependencies = [ "clarity", "serde", - "wsts", ] [[package]] name = "stacks-common" version = "0.0.2" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat%2Fclarity-wasm-develop#8ad0d2a2ecc767c4d1adb8d163bfdd59b4ccc523" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat%2Fclarity-wasm-develop#a4925be0779f046b0244e5dd331170b326d48773" dependencies = [ "chrono", "curve25519-dalek 2.0.0", @@ -3892,7 +3165,7 @@ dependencies = [ "hashbrown 0.14.5", "lazy_static", "libc", - "nix 0.23.2", + "nix", "percent-encoding", "rand 0.8.5", "ripemd", @@ -3908,20 +3181,16 @@ dependencies = [ "slog-term", "time", "winapi", - "wsts", ] [[package]] name = "stacks-devnet-api" version = "1.3.0" dependencies = [ - "chainhook-types", "clarinet-deployments", "clarinet-files", - "clarity-repl", "futures", "hiro-system-kit 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "http-body 0.4.6", "hyper 0.14.30", "k8s-openapi", "kube", @@ -3930,19 +3199,19 @@ dependencies = [ "serde_json", "serde_yaml 0.8.26", "serial_test", - "strum 0.24.1", - "strum_macros 0.24.3", + "strum", + "strum_macros", "test-case", "tokio", - "toml 0.5.11", + "toml", "tower", "tower-test", ] [[package]] name = "stacks-rpc-client" -version = "2.9.0" -source = "git+https://github.com/hirosystems/clarinet.git?rev=7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b#7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" +version = "2.10.0" +source = "git+https://github.com/hirosystems/clarinet.git?rev=323e24844cbec88b488c89c61fe8649bddc9bda9#323e24844cbec88b488c89c61fe8649bddc9bda9" dependencies = [ "clarity", "hmac 0.12.1", @@ -3957,53 +3226,19 @@ dependencies = [ "tiny-hderive", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "strum" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" -dependencies = [ - "strum_macros 0.23.1", -] - [[package]] name = "strum" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" -[[package]] -name = "strum_macros" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - [[package]] name = "strum_macros" version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "rustversion", @@ -4035,9 +3270,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" dependencies = [ "proc-macro2", "quote", @@ -4059,31 +3294,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "target-lexicon" version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" -[[package]] -name = "tempfile" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - [[package]] name = "term" version = "0.7.0" @@ -4113,7 +3329,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4124,7 +3340,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "test-case-core", ] @@ -4145,7 +3361,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4219,9 +3435,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" dependencies = [ "backtrace", "bytes", @@ -4253,7 +3469,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4326,53 +3542,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" -dependencies = [ - "indexmap 2.5.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "toolchain_find" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc8c9a7f0a2966e1acdaf0461023d0b01471eeead645370cf4c3f5cff153f2a" -dependencies = [ - "home", - "once_cell", - "regex", - "semver", - "walkdir", -] - [[package]] name = "tower" version = "0.4.13" @@ -4457,7 +3626,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4467,36 +3636,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", ] [[package]] @@ -4511,18 +3650,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -4544,12 +3671,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - [[package]] name = "unicode-width" version = "0.1.14" @@ -4562,16 +3683,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle 2.6.1", -] - [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -4596,24 +3707,12 @@ dependencies = [ "serde", ] -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "uuid" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "vcpkg" version = "0.2.15" @@ -4626,44 +3725,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "walrus" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c03529cd0c4400a2449f640d2f27cd1b48c3065226d15e26d98e4429ab0adb7" -dependencies = [ - "anyhow", - "gimli 0.26.2", - "id-arena", - "leb128", - "log", - "walrus-macro", - "wasm-encoder 0.29.0", - "wasmparser 0.80.2", -] - -[[package]] -name = "walrus-macro" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e5bd22c71e77d60140b0bd5be56155a37e5bd14e24f5f87298040d0cc40d7" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "want" version = "0.3.1" @@ -4707,7 +3768,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-shared", ] @@ -4741,7 +3802,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4752,15 +3813,6 @@ version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" -[[package]] -name = "wasm-encoder" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" -dependencies = [ - "leb128", -] - [[package]] name = "wasm-encoder" version = "0.36.2" @@ -4779,12 +3831,6 @@ dependencies = [ "leb128", ] -[[package]] -name = "wasmparser" -version = "0.80.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449167e2832691a1bff24cde28d2804e90e09586a448c8e76984792c44334a6b" - [[package]] name = "wasmparser" version = "0.116.1" @@ -4820,7 +3866,7 @@ dependencies = [ "serde_json", "target-lexicon", "wasm-encoder 0.36.2", - "wasmparser 0.116.1", + "wasmparser", "wasmtime-cache", "wasmtime-component-macro", "wasmtime-cranelift", @@ -4856,7 +3902,7 @@ dependencies = [ "serde", "serde_derive", "sha2 0.10.8", - "toml 0.5.11", + "toml", "windows-sys 0.48.0", "zstd", ] @@ -4870,7 +3916,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasmtime-component-util", "wasmtime-wit-bindgen", "wit-parser", @@ -4901,7 +3947,7 @@ dependencies = [ "object 0.32.2", "target-lexicon", "thiserror", - "wasmparser 0.116.1", + "wasmparser", "wasmtime-cranelift-shared", "wasmtime-environ", "wasmtime-versioned-export-macros", @@ -4939,7 +3985,7 @@ dependencies = [ "serde_derive", "target-lexicon", "thiserror", - "wasmparser 0.116.1", + "wasmparser", "wasmtime-types", ] @@ -5047,7 +4093,7 @@ dependencies = [ "serde", "serde_derive", "thiserror", - "wasmparser 0.116.1", + "wasmparser", ] [[package]] @@ -5058,7 +4104,7 @@ checksum = "f50f51f8d79bfd2aa8e9d9a0ae7c2d02b45fe412e62ff1b87c0c81b07c738231" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5068,7 +4114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b804dfd3d0c0d6d37aa21026fe7772ba1a769c89ee4f5c4f13b82d91d75216f" dependencies = [ "anyhow", - "heck 0.4.1", + "heck", "indexmap 2.5.0", "wit-parser", ] @@ -5136,15 +4182,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -5338,15 +4375,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" -dependencies = [ - "memchr", -] - [[package]] name = "wit-parser" version = "0.13.2" @@ -5364,37 +4392,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "wsts" -version = "9.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f38f50568ce9a30f2d041c26b1286fd453a166aec0059eb63aa51a15c46d776" -dependencies = [ - "aes-gcm", - "bs58 0.5.1", - "hashbrown 0.14.5", - "hex", - "num-traits", - "p256k1", - "polynomial", - "primitive-types", - "rand_core 0.6.4", - "serde", - "sha2 0.10.8", - "thiserror", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "yaml-rust" version = "0.4.5" @@ -5422,7 +4419,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9b0c095..3f418ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,30 +14,21 @@ repository = "https://github.com/hirosystems/stacks-devnet-api" [dependencies] kube = { version="0.82.2", features = ["client", "runtime"] } k8s-openapi = { version = "0.18.0", features = ["v1_25"] } -futures = "0.3.28" +futures = "0.3.31" tokio = { version = "1.35.1", features = ["full"] } serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0.114" +serde_json = "1.0.132" serde_yaml = "0.8.23" hyper = { version = "0.14", features = ["full"] } tower = "0.4.13" -http-body = "0.4.5" -hiro-system-kit = {version = "0.1.0", features = ["log"]} +hiro-system-kit = { version = "0.1.0", features = ["log"] } strum_macros = "0.24.3" strum = "0.24.1" -# clarity-repl = "1.8.0" -# clarity-repl = {version = "2.2.0", path = "../clarinet/components/clarity-repl" } -clarity-repl = {version = "2.9.0", git = "https://github.com/hirosystems/clarinet.git", rev="7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" } -# clarinet-files = {version = "1.0.3" } -# clarinet-files = {version = "2.2.0", path = "../clarinet/components/clarinet-files" } -clarinet-files = {version = "2.9.0", git = "https://github.com/hirosystems/clarinet.git", rev="7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" } -# clarinet-deployments = {version = "1.0.3" } -# clarinet-deployments = {version = "2.2.0", path = "../clarinet/components/clarinet-deployments" } -clarinet-deployments = {version = "2.9.0", git = "https://github.com/hirosystems/clarinet.git", rev="7085b877cdb9d533ccbf24cd947c5b4ee04bcc5b" } -# chainhook-types = "1.0" -chainhook-types = { version = "1.3" } toml = "0.5.9" +clarinet-files = "2" +clarinet-deployments = "2" + [dev-dependencies] tower-test = "0.4.0" test-case = "3.1.0" @@ -46,3 +37,7 @@ serial_test = "2.0.0" [features] k8s_tests = [] + +[patch.crates-io] +clarinet-files = { version = "2",git = "https://github.com/hirosystems/clarinet.git", rev = "323e24844cbec88b488c89c61fe8649bddc9bda9" } +clarinet-deployments = { version = "2",git = "https://github.com/hirosystems/clarinet.git", rev = "323e24844cbec88b488c89c61fe8649bddc9bda9" } diff --git a/src/config.rs b/src/config.rs index 28df851..91d026f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -214,6 +214,7 @@ mod tests { file_buffer } + #[track_caller] fn get_template_config(file_path: &str) -> StacksDevnetConfig { let file_buffer = read_file(file_path); diff --git a/src/lib.rs b/src/lib.rs index 6f7be10..f384144 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,10 @@ -use chainhook_types::StacksNetwork; -use clarinet_files::compute_addresses; +use clarinet_files::{compute_addresses, StacksNetwork}; use futures::future::try_join3; use hiro_system_kit::{slog, Logger}; -use hyper::{body::Bytes, Body, Client as HttpClient, Request, Response, Uri}; +use hyper::{ + body::{Bytes, HttpBody}, + Body, Client as HttpClient, Request, Response, Uri, +}; use k8s_openapi::{ api::{ apps::v1::{Deployment, StatefulSet}, @@ -165,7 +167,7 @@ impl StacksDevnetApiK8sManager { S: tower::Service, Response = Response> + Send + 'static, S::Future: Send + 'static, S::Error: Into, - B: http_body::Body + Send + 'static, + B: HttpBody + Send + 'static, B::Error: Into, T: Into, { @@ -1170,7 +1172,7 @@ impl StacksDevnetApiK8sManager { rpcserialversion=1 disablewallet=0 fallbackfee=0.00001 - + [regtest] bind=0.0.0.0:{} rpcbind=0.0.0.0:{} @@ -1394,7 +1396,7 @@ impl StacksDevnetApiK8sManager { burn_fee_cap = 20_000 poll_time_secs = 1 timeout = 30 - peer_host = "{}" + peer_host = "{}" rpc_ssl = false wallet_name = "{}" username = "{}" From 29bb337872b61c0046d490c0f5cad8961be15500 Mon Sep 17 00:00:00 2001 From: Hugo Caillard <911307+hugocaillard@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:54:29 +0200 Subject: [PATCH 2/2] refactor: cargo clippy --- .github/workflows/ci.yaml | 21 ++- .vscode/settings.json | 3 + src/api_config.rs | 2 +- src/config.rs | 28 ++-- src/lib.rs | 234 ++++++++++++++-------------------- src/main.rs | 34 ++--- src/resources/service.rs | 2 +- src/resources/stateful_set.rs | 10 +- src/resources/tests.rs | 46 +++---- src/responder.rs | 18 +-- src/routes.rs | 24 ++-- src/tests/mod.rs | 107 +++++++--------- 12 files changed, 228 insertions(+), 301 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ac35284..3fa6207 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,20 +14,27 @@ concurrency: group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} cancel-in-progress: true +# Make sure CI fails on all warnings, including Clippy lints +env: + RUSTFLAGS: "-Dwarnings" + jobs: format: - name: Format check runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Rust toolchain - run: rustup toolchain install stable --profile minimal --component rustfmt - + - uses: actions/checkout@v4 - name: Run rustfmt run: cargo fmt --all -- --check + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: test + run: cargo --version + - name: Run Clippy + run: cargo clippy --all-targets --all-features + build: runs-on: ubuntu-latest outputs: diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1c565eb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "rust-analyzer.check.command": "clippy" +} diff --git a/src/api_config.rs b/src/api_config.rs index f7f4bbf..865ed0d 100644 --- a/src/api_config.rs +++ b/src/api_config.rs @@ -42,7 +42,7 @@ impl ApiConfig { let config_file: ApiConfig = match toml::from_slice(&file_buffer) { Ok(s) => s, Err(e) => { - panic!("Config file malformatted {}", e.to_string()); + panic!("Config file malformatted {}", e); } }; config_file diff --git a/src/config.rs b/src/config.rs index 91d026f..65842c3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -45,26 +45,23 @@ impl StacksDevnetConfig { ); if user_id != self.namespace { - let msg = + let message = format!("{context}, ERROR: devnet namespace must match authenticated user id"); - ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); - return Err(DevNetError { - message: msg.into(), - code: 400, - }); + ctx.try_log(|logger| slog::warn!(logger, "{}", message)); + return Err(DevNetError { message, code: 400 }); } let project_manifest_yaml_string = self .get_project_manifest_yaml_string() - .map_err(|e| log_and_return_err(e, &context, &ctx))?; + .map_err(|e| log_and_return_err(e, &context, ctx))?; let (network_manifest_yaml_string, devnet_config) = self .get_network_manifest_string_and_devnet_config() - .map_err(|e| log_and_return_err(e, &context, &ctx))?; + .map_err(|e| log_and_return_err(e, &context, ctx))?; let deployment_plan_yaml_string = self .get_deployment_plan_yaml_string() - .map_err(|e| log_and_return_err(e, &context, &ctx))?; + .map_err(|e| log_and_return_err(e, &context, ctx))?; let mut contracts: Vec<(String, String)> = vec![]; for (contract_identifier, (src, _)) in self.deployment_plan.contracts { @@ -170,7 +167,7 @@ impl StacksDevnetConfig { spec.location = contracts_loc.clone(); }, TransactionSpecification::EmulatedContractCall(_) | TransactionSpecification::EmulatedContractPublish(_) => { - return Err(format!("devnet deployment plans do not support emulated-contract-calls or emulated-contract-publish types")) + return Err("devnet deployment plans do not support emulated-contract-calls or emulated-contract-publish types".to_string()) } TransactionSpecification::ContractCall(_) => {}, TransactionSpecification::BtcTransfer(_) => {}, @@ -184,12 +181,9 @@ impl StacksDevnetConfig { } fn log_and_return_err(e: String, context: &str, ctx: &Context) -> DevNetError { - let msg = format!("{context}, ERROR: {e}"); - ctx.try_log(|logger: &hiro_system_kit::Logger| slog::warn!(logger, "{}", msg)); - DevNetError { - message: msg.into(), - code: 400, - } + let message = format!("{context}, ERROR: {e}"); + ctx.try_log(|logger: &hiro_system_kit::Logger| slog::warn!(logger, "{}", message)); + DevNetError { message, code: 400 } } #[cfg(test)] mod tests { @@ -221,7 +215,7 @@ mod tests { let config_file: StacksDevnetConfig = match serde_json::from_slice(&file_buffer) { Ok(s) => s, Err(e) => { - panic!("Config file malformatted {}", e.to_string()); + panic!("Config file malformatted {}", e); } }; config_file diff --git a/src/lib.rs b/src/lib.rs index f384144..b74b89d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -116,7 +116,7 @@ impl StacksDevnetApiK8sManager { Err(_) => { if cfg!(test) { let is_ci = match env::var("GITHUB_ACTIONS") { - Ok(is_ci) => is_ci == format!("true"), + Ok(is_ci) => is_ci == *"true", Err(_) => false, }; if is_ci { @@ -124,7 +124,7 @@ impl StacksDevnetApiK8sManager { } else { // ensures that if no context is supplied and we're running // tests locally, we deploy to the local kind cluster - Some(format!("kind-kind")) + Some("kind-kind".to_string()) } } else { None @@ -138,14 +138,11 @@ impl StacksDevnetApiK8sManager { cluster: Some(context), user: None, }; - let client_config = - Config::from_kubeconfig(&kube_config) - .await - .unwrap_or_else(|e| { - panic!("could not create kube client config: {}", e.to_string()) - }); + let client_config = Config::from_kubeconfig(&kube_config) + .await + .unwrap_or_else(|e| panic!("could not create kube client config: {}", e)); Client::try_from(client_config) - .unwrap_or_else(|e| panic!("could not create kube client: {}", e.to_string())) + .unwrap_or_else(|e| panic!("could not create kube client: {}", e)) } None => Client::try_default() .await @@ -186,36 +183,32 @@ impl StacksDevnetApiK8sManager { let user_id = &config.user_id; let context = format!("NAMESPACE: {}", &namespace); - let namespace_exists = self.check_namespace_exists(&namespace).await?; + let namespace_exists = self.check_namespace_exists(namespace).await?; if !namespace_exists { if cfg!(debug_assertions) { - self.deploy_namespace(&namespace).await?; + self.deploy_namespace(namespace).await?; } else { - let msg = format!( + let message = format!( "cannot create devnet because namespace {} does not exist", namespace ); - self.ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); - return Err(DevNetError { - message: msg.into(), - code: 400, - }); + self.ctx + .try_log(|logger| slog::warn!(logger, "{}", message)); + return Err(DevNetError { message, code: 400 }); } } let any_assets_exist = self - .check_any_devnet_assets_exist(&namespace, &user_id) + .check_any_devnet_assets_exist(namespace, user_id) .await?; if any_assets_exist { - let msg = format!( + let message = format!( "cannot create devnet because assets already exist {}", context ); - self.ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); - return Err(DevNetError { - message: msg.into(), - code: 409, - }); + self.ctx + .try_log(|logger| slog::warn!(logger, "{}", message)); + return Err(DevNetError { message, code: 409 }); }; self.deploy_bitcoin_node(&config).await?; @@ -309,12 +302,12 @@ impl StacksDevnetApiK8sManager { if errors.is_empty() { Ok(()) } else if errors.len() == 1 { - match errors.get(0) { + match errors.first() { Some(e) => Err(e.clone()), None => unreachable!(), } } else { - let mut msg = format!("multiple errors occurred while deleting devnet: "); + let mut msg = "multiple errors occurred while deleting devnet: ".to_string(); for e in errors { msg = format!("{} \n- {}", msg, e.message); } @@ -325,15 +318,13 @@ impl StacksDevnetApiK8sManager { } } false => { - let msg = format!( + let message = format!( "cannot delete devnet because assets do not exist NAMESPACE: {}", &namespace ); - self.ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); - return Err(DevNetError { - message: msg.into(), - code: 409, - }); + self.ctx + .try_log(|logger| slog::warn!(logger, "{}", message)); + Err(DevNetError { message, code: 409 }) } } } @@ -365,16 +356,10 @@ impl StacksDevnetApiK8sManager { } } Err(e) => { - let msg = format!( - "error getting namespace {}: {}", - namespace_str, - e.to_string() - ); - self.ctx.try_log(|logger| slog::error!(logger, "{}", msg)); - Err(DevNetError { - message: msg, - code: 500, - }) + let message = format!("error getting namespace {}: {}", namespace_str, e); + self.ctx + .try_log(|logger| slog::error!(logger, "{}", message)); + Err(DevNetError { message, code: 500 }) } } } @@ -512,7 +497,7 @@ impl StacksDevnetApiK8sManager { self.ctx.try_log(|logger: &hiro_system_kit::Logger| { slog::info!(logger, "getting pod status {}", context) }); - let pod_api: Api = Api::namespaced(self.client.to_owned(), &namespace); + let pod_api: Api = Api::namespaced(self.client.to_owned(), namespace); let pod_label_selector = format!("{COMPONENT_SELECTOR}={pod}"); let user_label_selector = format!("{USER_SELECTOR}={user_id}"); @@ -533,10 +518,7 @@ impl StacksDevnetApiK8sManager { self.ctx.try_log(|logger: &hiro_system_kit::Logger| { slog::info!(logger, "successfully retrieved pod status {}", context) }); - let start_time = match &status.start_time { - Some(st) => Some(st.0.to_string()), - None => None, - }; + let start_time = status.start_time.as_ref().map(|st| st.0.to_string()); Ok(PodStatusResponse { status: status.phase.to_owned(), start_time, @@ -600,7 +582,7 @@ impl StacksDevnetApiK8sManager { Ok(config) } Err(e) => { - let msg = format!("failed to parse JSON response: {}, ERROR: {}, Raw body: {}", context, e.to_string(), body_str); + let msg = format!("failed to parse JSON response: {}, ERROR: {}, Raw body: {}", context, e, body_str); self.ctx.try_log(|logger| slog::error!(logger, "{}", msg)); Err(DevNetError { message: msg, @@ -612,8 +594,7 @@ impl StacksDevnetApiK8sManager { Err(e) => { let msg = format!( "failed to parse response bytes: {}, ERROR: {}", - context, - e.to_string() + context, e ); self.ctx.try_log(|logger| slog::error!(logger, "{}", msg)); Err(DevNetError { @@ -623,18 +604,14 @@ impl StacksDevnetApiK8sManager { } }, Err(e) => { - let msg = format!( - "failed to query stacks node: {}, ERROR: {}", - context, - e.to_string() - ); + let msg = format!("failed to query stacks node: {}, ERROR: {}", context, e); self.ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); Ok(StacksV2InfoResponse::default()) // Return default response on error } } } Err(e) => { - let msg = format!("failed to parse url: {} ERROR: {}", url, e.to_string()); + let msg = format!("failed to parse url: {} ERROR: {}", url, e); self.ctx.try_log(|logger| slog::error!(logger, "{}", msg)); Err(DevNetError { message: msg, @@ -651,7 +628,7 @@ impl StacksDevnetApiK8sManager { ) -> Result { let context = format!("NAMESPACE: {}", namespace); - match self.check_all_devnet_assets_exist(&namespace).await? { + match self.check_all_devnet_assets_exist(namespace).await? { false => { let msg = format!("not all devnet assets exist {}", context); self.ctx @@ -681,14 +658,10 @@ impl StacksDevnetApiK8sManager { start_time: stacks_api_started_at, }, ) = try_join3( - self.get_pod_status_info(&namespace, user_id, StacksDevnetPod::BitcoindNode), + self.get_pod_status_info(namespace, user_id, StacksDevnetPod::BitcoindNode), + self.get_pod_status_info(namespace, user_id, StacksDevnetPod::StacksBlockchain), self.get_pod_status_info( - &namespace, - user_id, - StacksDevnetPod::StacksBlockchain, - ), - self.get_pod_status_info( - &namespace, + namespace, user_id, StacksDevnetPod::StacksBlockchainApi, ), @@ -696,7 +669,7 @@ impl StacksDevnetApiK8sManager { .await?; // Try to fetch chain info, but handle errors by using default values for the chain tips - let chain_info = match self.get_stacks_v2_info(&namespace).await { + let chain_info = match self.get_stacks_v2_info(namespace).await { Ok(info) => info, Err(e) => { self.ctx.try_log(|logger: &hiro_system_kit::Logger| { @@ -759,7 +732,7 @@ impl StacksDevnetApiK8sManager { } } - async fn get_resource_by_label>( + async fn get_resource_by_label( &self, namespace: &str, name: &str, @@ -771,8 +744,9 @@ impl StacksDevnetApiK8sManager { K: DeserializeOwned, K: std::fmt::Debug, K: Serialize, + K: kube::Resource, { - let resource_api: Api = Api::namespaced(self.client.to_owned(), &namespace); + let resource_api: Api = Api::namespaced(self.client.to_owned(), namespace); let pod_label_selector = format!("{COMPONENT_SELECTOR}={name}"); let user_label_selector = format!("{USER_SELECTOR}={user_id}"); @@ -795,7 +769,7 @@ impl StacksDevnetApiK8sManager { match resource_api.list(&lp).await { Ok(pods) => { - if pods.items.len() > 0 { + if !pods.items.is_empty() { let pod = &pods.items[0]; Ok(Some(pod.clone())) } else { @@ -812,29 +786,24 @@ impl StacksDevnetApiK8sManager { } e => (e.to_string(), 500), }; - let msg = format!("failed to fetch {}, ERROR: {}", resource_details, msg); - self.ctx.try_log(|logger| slog::error!(logger, "{}", msg)); - Err(DevNetError { - message: msg, - code: code, - }) + let message = format!("failed to fetch {}, ERROR: {}", resource_details, msg); + self.ctx + .try_log(|logger| slog::error!(logger, "{}", message)); + Err(DevNetError { message, code }) } } } - async fn get_resource>( - &self, - namespace: &str, - name: &str, - ) -> Result, DevNetError> + async fn get_resource(&self, namespace: &str, name: &str) -> Result, DevNetError> where ::DynamicType: Default, K: Clone, K: DeserializeOwned, K: std::fmt::Debug, K: Serialize, + K: kube::Resource, { - let resource_api: Api = Api::namespaced(self.client.to_owned(), &namespace); + let resource_api: Api = Api::namespaced(self.client.to_owned(), namespace); let resource_details = format!( "RESOURCE: {}, NAME: {}, NAMESPACE: {}", @@ -845,7 +814,7 @@ impl StacksDevnetApiK8sManager { self.ctx .try_log(|logger| slog::info!(logger, "fetching {}", resource_details)); - match resource_api.get_opt(&name).await { + match resource_api.get_opt(name).await { Ok(r) => match r { Some(r) => { self.ctx.try_log(|logger| { @@ -865,17 +834,15 @@ impl StacksDevnetApiK8sManager { kube::Error::Api(api_error) => (api_error.message, api_error.code), e => (e.to_string(), 500), }; - let msg = format!("failed to fetch {}, ERROR: {}", resource_details, msg); - self.ctx.try_log(|logger| slog::error!(logger, "{}", msg)); - Err(DevNetError { - message: msg, - code: code, - }) + let message = format!("failed to fetch {}, ERROR: {}", resource_details, msg); + self.ctx + .try_log(|logger| slog::error!(logger, "{}", message)); + Err(DevNetError { message, code }) } } } - async fn check_resource_exists_by_label>( + async fn check_resource_exists_by_label( &self, namespace: &str, name: &str, @@ -887,6 +854,7 @@ impl StacksDevnetApiK8sManager { K: DeserializeOwned, K: std::fmt::Debug, K: Serialize, + K: kube::Resource, { match self .get_resource_by_label::(namespace, name, user_id) @@ -897,7 +865,7 @@ impl StacksDevnetApiK8sManager { } } - async fn check_resource_exists>( + async fn check_resource_exists( &self, namespace: &str, name: &str, @@ -908,6 +876,7 @@ impl StacksDevnetApiK8sManager { K: DeserializeOwned, K: std::fmt::Debug, K: Serialize, + K: kube::Resource, { match self.get_resource::(namespace, name).await? { Some(_) => Ok(true), @@ -915,7 +884,7 @@ impl StacksDevnetApiK8sManager { } } - async fn deploy_resource>( + async fn deploy_resource( &self, namespace: &str, resource: K, @@ -927,8 +896,9 @@ impl StacksDevnetApiK8sManager { K: DeserializeOwned, K: std::fmt::Debug, K: Serialize, + K: kube::Resource, { - let resource_api: Api = Api::namespaced(self.client.to_owned(), &namespace); + let resource_api: Api = Api::namespaced(self.client.to_owned(), namespace); let pp = PostParams::default(); let name = match resource.meta().name.as_ref() { @@ -1132,7 +1102,7 @@ impl StacksDevnetApiK8sManager { if let Some(configmap_data) = configmap_data { let mut map = BTreeMap::new(); for (key, value) in configmap_data { - map.insert(key.into(), value.into()); + map.insert(key, value); } configmap.data = Some(map); } @@ -1187,14 +1157,14 @@ impl StacksDevnetApiK8sManager { self.deploy_configmap( StacksDevnetConfigmap::BitcoindNode, - &namespace, + namespace, Some(vec![("bitcoin.conf".into(), bitcoind_conf)]), ) .await?; self.deploy_configmap( StacksDevnetConfigmap::ProjectManifest, - &namespace, + namespace, Some(vec![( "Clarinet.toml".into(), config.project_manifest_yaml_string.to_owned(), @@ -1204,7 +1174,7 @@ impl StacksDevnetApiK8sManager { self.deploy_configmap( StacksDevnetConfigmap::Devnet, - &namespace, + namespace, Some(vec![( "Devnet.toml".into(), config.network_manifest_yaml_string.to_owned(), @@ -1214,7 +1184,7 @@ impl StacksDevnetApiK8sManager { self.deploy_configmap( StacksDevnetConfigmap::DeploymentPlan, - &namespace, + namespace, Some(vec![( "default.devnet-plan.yaml".into(), config.deployment_plan_yaml_string.to_owned(), @@ -1224,15 +1194,15 @@ impl StacksDevnetApiK8sManager { self.deploy_configmap( StacksDevnetConfigmap::ProjectDir, - &namespace, + namespace, Some(config.contract_configmap_data.to_owned()), ) .await?; - self.deploy_deployment(StacksDevnetDeployment::BitcoindNode, &namespace, &user_id) + self.deploy_deployment(StacksDevnetDeployment::BitcoindNode, namespace, user_id) .await?; - self.deploy_service(StacksDevnetService::BitcoindNode, namespace, &user_id) + self.deploy_service(StacksDevnetService::BitcoindNode, namespace, user_id) .await?; Ok(()) @@ -1327,7 +1297,7 @@ impl StacksDevnetApiK8sManager { )); let bitcoind_chain_coordinator_host = - get_service_url(&namespace, StacksDevnetService::BitcoindNode); + get_service_url(namespace, StacksDevnetService::BitcoindNode); stacks_conf.push_str(&format!( r#" @@ -1350,7 +1320,7 @@ impl StacksDevnetApiK8sManager { include_data_events = false events_keys = ["*"] "#, - get_service_url(&namespace, StacksDevnetService::StacksBlockchainApi), + get_service_url(namespace, StacksDevnetService::StacksBlockchainApi), get_service_port(StacksDevnetService::StacksBlockchainApi, ServicePort::Event) .unwrap(), )); @@ -1358,12 +1328,12 @@ impl StacksDevnetApiK8sManager { for signer_idx in SignerIdx::iter() { let (url, port) = match signer_idx { SignerIdx::Signer0 => ( - get_service_url(&namespace, StacksDevnetService::StacksSigner0), + get_service_url(namespace, StacksDevnetService::StacksSigner0), get_service_port(StacksDevnetService::StacksSigner0, ServicePort::Event) .unwrap(), ), SignerIdx::Signer1 => ( - get_service_url(&namespace, StacksDevnetService::StacksSigner1), + get_service_url(namespace, StacksDevnetService::StacksSigner1), get_service_port(StacksDevnetService::StacksSigner1, ServicePort::Event) .unwrap(), ), @@ -1378,9 +1348,7 @@ impl StacksDevnetApiK8sManager { include_data_events = false events_keys = ["stackerdb", "block_proposal", "burn_blocks"] "#, - signer_idx.to_string(), - url, - port, + signer_idx, url, port, )); } @@ -1464,19 +1432,15 @@ impl StacksDevnetApiK8sManager { self.deploy_configmap( StacksDevnetConfigmap::StacksBlockchain, - &namespace, + namespace, Some(vec![("Stacks.toml".into(), stacks_conf)]), ) .await?; - self.deploy_deployment( - StacksDevnetDeployment::StacksBlockchain, - &namespace, - &user_id, - ) - .await?; + self.deploy_deployment(StacksDevnetDeployment::StacksBlockchain, namespace, user_id) + .await?; - self.deploy_service(StacksDevnetService::StacksBlockchain, namespace, &user_id) + self.deploy_service(StacksDevnetService::StacksBlockchain, namespace, user_id) .await?; Ok(()) @@ -1495,13 +1459,13 @@ impl StacksDevnetApiK8sManager { ]); self.deploy_configmap( StacksDevnetConfigmap::StacksBlockchainApiPg, - &namespace, + namespace, Some(stacks_api_pg_env), ) .await?; // configmap env vars for api conatainer - let stacks_node_host = get_service_url(&namespace, StacksDevnetService::StacksBlockchain); + let stacks_node_host = get_service_url(namespace, StacksDevnetService::StacksBlockchain); let rpc_port = get_service_port(StacksDevnetService::StacksBlockchain, ServicePort::RPC).unwrap(); let api_port = @@ -1535,24 +1499,20 @@ impl StacksDevnetApiK8sManager { ]); self.deploy_configmap( StacksDevnetConfigmap::StacksBlockchainApi, - &namespace, + namespace, Some(stacks_api_env), ) .await?; self.deploy_stateful_set( StacksDevnetStatefulSet::StacksBlockchainApi, - &namespace, + namespace, user_id, ) .await?; - self.deploy_service( - StacksDevnetService::StacksBlockchainApi, - &namespace, - &user_id, - ) - .await?; + self.deploy_service(StacksDevnetService::StacksBlockchainApi, namespace, user_id) + .await?; Ok(()) } @@ -1602,27 +1562,27 @@ impl StacksDevnetApiK8sManager { db_path = "/chainstate/stacks-signer-{}.sqlite" "#, signer_key, - get_service_url(&namespace, StacksDevnetService::StacksBlockchain), + get_service_url(namespace, StacksDevnetService::StacksBlockchain), get_service_port(StacksDevnetService::StacksBlockchain, ServicePort::RPC).unwrap(), signer_port, - signer_idx.to_string() + signer_idx ); self.deploy_configmap( configmap, - &namespace, + namespace, Some(vec![("Signer.toml".into(), signer_conf)]), ) .await?; - self.deploy_stateful_set(sts, &namespace, user_id).await?; + self.deploy_stateful_set(sts, namespace, user_id).await?; - self.deploy_service(service, &namespace, &user_id).await?; + self.deploy_service(service, namespace, user_id).await?; Ok(()) } - async fn delete_resource>( + async fn delete_resource( &self, namespace: &str, resource_name: &str, @@ -1632,8 +1592,9 @@ impl StacksDevnetApiK8sManager { K: Clone, K: DeserializeOwned, K: std::fmt::Debug, + K: kube::Resource, { - let api: Api = Api::namespaced(self.client.to_owned(), &namespace); + let api: Api = Api::namespaced(self.client.to_owned(), namespace); let dp = DeleteParams::default(); let resource_details = format!( @@ -1666,7 +1627,7 @@ impl StacksDevnetApiK8sManager { } } - async fn delete_resource_by_label>( + async fn delete_resource_by_label( &self, namespace: &str, resource_name: &str, @@ -1677,8 +1638,9 @@ impl StacksDevnetApiK8sManager { K: Clone, K: DeserializeOwned, K: std::fmt::Debug, + K: kube::Resource, { - let api: Api = Api::namespaced(self.client.to_owned(), &namespace); + let api: Api = Api::namespaced(self.client.to_owned(), namespace); let dp = DeleteParams::default(); let pod_label_selector = format!("{COMPONENT_SELECTOR}={resource_name}"); @@ -1742,13 +1704,13 @@ impl StacksDevnetApiK8sManager { code: api_error.code, }), Err(e) => Err(DevNetError { - message: format!("unable to delete namespace: {}", e.to_string()), + message: format!("unable to delete namespace: {}", e), code: 500, }), } } else { Err(DevNetError { - message: format!("namespace deletion can only occur in debug mode"), + message: "namespace deletion can only occur in debug mode".to_string(), code: 403, }) } @@ -1763,7 +1725,7 @@ impl StacksDevnetApiK8sManager { match serde_yaml::from_str(template_str) { Ok(resource) => Ok(resource), Err(e) => { - let msg = format!("unable to parse template file: {}", e.to_string()); + let msg = format!("unable to parse template file: {}", e); self.ctx.try_log(|logger| slog::error!(logger, "{}", msg)); Err(DevNetError { message: msg, diff --git a/src/main.rs b/src/main.rs index 584575b..633190d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,10 +91,10 @@ async fn handle_request( }); let headers = request.headers().clone(); let responder = Responder::new(http_response_config, headers.clone(), ctx.clone()).unwrap(); - if method == &Method::OPTIONS { + if method == Method::OPTIONS { return responder.ok(); } - if method == &Method::GET && (path == "/" || path == &format!("{API_PATH}status")) { + if method == Method::GET && (path == "/" || path == format!("{API_PATH}status")) { return handle_get_status(responder, ctx).await; } let auth_header = auth_config @@ -124,10 +124,10 @@ async fn handle_request( let request_time = SystemTime::now() .duration_since(UNIX_EPOCH) .expect("Could not get current time in secs") - .as_secs() as u64; + .as_secs(); if path == "/api/v1/networks" { - return match method { - &Method::POST => { + return match *method { + Method::POST => { handle_new_devnet( request, &user_id, @@ -172,17 +172,14 @@ async fn handle_request( // the path only contained the network path and network id, // so it must be a request to DELETE a network or GET network info if path_parts.subroute.is_none() { - return match method { - &Method::DELETE => { - match request_store.lock() { - Ok(mut store) => { - store.remove(&user_id); - } - Err(_) => {} + return match *method { + Method::DELETE => { + if let Ok(mut store) = request_store.lock() { + store.remove(&user_id); } handle_delete_devnet(k8s_manager, &network, &user_id, responder).await } - &Method::GET => { + Method::GET => { handle_get_devnet( k8s_manager, &network, @@ -194,7 +191,7 @@ async fn handle_request( ) .await } - &Method::HEAD => { + Method::HEAD => { handle_check_devnet(k8s_manager, &network, &user_id, responder).await } _ => responder @@ -204,18 +201,15 @@ async fn handle_request( // the above methods with no subroute are initiated from our infra, // but any remaning requests would come from the actual user, so we'll // track this request as the last time a user made a request - match request_store.lock() { - Ok(mut store) => { - store.insert(user_id.to_string(), request_time); - } - Err(_) => {} + if let Ok(mut store) = request_store.lock() { + store.insert(user_id.to_string(), request_time); } let subroute = path_parts.subroute.unwrap(); if subroute == "commands" { return responder.err_not_implemented("commands route in progress".into()); } else { - let remaining_path = path_parts.remainder.unwrap_or(String::new()); + let remaining_path = path_parts.remainder.unwrap_or_default(); return handle_try_proxy_service( &remaining_path, &subroute, diff --git a/src/resources/service.rs b/src/resources/service.rs index 1a1d6a2..9d78d26 100644 --- a/src/resources/service.rs +++ b/src/resources/service.rs @@ -62,7 +62,7 @@ pub fn get_user_facing_port(service: StacksDevnetService) -> Option { } pub fn get_service_url(namespace: &str, service: StacksDevnetService) -> String { - format!("{}.{}.svc.cluster.local", service.to_string(), namespace) + format!("{}.{}.svc.cluster.local", service, namespace) } pub fn get_service_from_path_part(path_part: &str) -> Option { diff --git a/src/resources/stateful_set.rs b/src/resources/stateful_set.rs index 13bdf0a..897de4b 100644 --- a/src/resources/stateful_set.rs +++ b/src/resources/stateful_set.rs @@ -24,11 +24,11 @@ pub enum SignerIdx { Signer1, } -impl SignerIdx { - pub fn to_string(&self) -> String { - match &self { - SignerIdx::Signer0 => String::from("0"), - SignerIdx::Signer1 => String::from("1"), +impl fmt::Display for SignerIdx { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + SignerIdx::Signer0 => write!(f, "0"), + SignerIdx::Signer1 => write!(f, "1"), } } } diff --git a/src/resources/tests.rs b/src/resources/tests.rs index 2ffe755..9d8ef7d 100644 --- a/src/resources/tests.rs +++ b/src/resources/tests.rs @@ -6,45 +6,45 @@ use super::{ }; use test_case::test_case; -#[test_case(StacksDevnetConfigmap::BitcoindNode => is equal_to "bitcoind".to_string(); "for BitcoinNode")] -#[test_case(StacksDevnetConfigmap::StacksBlockchain => is equal_to "stacks-blockchain".to_string(); "for StacksBlockchain")] -#[test_case(StacksDevnetConfigmap::StacksBlockchainApi => is equal_to "stacks-blockchain-api".to_string(); "for StacksBlockchainApi")] -#[test_case(StacksDevnetConfigmap::StacksBlockchainApiPg => is equal_to "stacks-blockchain-api-pg".to_string(); "for StacksBlockchainApiPg")] -#[test_case(StacksDevnetConfigmap::StacksSigner0 => is equal_to "stacks-signer-0".to_string(); "for StacksSigner0")] -#[test_case(StacksDevnetConfigmap::StacksSigner1 => is equal_to "stacks-signer-1".to_string(); "for StacksSigner1")] -#[test_case(StacksDevnetConfigmap::DeploymentPlan => is equal_to "deployment-plan".to_string(); "for DeploymentPlan")] -#[test_case(StacksDevnetConfigmap::Devnet => is equal_to "devnet".to_string(); "for Devnet")] -#[test_case(StacksDevnetConfigmap::ProjectDir => is equal_to "project-dir".to_string(); "for ProjectDir")] -#[test_case(StacksDevnetConfigmap::ProjectManifest => is equal_to "project-manifest".to_string(); "for ProjectManifest")] +#[test_case(StacksDevnetConfigmap::BitcoindNode => is equal_to "bitcoind"; "for BitcoinNode")] +#[test_case(StacksDevnetConfigmap::StacksBlockchain => is equal_to "stacks-blockchain"; "for StacksBlockchain")] +#[test_case(StacksDevnetConfigmap::StacksBlockchainApi => is equal_to "stacks-blockchain-api"; "for StacksBlockchainApi")] +#[test_case(StacksDevnetConfigmap::StacksBlockchainApiPg => is equal_to "stacks-blockchain-api-pg"; "for StacksBlockchainApiPg")] +#[test_case(StacksDevnetConfigmap::StacksSigner0 => is equal_to "stacks-signer-0"; "for StacksSigner0")] +#[test_case(StacksDevnetConfigmap::StacksSigner1 => is equal_to "stacks-signer-1"; "for StacksSigner1")] +#[test_case(StacksDevnetConfigmap::DeploymentPlan => is equal_to "deployment-plan"; "for DeploymentPlan")] +#[test_case(StacksDevnetConfigmap::Devnet => is equal_to "devnet"; "for Devnet")] +#[test_case(StacksDevnetConfigmap::ProjectDir => is equal_to "project-dir"; "for ProjectDir")] +#[test_case(StacksDevnetConfigmap::ProjectManifest => is equal_to "project-manifest"; "for ProjectManifest")] fn it_prints_correct_name_for_configmap(configmap: StacksDevnetConfigmap) -> String { configmap.to_string() } -#[test_case(StacksDevnetPod::BitcoindNode => is equal_to "bitcoind-chain-coordinator".to_string(); "for BitcoindNode")] -#[test_case(StacksDevnetPod::StacksBlockchain => is equal_to "stacks-blockchain".to_string(); "for StacksBlockchain")] -#[test_case(StacksDevnetPod::StacksBlockchainApi => is equal_to "stacks-blockchain-api".to_string(); "for StacksBlockchainApi")] +#[test_case(StacksDevnetPod::BitcoindNode => is equal_to "bitcoind-chain-coordinator"; "for BitcoindNode")] +#[test_case(StacksDevnetPod::StacksBlockchain => is equal_to "stacks-blockchain"; "for StacksBlockchain")] +#[test_case(StacksDevnetPod::StacksBlockchainApi => is equal_to "stacks-blockchain-api"; "for StacksBlockchainApi")] fn it_prints_correct_name_for_pod(pod: StacksDevnetPod) -> String { pod.to_string() } -#[test_case(StacksDevnetDeployment::BitcoindNode => is equal_to "bitcoind-chain-coordinator".to_string(); "for BitcoindNode")] -#[test_case(StacksDevnetDeployment::StacksBlockchain => is equal_to "stacks-blockchain".to_string(); "for StacksBlockchain")] +#[test_case(StacksDevnetDeployment::BitcoindNode => is equal_to "bitcoind-chain-coordinator"; "for BitcoindNode")] +#[test_case(StacksDevnetDeployment::StacksBlockchain => is equal_to "stacks-blockchain"; "for StacksBlockchain")] fn it_prints_correct_name_for_deployment(deployment: StacksDevnetDeployment) -> String { deployment.to_string() } -#[test_case(StacksDevnetStatefulSet::StacksBlockchainApi => is equal_to "stacks-blockchain-api".to_string(); "for StacksBlockchainApi")] -#[test_case(StacksDevnetStatefulSet::StacksSigner0 => is equal_to "stacks-signer-0".to_string(); "for StacksSigner0")] -#[test_case(StacksDevnetStatefulSet::StacksSigner1 => is equal_to "stacks-signer-1".to_string(); "for StacksSigner1")] +#[test_case(StacksDevnetStatefulSet::StacksBlockchainApi => is equal_to "stacks-blockchain-api"; "for StacksBlockchainApi")] +#[test_case(StacksDevnetStatefulSet::StacksSigner0 => is equal_to "stacks-signer-0"; "for StacksSigner0")] +#[test_case(StacksDevnetStatefulSet::StacksSigner1 => is equal_to "stacks-signer-1"; "for StacksSigner1")] fn it_prints_correct_name_for_stateful_set(pod: StacksDevnetStatefulSet) -> String { pod.to_string() } -#[test_case(StacksDevnetService::BitcoindNode => is equal_to "bitcoind-chain-coordinator".to_string(); "for BitcoindNode")] -#[test_case(StacksDevnetService::StacksBlockchain => is equal_to "stacks-blockchain".to_string(); "for StacksBlockchain")] -#[test_case(StacksDevnetService::StacksBlockchainApi => is equal_to "stacks-blockchain-api".to_string(); "for StacksBlockchainApi")] -#[test_case(StacksDevnetService::StacksSigner0 => is equal_to "stacks-signer-0".to_string(); "for StacksSigner0")] -#[test_case(StacksDevnetService::StacksSigner1 => is equal_to "stacks-signer-1".to_string(); "for StacksSigner1")] +#[test_case(StacksDevnetService::BitcoindNode => is equal_to "bitcoind-chain-coordinator"; "for BitcoindNode")] +#[test_case(StacksDevnetService::StacksBlockchain => is equal_to "stacks-blockchain"; "for StacksBlockchain")] +#[test_case(StacksDevnetService::StacksBlockchainApi => is equal_to "stacks-blockchain-api"; "for StacksBlockchainApi")] +#[test_case(StacksDevnetService::StacksSigner0 => is equal_to "stacks-signer-0"; "for StacksSigner0")] +#[test_case(StacksDevnetService::StacksSigner1 => is equal_to "stacks-signer-1"; "for StacksSigner1")] fn it_prints_correct_name_for_service(service: StacksDevnetService) -> String { service.to_string() } diff --git a/src/responder.rs b/src/responder.rs index 5eb1957..4bf50c1 100644 --- a/src/responder.rs +++ b/src/responder.rs @@ -66,7 +66,7 @@ impl Responder { break; } } - return builder; + builder } None => builder, } @@ -74,19 +74,7 @@ impl Responder { fn _respond(&self, code: StatusCode, body: String) -> Result, Infallible> { let builder = self.response_builder(); - let body = match Body::try_from(body) { - Ok(b) => b, - Err(e) => { - self.ctx.try_log(|logger| { - slog::error!( - logger, - "responder failed to create response body: {}", - e.to_string() - ) - }); - Body::empty() - } - }; + let body = Body::from(body); match builder.status(code).body(body) { Ok(r) => Ok(r), Err(e) => { @@ -125,7 +113,7 @@ impl Responder { .body(body) { Ok(r) => Ok(r), - Err(e) => self.err_internal(format!("failed to send response: {}", e.to_string())), + Err(e) => self.err_internal(format!("failed to send response: {}", e)), } } diff --git a/src/routes.rs b/src/routes.rs index 1ad6913..c70480a 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -28,7 +28,7 @@ pub async fn handle_get_status( let version_info = match serde_json::to_vec(&version_info) { Ok(v) => v, Err(e) => { - let msg = format!("failed to parse version info: {}", e.to_string()); + let msg = format!("failed to parse version info: {}", e); ctx.try_log(|logger| slog::error!(logger, "{}", msg)); return responder.err_internal(msg); } @@ -58,11 +58,8 @@ pub async fn handle_new_devnet( Ok(config) => match config.to_validated_config(user_id, ctx) { Ok(config) => match k8s_manager.deploy_devnet(config).await { Ok(_) => { - match request_store.lock() { - Ok(mut store) => { - store.insert(user_id.to_string(), request_time); - } - Err(_) => {} + if let Ok(mut store) = request_store.lock() { + store.insert(user_id.to_string(), request_time); } responder.ok() } @@ -112,7 +109,7 @@ pub async fn handle_get_devnet( request_time: u64, ctx: Context, ) -> Result, Infallible> { - match k8s_manager.get_devnet_info(&network, user_id).await { + match k8s_manager.get_devnet_info(network, user_id).await { Ok(devnet_info) => { let last_request_time = match request_store.lock() { Ok(mut store) => match store.get(user_id) { @@ -135,8 +132,7 @@ pub async fn handle_get_devnet( Err(e) => { let msg = format!( "failed to form response body: NAMESPACE: {}, ERROR: {}", - &network, - e.to_string() + &network, e ); ctx.try_log(|logger: &hiro_system_kit::Logger| slog::error!(logger, "{}", msg)); responder.err_internal(msg) @@ -174,18 +170,18 @@ pub async fn handle_try_proxy_service( responder: Responder, ctx: &Context, ) -> Result, Infallible> { - match k8s_manager.check_all_devnet_assets_exist(&network).await { + match k8s_manager.check_all_devnet_assets_exist(network).await { Ok(exists) => match exists { true => { let service = get_service_from_path_part(subroute); match service { Some(service) => { - let base_url = get_service_url(&network, service.clone()); + let base_url = get_service_url(network, service.clone()); let port = get_user_facing_port(service).unwrap(); let forward_url = format!("{}:{}", base_url, port); let proxy_request = - mutate_request_for_proxy(request, &forward_url, &remaining_path); - proxy(proxy_request, responder, &ctx).await + mutate_request_for_proxy(request, &forward_url, remaining_path); + proxy(proxy_request, responder, ctx).await } None => responder.err_bad_request("invalid request path".into()), } @@ -229,7 +225,7 @@ async fn proxy( match client.request(request).await { Ok(response) => Ok(response), Err(e) => { - let msg = format!("error proxying request: {}", e.to_string()); + let msg = format!("error proxying request: {}", e); ctx.try_log(|logger| slog::error!(logger, "{}", msg)); responder.err_internal(msg) } diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 87e7eba..7d6c2ea 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -48,7 +48,7 @@ fn get_template_config() -> StacksDevnetConfig { match serde_json::from_slice::(&file_buffer) { Ok(s) => s, Err(e) => { - panic!("Config file malformatted {}", e.to_string()); + panic!("Config file malformatted {}", e); } }; config_file @@ -138,21 +138,21 @@ async fn it_responds_to_valid_requests_with_deploy( let new_path: String; if request_path.contains("{namespace}") { - new_path = request_path.replace("{namespace}", &namespace); + new_path = request_path.replace("{namespace}", namespace); request_path = &new_path; } let (k8s_manager, ctx) = get_k8s_manager().await; - let request_builder = get_request_builder(request_path, method, &namespace); + let request_builder = get_request_builder(request_path, method, namespace); - let _ = k8s_manager.deploy_namespace(&namespace).await.unwrap(); + k8s_manager.deploy_namespace(namespace).await.unwrap(); let mut config = get_template_config(); config.namespace = namespace.to_owned(); - let validated_config = config.to_validated_config(&namespace, &ctx).unwrap(); + let validated_config = config.to_validated_config(namespace, &ctx).unwrap(); let user_id = &namespace; - let _ = k8s_manager.deploy_devnet(validated_config).await.unwrap(); + k8s_manager.deploy_devnet(validated_config).await.unwrap(); // short delay to allow assets to start sleep(Duration::new(5, 0)); @@ -191,7 +191,7 @@ async fn it_responds_to_valid_requests_with_deploy( } } } - let _ = k8s_manager.delete_namespace(&namespace).await.unwrap(); + k8s_manager.delete_namespace(namespace).await.unwrap(); (status, body_str) } @@ -213,16 +213,16 @@ async fn it_responds_to_valid_requests( let new_path: String; if request_path.contains("{namespace}") { - new_path = request_path.replace("{namespace}", &namespace); + new_path = request_path.replace("{namespace}", namespace); request_path = &new_path; } let (k8s_manager, ctx) = get_k8s_manager().await; - let request_builder = get_request_builder(request_path, method, &namespace); + let request_builder = get_request_builder(request_path, method, namespace); if set_up { - let _ = k8s_manager.deploy_namespace(&namespace).await.unwrap(); + k8s_manager.deploy_namespace(namespace).await.unwrap(); } let request: Request = request_builder.body(Body::empty()).unwrap(); @@ -242,7 +242,7 @@ async fn it_responds_to_valid_requests( let body_str = String::from_utf8(bytes).unwrap(); if set_up { - let _ = k8s_manager.delete_namespace(&namespace).await.unwrap(); + k8s_manager.delete_namespace(namespace).await.unwrap(); } (response.status(), body_str) @@ -258,7 +258,7 @@ async fn deploy_devnet( config.namespace = namespace.to_owned(); let body = Body::from(serde_json::to_string(&config).unwrap()); - let request: Request = get_request_builder("/api/v1/networks", Method::POST, &namespace) + let request: Request = get_request_builder("/api/v1/networks", Method::POST, namespace) .body(body) .unwrap(); let _ = handle_request( @@ -281,7 +281,7 @@ async fn get_devnet_info( let request: Request = get_request_builder( &format!("/api/v1/network/{namespace}"), Method::GET, - &namespace, + namespace, ) .body(Body::empty()) .unwrap(); @@ -309,7 +309,7 @@ async fn delete_devnet( let request: Request = get_request_builder( &format!("/api/v1/network/{namespace}"), Method::DELETE, - &namespace, + namespace, ) .body(Body::empty()) .unwrap(); @@ -331,25 +331,19 @@ async fn it_tracks_requests_time_for_user() { let namespace2 = &get_random_namespace(); let (k8s_manager, ctx) = get_k8s_manager().await; - let _ = k8s_manager.deploy_namespace(&namespace).await.unwrap(); - let _ = k8s_manager.deploy_namespace(&namespace2).await.unwrap(); + k8s_manager.deploy_namespace(namespace).await.unwrap(); + k8s_manager.deploy_namespace(namespace2).await.unwrap(); let request_store = Arc::new(Mutex::new(HashMap::new())); // create one devnet and assert request time is stored let created_time = { - deploy_devnet(&namespace, k8s_manager.clone(), request_store.clone(), &ctx).await; + deploy_devnet(namespace, k8s_manager.clone(), request_store.clone(), &ctx).await; let store = request_store.lock().unwrap(); - store.get(namespace).unwrap().clone() + *store.get(namespace).unwrap() }; // create another devnet and assert request time is stored { - deploy_devnet( - &namespace2, - k8s_manager.clone(), - request_store.clone(), - &ctx, - ) - .await; + deploy_devnet(namespace2, k8s_manager.clone(), request_store.clone(), &ctx).await; // after creating a devnet, there should be an entry assert!(request_store.lock().unwrap().get(namespace).is_some()); } @@ -358,7 +352,7 @@ async fn it_tracks_requests_time_for_user() { let secs_after_first_get1 = { let info = - get_devnet_info(&namespace, k8s_manager.clone(), request_store.clone(), &ctx).await; + get_devnet_info(namespace, k8s_manager.clone(), request_store.clone(), &ctx).await; // time should have elapsed since our last request let secs_after_first_get = info.metadata.secs_since_last_request; assert!(secs_after_first_get > 0); @@ -372,13 +366,8 @@ async fn it_tracks_requests_time_for_user() { // confirm time has elapsed since our last request let secs_after_first_get2 = { - let info = get_devnet_info( - &namespace2, - k8s_manager.clone(), - request_store.clone(), - &ctx, - ) - .await; + let info = + get_devnet_info(namespace2, k8s_manager.clone(), request_store.clone(), &ctx).await; let secs_after_first_get = info.metadata.secs_since_last_request; assert!(secs_after_first_get > 0); secs_after_first_get @@ -389,7 +378,7 @@ async fn it_tracks_requests_time_for_user() { let request: Request = get_request_builder( &format!("/api/v1/network/{namespace}/some-path"), Method::GET, - &namespace, + namespace, ) .body(Body::empty()) .unwrap(); @@ -407,19 +396,14 @@ async fn it_tracks_requests_time_for_user() { // immediately make another get request to confirm that the time since last request was updated { let info = - get_devnet_info(&namespace, k8s_manager.clone(), request_store.clone(), &ctx).await; + get_devnet_info(namespace, k8s_manager.clone(), request_store.clone(), &ctx).await; assert!(secs_after_first_get1 > info.metadata.secs_since_last_request); } // and verify that the time since the last request wasn't updated for our other namespace { - let info = get_devnet_info( - &namespace2, - k8s_manager.clone(), - request_store.clone(), - &ctx, - ) - .await; + let info = + get_devnet_info(namespace2, k8s_manager.clone(), request_store.clone(), &ctx).await; assert!(info.metadata.secs_since_last_request >= secs_after_first_get2); } @@ -428,7 +412,7 @@ async fn it_tracks_requests_time_for_user() { assert_eq!(request_store.lock().unwrap().keys().len(), 0); // confirm that our infrastructure pinging will insert request times if none exist { - let _ = get_devnet_info(&namespace, k8s_manager.clone(), request_store.clone(), &ctx).await; + let _ = get_devnet_info(namespace, k8s_manager.clone(), request_store.clone(), &ctx).await; assert_eq!(request_store.lock().unwrap().keys().len(), 1); } @@ -440,8 +424,8 @@ async fn it_tracks_requests_time_for_user() { // clean up delete_devnet(namespace2, k8s_manager.clone(), request_store.clone(), &ctx).await; - let _ = k8s_manager.delete_namespace(&namespace).await.unwrap(); - let _ = k8s_manager.delete_namespace(&namespace2).await.unwrap(); + k8s_manager.delete_namespace(namespace).await.unwrap(); + k8s_manager.delete_namespace(namespace2).await.unwrap(); } async fn mock_k8s_handler(handle: &mut Handle, Response>) { @@ -495,23 +479,23 @@ async fn get_mock_k8s_manager() -> (StacksDevnetApiK8sManager, Context) { #[test_case("/api", Method::GET, "some-user" => is equal_to (StatusCode::BAD_REQUEST, "invalid request path".to_string()) ; "400 for invalid requet path /api")] #[test_case("/api/v1", Method::GET, "some-user" => is equal_to (StatusCode::BAD_REQUEST, "invalid request path".to_string()) ; "400 for invalid requet path /api/v1")] #[test_case("/api/v1/network2", Method::GET, "some-user" => is equal_to (StatusCode::BAD_REQUEST, "invalid request path".to_string()) ; "400 for invalid requet path /api/v1/network2")] -#[test_case("/api/v1/network/undeployed", Method::GET, "undeployed" => +#[test_case("/api/v1/network/undeployed", Method::GET, "undeployed" => is equal_to (StatusCode::NOT_FOUND, "network undeployed does not exist".to_string()); "404 for undeployed namespace")] -#[test_case("/api/v1/network/500_err", Method::GET, "500_err" => +#[test_case("/api/v1/network/500_err", Method::GET, "500_err" => is equal_to (StatusCode::INTERNAL_SERVER_ERROR, "error getting namespace 500_err: \"\"".to_string()); "forwarded error if fetching namespace returns error")] -#[test_case("/api/v1/network/test", Method::POST, "test" => +#[test_case("/api/v1/network/test", Method::POST, "test" => is equal_to (StatusCode::METHOD_NOT_ALLOWED, "can only GET/DELETE/HEAD at provided route".to_string()); "405 for network route with POST request")] -#[test_case("/api/v1/network/test/commands", Method::GET, "test" => +#[test_case("/api/v1/network/test/commands", Method::GET, "test" => is equal_to (StatusCode::NOT_FOUND, "commands route in progress".to_string()); "404 for network commands route")] -#[test_case("/api/v1/network/", Method::GET, "test" => +#[test_case("/api/v1/network/", Method::GET, "test" => is equal_to (StatusCode::BAD_REQUEST, "no network id provided".to_string()); "400 for missing namespace")] -#[test_case("/api/v1/networks", Method::GET, "test" => +#[test_case("/api/v1/networks", Method::GET, "test" => is equal_to (StatusCode::METHOD_NOT_ALLOWED, "network creation must be a POST request".to_string()); "405 for network creation request with GET method")] -#[test_case("/api/v1/networks", Method::DELETE, "test" => +#[test_case("/api/v1/networks", Method::DELETE, "test" => is equal_to (StatusCode::METHOD_NOT_ALLOWED, "network creation must be a POST request".to_string()); "405 for network creation request with DELETE method")] -#[test_case("/api/v1/networks", Method::POST, "test" => +#[test_case("/api/v1/networks", Method::POST, "test" => is equal_to (StatusCode::BAD_REQUEST, "invalid configuration to create network: EOF while parsing a value at line 1 column 0".to_string()); "400 for network creation request invalid config")] -#[test_case("/api/v1/network/test", Method::GET, "wrong-id" => +#[test_case("/api/v1/network/test", Method::GET, "wrong-id" => is equal_to (StatusCode::BAD_REQUEST, "network id must match authenticated user id".to_string()); "400 for request with non-matching user")] #[tokio::test] async fn it_responds_to_invalid_requests( @@ -521,7 +505,7 @@ async fn it_responds_to_invalid_requests( ) -> (StatusCode, String) { let (k8s_manager, ctx) = get_mock_k8s_manager().await; - let request_builder = get_request_builder(request_path, method, &user_id); + let request_builder = get_request_builder(request_path, method, user_id); let request: Request = request_builder.body(Body::empty()).unwrap(); let request_store = Arc::new(Mutex::new(HashMap::new())); let mut response = handle_request( @@ -564,7 +548,7 @@ async fn it_responds_to_invalid_request_header() { assert_eq!(body_str, "missing required auth header".to_string()); } -#[test_case("/api/v1/network/test", Method::OPTIONS => is equal_to "Ok".to_string())] +#[test_case("/api/v1/network/test", Method::OPTIONS => is equal_to *"Ok")] #[test_case("/api/v1/status", Method::GET => is equal_to get_version_info() )] #[test_case("/", Method::GET => is equal_to get_version_info())] #[tokio::test] @@ -586,8 +570,7 @@ async fn it_ignores_request_header_for_some_requests(request_path: &str, method: assert_eq!(response.status(), 200); let body = response.body_mut(); let bytes = body::to_bytes(body).await.unwrap().to_vec(); - let body_str = String::from_utf8(bytes).unwrap(); - body_str + String::from_utf8(bytes).unwrap() } #[test_case("" => is equal_to PathParts { route: String::new(), ..Default::default() }; "for empty path")] @@ -598,9 +581,9 @@ async fn it_ignores_request_header_for_some_requests(request_path: &str, method: #[test_case("/api/v1/some-route/some-network/" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), ..Default::default() }; "for /api/v1/some-route/some-network/ path trailing slash")] #[test_case("/api/v1/some-route/some-network/some-subroute" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), subroute: Some(String::from("some-subroute")), ..Default::default() }; "for /api/v1/some-route/some-network/some-subroute path")] #[test_case("/api/v1/some-route/some-network/some-subroute/" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), subroute: Some(String::from("some-subroute")), ..Default::default() }; "for /api/v1/some-route/some-network/some-subroute/ path trailing slash")] -#[test_case("/api/v1/some-route/some-network/some-subroute/the/remaining/path" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), subroute: Some(String::from("some-subroute")), remainder: Some(String::from("the/remaining/path")), ..Default::default() }; "for /api/v1/some-route/some-network/some-subroute/the/remaining/path path ")] -#[test_case("/api/v1/some-route/some-network/some-subroute/the/remaining/path/" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), subroute: Some(String::from("some-subroute")), remainder: Some(String::from("the/remaining/path")), ..Default::default() }; "for /api/v1/some-route/some-network/some-subroute/the/remaining/path/ path trailing slash")] -#[test_case("/api/v1/some-route/some-network/some-subroute/the//remaining//path/" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), subroute: Some(String::from("some-subroute")), remainder: Some(String::from("the//remaining//path")), ..Default::default() }; "for /api/v1/some-route/some-network/some-subroute/the//remaining//path/ path extra internal slash")] +#[test_case("/api/v1/some-route/some-network/some-subroute/the/remaining/path" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), subroute: Some(String::from("some-subroute")), remainder: Some(String::from("the/remaining/path")) }; "for /api/v1/some-route/some-network/some-subroute/the/remaining/path path ")] +#[test_case("/api/v1/some-route/some-network/some-subroute/the/remaining/path/" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), subroute: Some(String::from("some-subroute")), remainder: Some(String::from("the/remaining/path")) }; "for /api/v1/some-route/some-network/some-subroute/the/remaining/path/ path trailing slash")] +#[test_case("/api/v1/some-route/some-network/some-subroute/the//remaining//path/" => is equal_to PathParts { route: String::from("some-route"), network: Some(String::from("some-network")), subroute: Some(String::from("some-subroute")), remainder: Some(String::from("the//remaining//path")) }; "for /api/v1/some-route/some-network/some-subroute/the//remaining//path/ path extra internal slash")] fn request_paths_are_parsed_correctly(path: &str) -> PathParts { get_standardized_path_parts(path) } @@ -661,7 +644,7 @@ async fn namespace_prefix_config_prepends_header() { // using the ApiConfig's `namespace_prefix` field will add the prefix // before the `user_id` as the authenticated user, which should match the request path let namespace = &get_random_namespace(); - let _ = k8s_manager.deploy_namespace(&namespace).await.unwrap(); + k8s_manager.deploy_namespace(namespace).await.unwrap(); let (namespace_prefix, user_id) = namespace.split_at(4); let api_config = ApiConfig {