From b24ddc6158537dc663dbd269c41dbccd3635f145 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Tue, 17 Sep 2024 16:31:39 -0400 Subject: [PATCH] chore: upgrade to build with rust 1.80 (#631) - bump time crate, seeing build failure in https://github.com/Homebrew/homebrew-core/actions/runs/10126855440/job/28023138251 relates to https://github.com/time-rs/time/issues/693 - also update toolchain and run the cargo fmt/clippy fixes --------- Signed-off-by: Rui Chen --- Cargo.lock | 1033 +++++++++-------- components/chainhook-cli/src/archive/mod.rs | 16 +- .../chainhook-cli/src/archive/tests/mod.rs | 4 +- components/chainhook-cli/src/cli/mod.rs | 15 +- .../chainhook-cli/src/config/generator.rs | 2 +- components/chainhook-cli/src/config/mod.rs | 22 +- .../chainhook-cli/src/config/tests/mod.rs | 14 +- components/chainhook-cli/src/scan/bitcoin.rs | 29 +- components/chainhook-cli/src/scan/stacks.rs | 61 +- .../chainhook-cli/src/service/http_api.rs | 55 +- components/chainhook-cli/src/service/mod.rs | 194 ++-- .../chainhook-cli/src/service/runloops.rs | 11 +- .../service/tests/helpers/mock_bitcoin_rpc.rs | 14 +- .../src/service/tests/helpers/mock_service.rs | 41 +- .../service/tests/helpers/mock_stacks_node.rs | 118 +- .../src/service/tests/helpers/mod.rs | 4 +- .../chainhook-cli/src/service/tests/mod.rs | 10 +- .../src/service/tests/observer_tests.rs | 12 +- .../src/service/tests/runloop_tests.rs | 2 +- components/chainhook-cli/src/storage/mod.rs | 38 +- .../src/chainhooks/bitcoin/mod.rs | 50 +- .../bitcoin/tests/hook_spec_validation.rs | 24 +- .../src/chainhooks/stacks/mod.rs | 149 ++- .../stacks/tests/hook_spec_validation.rs | 12 +- .../chainhook-sdk/src/chainhooks/tests/mod.rs | 20 +- .../chainhook-sdk/src/chainhooks/types.rs | 26 +- .../chainhook-sdk/src/indexer/bitcoin/mod.rs | 27 +- .../src/indexer/fork_scratch_pad.rs | 12 +- components/chainhook-sdk/src/indexer/mod.rs | 34 +- .../src/indexer/stacks/blocks_pool.rs | 88 +- .../chainhook-sdk/src/indexer/stacks/mod.rs | 181 ++- .../chainhook-sdk/src/indexer/stacks/tests.rs | 98 +- .../src/indexer/tests/helpers/accounts.rs | 40 +- .../indexer/tests/helpers/bitcoin_shapes.rs | 5 +- .../indexer/tests/helpers/stacks_blocks.rs | 4 +- .../indexer/tests/helpers/stacks_events.rs | 32 +- .../indexer/tests/helpers/stacks_shapes.rs | 11 +- .../src/indexer/tests/helpers/transactions.rs | 8 +- .../chainhook-sdk/src/indexer/tests/mod.rs | 4 +- components/chainhook-sdk/src/monitoring.rs | 10 +- components/chainhook-sdk/src/observer/http.rs | 38 +- components/chainhook-sdk/src/observer/mod.rs | 72 +- .../chainhook-sdk/src/observer/tests/mod.rs | 20 +- components/chainhook-sdk/src/observer/zmq.rs | 4 +- components/chainhook-sdk/src/utils/mod.rs | 20 +- rust-toolchain | 2 +- 46 files changed, 1311 insertions(+), 1375 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a44d43c80..1664f07c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -66,18 +66,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "android-tzdata" @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "array-init" @@ -143,18 +143,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] name = "async-trait" -version = "0.1.75" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -185,15 +185,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -218,9 +218,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" @@ -261,23 +261,23 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "shlex", "syn 1.0.109", ] [[package]] name = "bitcoin" -version = "0.31.0" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5973a027b341b462105675962214dfe3c938ad9afd395d84b28602608bdcec7b" +checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" dependencies = [ "bech32", "bitcoin-internals", "bitcoin_hashes", "hex-conservative", "hex_lit", - "secp256k1 0.28.0", + "secp256k1 0.28.2", "serde", ] @@ -333,9 +333,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -375,9 +375,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byte-slice-cast" @@ -387,9 +387,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83" [[package]] name = "byteorder" @@ -399,9 +399,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "bzip2-sys" @@ -422,9 +422,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.90" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292" dependencies = [ "jobserver", "libc", @@ -441,9 +441,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.5" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" dependencies = [ "smallvec 1.13.2", "target-lexicon", @@ -455,6 +455,12 @@ 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" version = "1.7.0" @@ -498,7 +504,7 @@ name = "chainhook-sdk" version = "0.12.11" dependencies = [ "base58", - "base64 0.21.5", + "base64 0.21.7", "bitcoincore-rpc", "bitcoincore-rpc-json", "chainhook-types", @@ -543,16 +549,16 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -567,9 +573,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -601,7 +607,7 @@ dependencies = [ "once_cell", "strsim", "termcolor", - "textwrap 0.16.0", + "textwrap 0.16.1", ] [[package]] @@ -648,9 +654,9 @@ dependencies = [ [[package]] name = "clarity" version = "2.3.0" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#6eb4a2377cb8d18275280530abb6044dee9081ee" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#5f9c466ad8d60e99fd3fc77e9291472e7bb01eef" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", "integer-sqrt", "lazy_static", "rand", @@ -668,9 +674,9 @@ dependencies = [ [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "memchr", @@ -695,24 +701,24 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -755,11 +761,10 @@ dependencies = [ [[package]] name = "crossbeam" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb9105919ca8e40d437fc9cbb8f1975d916f1bd28afe795a48aae32a2cc8920" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" dependencies = [ - "cfg-if", "crossbeam-channel", "crossbeam-deque", "crossbeam-epoch", @@ -769,54 +774,46 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.10" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.17" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-queue" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc6598521bb5a83d491e8c1fe51db7296019d2ca3cb93cc6c2a20369a4d78a2" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crunchy" @@ -867,11 +864,11 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.4.2" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b467862cc8610ca6fc9a1532d7777cee0804e678ab45410897b9396495994a0b" +checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345" dependencies = [ - "nix 0.27.1", + "nix 0.28.0", "windows-sys 0.52.0", ] @@ -891,16 +888,15 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", - "platforms", "rustc_version", "subtle", "zeroize", @@ -914,7 +910,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -959,7 +955,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -967,9 +963,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -977,9 +973,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -1010,11 +1006,11 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -1038,9 +1034,9 @@ dependencies = [ [[package]] name = "dircpy" -version = "0.3.15" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8466f8d28ca6da4c9dfbbef6ad4bff6f2fdd5e412d821025b0d3f0a9d74a8c1e" +checksum = "a88521b0517f5f9d51d11925d8ab4523497dcf947073fa3231a311b63941131c" dependencies = [ "jwalk", "log", @@ -1070,9 +1066,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ed25519" @@ -1091,7 +1087,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.3", "ed25519", "rand_core 0.6.4", "serde", @@ -1102,15 +1098,15 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -1123,9 +1119,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1145,40 +1141,40 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fiat-crypto" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "figment" -version = "0.10.12" +version = "0.10.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649f3e5d826594057e9a519626304d8da859ea8a0b18ce99500c586b8d45faee" +checksum = "8cb01cd46b0cf372153850f4c6c272d9cbea2da513e07538405148f95bd789f3" dependencies = [ "atomic 0.6.0", "pear", "serde", - "toml 0.8.8", + "toml 0.8.19", "uncased", "version_check", ] [[package]] name = "filetime" -version = "0.2.23" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" dependencies = [ "cfg-if", "libc", - "redox_syscall", - "windows-sys 0.52.0", + "libredox", + "windows-sys 0.59.0", ] [[package]] @@ -1195,9 +1191,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" dependencies = [ "crc32fast", "miniz_oxide", @@ -1293,7 +1289,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -1380,9 +1376,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -1403,9 +1399,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "glob" @@ -1415,17 +1411,17 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.22" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.11", - "indexmap 2.1.0", + "http 0.2.12", + "indexmap 2.3.0", "slab", "tokio", "tokio-util", @@ -1434,9 +1430,9 @@ dependencies = [ [[package]] name = "half" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" [[package]] name = "hashbrown" @@ -1446,9 +1442,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -1461,7 +1457,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -1479,6 +1475,12 @@ 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" @@ -1490,9 +1492,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1502,9 +1504,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-conservative" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" [[package]] name = "hex_lit" @@ -1542,9 +1544,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -1569,7 +1571,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http 0.2.11", + "http 0.2.12", "pin-project-lite", ] @@ -1598,9 +1600,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -1619,7 +1621,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http 0.2.11", + "http 0.2.12", "http-body 0.4.6", "httparse", "httpdate", @@ -1671,9 +1673,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" dependencies = [ "bytes", "futures-channel", @@ -1682,7 +1684,7 @@ dependencies = [ "http-body 1.0.1", "hyper 1.4.1", "pin-project-lite", - "socket2 0.5.6", + "socket2 0.5.7", "tokio", "tower", "tower-service", @@ -1691,9 +1693,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1761,12 +1763,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] @@ -1802,13 +1804,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.3", - "rustix", - "windows-sys 0.48.0", + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.52.0", ] [[package]] @@ -1822,24 +1824,24 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -1867,18 +1869,18 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lazycell" @@ -1888,27 +1890,27 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "winapi", + "windows-targets 0.52.6", ] [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "libc", "redox_syscall", ] @@ -1941,9 +1943,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" dependencies = [ "cc", "pkg-config", @@ -1952,15 +1954,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1968,9 +1970,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "loom" @@ -1989,9 +1991,9 @@ dependencies = [ [[package]] name = "lz4-sys" -version = "1.9.4" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" +checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" dependencies = [ "cc", "libc", @@ -2014,9 +2016,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -2041,9 +2043,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniscript" -version = "11.0.0" +version = "11.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86a23dd3ad145a980e231185d114399f25a0a307d2cd918010ddda6334323df9" +checksum = "3127e10529a57a8f7fa9b1332c4c2f72baadaca6777798f910dff3c922620b14" dependencies = [ "bech32", "bitcoin", @@ -2052,22 +2054,23 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2079,7 +2082,7 @@ dependencies = [ "bytes", "encoding_rs", "futures-util", - "http 0.2.11", + "http 0.2.12", "httparse", "log", "memchr", @@ -2096,7 +2099,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.15", ] [[package]] @@ -2114,12 +2117,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "cfg-if", + "cfg_aliases", "libc", ] @@ -2157,9 +2161,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -2170,24 +2174,15 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", - "libc", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ + "hermit-abi 0.3.9", "libc", ] [[package]] name = "object" -version = "0.32.2" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] @@ -2211,15 +2206,15 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" -version = "11.1.3" +version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "os_str_bytes" @@ -2252,14 +2247,14 @@ dependencies = [ "rustfmt-wrapper", "serde", "sha2", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] name = "parity-scale-codec" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" dependencies = [ "arrayvec", "bitvec", @@ -2271,9 +2266,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2283,9 +2278,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -2293,22 +2288,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec 1.13.2", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] name = "pear" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ccca0f6c17acc81df8e242ed473ec144cbf5c98037e69aa6d144780aad103c8" +checksum = "bdeeaa00ce488657faba8ebf44ab9361f9365a97bd39ffb8a60663f57ff4b467" dependencies = [ "inlinable_string", "pear_codegen", @@ -2317,14 +2312,14 @@ dependencies = [ [[package]] name = "pear_codegen" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e22670e8eb757cff11d6c199ca7b987f352f0346e0be4dd23869ec72cb53c77" +checksum = "4bab5b985dc082b345f812b7df84e1bef27e7207b39e448439ba8bd69c93f147" dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -2341,29 +2336,29 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -2383,21 +2378,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" - -[[package]] -name = "platforms" -version = "3.4.0" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plotters" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" dependencies = [ "num-traits", "plotters-backend", @@ -2408,15 +2397,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" [[package]] name = "plotters-svg" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" dependencies = [ "plotters-backend", ] @@ -2451,9 +2440,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "primitive-types" @@ -2468,11 +2460,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.20.7", + "toml_edit 0.21.1", ] [[package]] @@ -2501,9 +2493,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.71" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -2516,16 +2508,16 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", "version_check", "yansi", ] [[package]] name = "prometheus" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" +checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" dependencies = [ "cfg-if", "fnv", @@ -2553,16 +2545,17 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +checksum = "b22d8e7369034b9a7132bc2008cac12f2013c8132b45e0554e6e20e2617f2156" dependencies = [ "bytes", "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash", + "rustc-hash 2.0.0", "rustls", + "socket2 0.5.7", "thiserror", "tokio", "tracing", @@ -2570,14 +2563,14 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.3" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +checksum = "ba92fb39ec7ad06ca2582c0ca834dfeadcaf06ddfc8e635c80aa7e1c05315fdd" dependencies = [ "bytes", "rand", "ring", - "rustc-hash", + "rustc-hash 2.0.0", "rustls", "slab", "thiserror", @@ -2587,22 +2580,22 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" +checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285" dependencies = [ "libc", "once_cell", - "socket2 0.5.6", + "socket2 0.5.7", "tracing", "windows-sys 0.52.0", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -2649,14 +2642,14 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.15", ] [[package]] name = "rayon" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -2664,9 +2657,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -2689,54 +2682,54 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", ] [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.15", "libredox", "thiserror", ] [[package]] name = "ref-cast" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53313ec9f12686aeeffb43462c3ac77aa25f590a5f630eb2cde0de59417b29c7" +checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2566c4bf6845f2c2e83b27043c3f5dfcd5ba8f2937d6c00dc009bfb51a079dc4" +checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -2750,13 +2743,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.4", ] [[package]] @@ -2767,9 +2760,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" @@ -2818,16 +2811,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", - "getrandom 0.2.11", + "cfg-if", + "getrandom 0.2.15", "libc", "spin", "untrusted", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2853,7 +2847,7 @@ dependencies = [ "either", "figment", "futures", - "indexmap 2.1.0", + "indexmap 2.3.0", "log", "memchr", "multer", @@ -2885,11 +2879,11 @@ checksum = "a2238066abf75f21be6cd7dc1a09d5414a671f4246e384e49fe3f8a4936bd04c" dependencies = [ "devise", "glob", - "indexmap 2.1.0", + "indexmap 2.3.0", "proc-macro2", "quote", "rocket_http", - "syn 2.0.43", + "syn 2.0.74", "unicode-xid", "version_check", ] @@ -2903,9 +2897,9 @@ dependencies = [ "cookie", "either", "futures", - "http 0.2.11", + "http 0.2.12", "hyper 0.14.27", - "indexmap 2.1.0", + "indexmap 2.3.0", "log", "memchr", "pear", @@ -2963,7 +2957,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -2974,9 +2968,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" @@ -2984,6 +2978,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -3008,17 +3008,17 @@ dependencies = [ "serde", "tempfile", "thiserror", - "toml 0.8.8", + "toml 0.8.19", "toolchain_find", ] [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -3027,9 +3027,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.11" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ "once_cell", "ring", @@ -3041,9 +3041,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ "base64 0.22.1", "rustls-pki-types", @@ -3051,15 +3051,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.5" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring", "rustls-pki-types", @@ -3068,15 +3068,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -3135,13 +3135,13 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.28.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acea373acb8c21ecb5a23741452acd2593ed44ee3d343e72baaa143bc89d0d5" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ "bitcoin_hashes", "rand", - "secp256k1-sys 0.9.1", + "secp256k1-sys 0.9.2", "serde", ] @@ -3156,24 +3156,24 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd97a086ec737e30053fd5c46f097465d25bb81dd3608825f65298c4c98be83" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" dependencies = [ "cc", ] [[package]] name = "semver" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.207" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2" dependencies = [ "serde_derive", ] @@ -3211,13 +3211,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.207" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -3233,29 +3233,30 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] [[package]] name = "serde_stacker" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f5321e680f77e7b5cfccc78708ff86a814d39aba030610aee67bd5eaf8a1c30" +checksum = "babfccff5773ff80657f0ecf553c7c516bdc2eb16389c0918b36b73e7015276e" dependencies = [ "serde", "stacker", @@ -3295,7 +3296,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -3309,9 +3310,9 @@ dependencies = [ [[package]] name = "sha1_smol" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" [[package]] name = "sha2" @@ -3364,15 +3365,15 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -3448,11 +3449,11 @@ dependencies = [ [[package]] name = "slog-term" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d29185c55b7b258b4f120eab00f48557d4d9bc814f41713f449d35b0f8977c" +checksum = "b6e022d0b998abfe5c3782c1f03551a596269450ccd677ea51c56f8b214610e8" dependencies = [ - "atty", + "is-terminal", "slog", "term", "thread_local", @@ -3486,9 +3487,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -3537,23 +3538,23 @@ dependencies = [ [[package]] name = "stacks-codec" -version = "2.7.0" -source = "git+https://github.com/hirosystems/clarinet.git#ce1ffeaaf645de2d9a581d1d727e660cacb1e288" +version = "2.8.0" +source = "git+https://github.com/hirosystems/clarinet.git#b84e0d0228a2220c860150939bdc5207e8b505ff" dependencies = [ "clarity", "serde", - "wsts 8.1.0", + "wsts", ] [[package]] name = "stacks-common" version = "0.0.2" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#6eb4a2377cb8d18275280530abb6044dee9081ee" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#5f9c466ad8d60e99fd3fc77e9291472e7bb01eef" dependencies = [ "chrono", "curve25519-dalek 2.0.0", "ed25519-dalek", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "lazy_static", "libc", "nix 0.23.2", @@ -3572,7 +3573,7 @@ dependencies = [ "slog-term", "time", "winapi", - "wsts 9.1.0", + "wsts", ] [[package]] @@ -3620,9 +3621,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -3637,9 +3638,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.43" +version = "2.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" dependencies = [ "proc-macro2", "quote", @@ -3654,14 +3655,14 @@ checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "system-deps" -version = "6.2.0" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck 0.4.1", + "heck 0.5.0", "pkg-config", - "toml 0.8.8", + "toml 0.8.19", "version-compare", ] @@ -3679,9 +3680,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" dependencies = [ "filetime", "libc", @@ -3690,21 +3691,21 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "once_cell", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -3720,9 +3721,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -3745,7 +3746,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -3756,7 +3757,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", "test-case-core", ] @@ -3771,35 +3772,35 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -3816,15 +3817,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", - "libc", "num-conv", - "num_threads", "powerfmt", "serde", "time-core", @@ -3839,9 +3838,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -3859,9 +3858,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -3874,32 +3873,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.1" +version = "1.39.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" +checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.6", + "socket2 0.5.7", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -3949,47 +3947,47 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit 0.22.20", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.20.7" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.3.0", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.3.0", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.18", ] [[package]] @@ -4051,7 +4049,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] @@ -4128,9 +4126,9 @@ dependencies = [ [[package]] name = "uncased" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" dependencies = [ "serde", "version_check", @@ -4138,9 +4136,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -4150,24 +4148,24 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" @@ -4193,9 +4191,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -4204,11 +4202,11 @@ dependencies = [ [[package]] name = "uuid" -version = "1.6.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.15", "rand", ] @@ -4226,21 +4224,21 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version-compare" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -4269,34 +4267,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -4306,9 +4305,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4316,22 +4315,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-streams" @@ -4348,9 +4347,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -4383,11 +4382,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -4407,11 +4406,11 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -4429,7 +4428,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -4449,17 +4457,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -4470,9 +4479,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -4482,9 +4491,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -4494,9 +4503,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -4506,9 +4521,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -4518,9 +4533,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -4530,9 +4545,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -4542,49 +4557,36 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.30" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] [[package]] -name = "winreg" -version = "0.52.0" +name = "winnow" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ - "cfg-if", - "windows-sys 0.48.0", + "memchr", ] [[package]] -name = "wsts" -version = "8.1.0" +name = "winreg" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467aa8e40ed0277d19922fd0e7357c16552cb900e5138f61a48ac23c4b7878e0" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ - "aes-gcm", - "bs58 0.5.1", - "hashbrown 0.14.3", - "hex", - "num-traits", - "p256k1", - "polynomial", - "primitive-types", - "rand_core 0.6.4", - "serde", - "sha2", - "thiserror", - "tracing", - "tracing-subscriber", + "cfg-if", + "windows-sys 0.48.0", ] [[package]] @@ -4595,7 +4597,7 @@ checksum = "1f38f50568ce9a30f2d041c26b1286fd453a166aec0059eb63aa51a15c46d776" dependencies = [ "aes-gcm", "bs58 0.5.1", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "hex", "num-traits", "p256k1", @@ -4620,9 +4622,9 @@ dependencies = [ [[package]] name = "xattr" -version = "1.1.3" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dae5072fe1f8db8f8d29059189ac175196e410e40ba42d5d4684ae2f750995" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", "linux-raw-sys", @@ -4631,38 +4633,39 @@ dependencies = [ [[package]] name = "yansi" -version = "1.0.0-rc.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" dependencies = [ "is-terminal", ] [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.74", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] name = "zeromq-src" diff --git a/components/chainhook-cli/src/archive/mod.rs b/components/chainhook-cli/src/archive/mod.rs index b41c62245..084ddc3c0 100644 --- a/components/chainhook-cli/src/archive/mod.rs +++ b/components/chainhook-cli/src/archive/mod.rs @@ -18,7 +18,7 @@ pub fn default_tsv_sha_file_path(network: &StacksNetwork) -> String { pub async fn download_tsv_file(config: &Config) -> Result<(), String> { let mut destination_path = config.expected_cache_path(); std::fs::create_dir_all(&destination_path).unwrap_or_else(|e| { - println!("{}", e.to_string()); + println!("{}", e); }); let remote_sha_url = config.expected_remote_stacks_tsv_sha256()?; @@ -32,7 +32,7 @@ pub async fn download_tsv_file(config: &Config) -> Result<(), String> { let mut local_sha_file_path = destination_path.clone(); local_sha_file_path.push(default_tsv_sha_file_path(&config.network.stacks_network)); - write_file_content_at_path(&local_sha_file_path, &res.to_vec())?; + write_file_content_at_path(&local_sha_file_path, &res)?; let file_url = config.expected_remote_stacks_tsv_url()?; let res = reqwest::get(&file_url) @@ -57,14 +57,14 @@ pub async fn download_tsv_file(config: &Config) -> Result<(), String> { if let Err(e) = file.write_all(&buffer[..n]) { return Err(format!( "unable to update compressed archive: {}", - e.to_string() + e )); } } Err(e) => { return Err(format!( "unable to write compressed archive: {}", - e.to_string() + e )); } } @@ -76,14 +76,14 @@ pub async fn download_tsv_file(config: &Config) -> Result<(), String> { while let Some(item) = stream.next().await { let chunk = match item { Ok(i) => Ok(i), - Err(e) => Err(format!("Error while downloading file {}", e.to_string())), + Err(e) => Err(format!("Error while downloading file {}", e)), }?; if chunk.is_empty() { continue; } tx.send_async(chunk.to_vec()) .await - .map_err(|e| format!("unable to download stacks archive: {}", e.to_string()))?; + .map_err(|e| format!("unable to download stacks archive: {}", e))?; } drop(tx); tokio::task::spawn_blocking(|| decoder_thread.join()) @@ -153,7 +153,7 @@ pub async fn download_stacks_dataset_if_required( let local_version_is_latest = remote_response .to_ascii_lowercase() .starts_with(&local[0..32]); - local_version_is_latest == false + !local_version_is_latest } (_, _) => { info!( @@ -173,7 +173,7 @@ pub async fn download_stacks_dataset_if_required( } info!(ctx.expect_logger(), "Downloading {}", url); - match download_tsv_file(&config).await { + match download_tsv_file(config).await { Ok(_) => {} Err(e) => return Err(e), } diff --git a/components/chainhook-cli/src/archive/tests/mod.rs b/components/chainhook-cli/src/archive/tests/mod.rs index 35250e30b..9c735ca42 100644 --- a/components/chainhook-cli/src/archive/tests/mod.rs +++ b/components/chainhook-cli/src/archive/tests/mod.rs @@ -23,7 +23,7 @@ const SHA256_HASH: &str = "49ca5f80b2a1303e7f7e98a4f9d39efeb35fd9f3696c4cd9615e0 #[get("/stacks_blocks.tsv.sha256")] fn get_sha256() -> String { - format!("{SHA256_HASH}") + SHA256_HASH.to_string() } #[get("/stacks_blocks.tsv.gz")] @@ -60,7 +60,7 @@ async fn it_downloads_stacks_dataset_if_required() { let _ = hiro_system_kit::thread_named("Start tsv service") .spawn(move || { let future = start_service(port); - let _ = hiro_system_kit::nestable_block_on(future); + hiro_system_kit::nestable_block_on(future); }) .expect("unable to spawn thread"); diff --git a/components/chainhook-cli/src/cli/mod.rs b/components/chainhook-cli/src/cli/mod.rs index 13baf7ff7..cc0be7bb5 100644 --- a/components/chainhook-cli/src/cli/mod.rs +++ b/components/chainhook-cli/src/cli/mod.rs @@ -330,12 +330,9 @@ pub fn main() { } }; - match hiro_system_kit::nestable_block_on(handle_command(opts, ctx.clone())) { - Err(e) => { - crit!(ctx.expect_logger(), "{e}"); - process::exit(1); - } - Ok(_) => {} + if let Err(e) = hiro_system_kit::nestable_block_on(handle_command(opts, ctx.clone())) { + crit!(ctx.expect_logger(), "{e}"); + process::exit(1); } } @@ -481,7 +478,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> { // need to create if let Some(dirp) = PathBuf::from(&path).parent() { std::fs::create_dir_all(dirp).unwrap_or_else(|e| { - println!("{}", e.to_string()); + println!("{}", e); }); } let mut f = std::fs::OpenOptions::new() @@ -489,7 +486,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> { .create(true) .truncate(true) .open(&path) - .map_err(|e| format!("{}", e.to_string()))?; + .map_err(|e| format!("{}", e))?; use std::io::Write; let _ = f.write_all(content.as_bytes()); } else { @@ -882,7 +879,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> { pub fn load_predicate_from_path( predicate_path: &str, ) -> Result { - let file = std::fs::File::open(&predicate_path) + let file = std::fs::File::open(predicate_path) .map_err(|e| format!("unable to read file {}\n{:?}", predicate_path, e))?; let mut file_reader = BufReader::new(file); let mut file_buffer = vec![]; diff --git a/components/chainhook-cli/src/config/generator.rs b/components/chainhook-cli/src/config/generator.rs index 7093c403d..ddc5281cd 100644 --- a/components/chainhook-cli/src/config/generator.rs +++ b/components/chainhook-cli/src/config/generator.rs @@ -54,5 +54,5 @@ tsv_file_url = "https://archive.hiro.so/{network}/stacks-blockchain-api/{network mode = mode.as_str(), network = network.to_lowercase(), ); - return conf; + conf } diff --git a/components/chainhook-cli/src/config/mod.rs b/components/chainhook-cli/src/config/mod.rs index c6667cd12..fb2b6b2a3 100644 --- a/components/chainhook-cli/src/config/mod.rs +++ b/components/chainhook-cli/src/config/mod.rs @@ -100,7 +100,7 @@ impl Config { let config_file: ConfigFile = match toml::from_slice(&file_buffer) { Ok(s) => s, Err(e) => { - return Err(format!("Config file malformatted {}", e.to_string())); + return Err(format!("Config file malformatted {}", e)); } }; Config::from_config_file(config_file) @@ -137,7 +137,7 @@ impl Config { }; let mut event_sources = vec![]; - for source in config_file.event_source.unwrap_or(vec![]).iter_mut() { + for source in config_file.event_source.unwrap_or_default().iter_mut() { if let Some(dst) = source.tsv_file_path.take() { let mut file_path = PathBuf::new(); file_path.push(dst); @@ -168,20 +168,16 @@ impl Config { Some(pox_config) => PoxConfig { first_burnchain_block_height: pox_config .first_burnchain_block_height - .unwrap_or(default_pox_config.first_burnchain_block_height) - .into(), + .unwrap_or(default_pox_config.first_burnchain_block_height), prepare_phase_len: pox_config .prepare_phase_len - .unwrap_or(default_pox_config.prepare_phase_len) - .into(), + .unwrap_or(default_pox_config.prepare_phase_len), reward_phase_len: pox_config .reward_phase_len - .unwrap_or(default_pox_config.reward_phase_len) - .into(), + .unwrap_or(default_pox_config.reward_phase_len), rewarded_addresses_per_block: pox_config .rewarded_addresses_per_block - .unwrap_or(default_pox_config.rewarded_addresses_per_block) - .into(), + .unwrap_or(default_pox_config.rewarded_addresses_per_block), }, }, http_api: match config_file.http_api { @@ -260,7 +256,7 @@ impl Config { _ => {} } } - return false; + false } pub fn add_local_stacks_tsv_source(&mut self, file_path: &PathBuf) { @@ -335,7 +331,7 @@ impl Config { remote_tsv_present_locally = true; } } - rely_on_remote_tsv == true && remote_tsv_present_locally == false + rely_on_remote_tsv && !remote_tsv_present_locally } pub fn default( @@ -348,7 +344,7 @@ impl Config { (true, false, false, _) => Config::devnet_default(), (false, true, false, _) => Config::testnet_default(), (false, false, true, _) => Config::mainnet_default(), - (false, false, false, Some(config_path)) => Config::from_file_path(&config_path)?, + (false, false, false, Some(config_path)) => Config::from_file_path(config_path)?, _ => Err("Invalid combination of arguments".to_string())?, }; Ok(config) diff --git a/components/chainhook-cli/src/config/tests/mod.rs b/components/chainhook-cli/src/config/tests/mod.rs index ddae000c2..fa48fe655 100644 --- a/components/chainhook-cli/src/config/tests/mod.rs +++ b/components/chainhook-cli/src/config/tests/mod.rs @@ -37,7 +37,7 @@ fn config_from_file_allows_setting_disabled_fields() { // http_api and monitoring are optional, so they are disabled in generated config file generated_config_file.http_api = Some(PredicatesApiConfigFile { http_port: Some(0), - database_uri: Some(format!("")), + database_uri: Some(String::new()), display_logs: Some(false), disabled: Some(false), }); @@ -78,7 +78,7 @@ fn is_http_api_enabled_handles_both_modes() { assert!(!config.is_http_api_enabled()); config.http_api = PredicatesApi::On(PredicatesApiConfig { http_port: 0, - database_uri: format!(""), + database_uri: String::new(), display_logs: false, }); assert!(config.is_http_api_enabled()); @@ -95,22 +95,22 @@ fn should_download_remote_stacks_tsv_handles_both_modes() { let mut config = Config::default(true, false, false, &None).unwrap(); config.event_sources = vec![url_src.clone(), path_src.clone()]; - assert_eq!(config.should_download_remote_stacks_tsv(), false); + assert!(!config.should_download_remote_stacks_tsv()); config.event_sources = vec![path_src.clone()]; - assert_eq!(config.should_download_remote_stacks_tsv(), false); + assert!(!config.should_download_remote_stacks_tsv()); config.event_sources = vec![]; - assert_eq!(config.should_download_remote_stacks_tsv(), false); + assert!(!config.should_download_remote_stacks_tsv()); config.event_sources = vec![url_src.clone()]; - assert_eq!(config.should_download_remote_stacks_tsv(), true); + assert!(config.should_download_remote_stacks_tsv()); } #[test] fn expected_remote_stacks_tsv_base_url_panics_if_missing() { let url_src = EventSourceConfig::StacksTsvUrl(super::UrlConfig { - file_url: format!("test"), + file_url: "test".to_string(), }); let mut config = Config::default(true, false, false, &None).unwrap(); diff --git a/components/chainhook-cli/src/scan/bitcoin.rs b/components/chainhook-cli/src/scan/bitcoin.rs index 3437af311..e57d2ddfc 100644 --- a/components/chainhook-cli/src/scan/bitcoin.rs +++ b/components/chainhook-cli/src/scan/bitcoin.rs @@ -42,7 +42,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate( let bitcoin_rpc = match Client::new(&config.network.bitcoind_rpc_url, auth) { Ok(con) => con, Err(message) => { - return Err(format!("Bitcoin RPC error: {}", message.to_string())); + return Err(format!("Bitcoin RPC error: {}", message)); } }; @@ -51,7 +51,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate( Err(e) => { return Err(format!( "unable to retrieve Bitcoin chain tip ({})", - e.to_string() + e )); } }; @@ -105,14 +105,11 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate( let mut loop_did_trigger = false; while let Some(current_block_height) = block_heights_to_scan.pop_front() { if let Some(kill_signal) = kill_signal.clone() { - match kill_signal.read() { - Ok(kill_signal) => { - // if true, we're received the kill signal, so break out of the loop - if *kill_signal { - return Ok(PredicateScanResult::Deregistered); - } + if let Ok(kill_signal) = kill_signal.read() { + // if true, we're received the kill signal, so break out of the loop + if *kill_signal { + return Ok(PredicateScanResult::Deregistered); } - Err(_) => {} } } if let Some(ref mut predicates_db_conn) = predicates_db_conn { @@ -143,7 +140,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate( Err(e) => { return Err(format!( "unable to retrieve Bitcoin chain tip ({})", - e.to_string() + e )); } }; @@ -216,7 +213,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate( res.unwrap_err() )); } else { - return Err(format!("Scan aborted (consecutive action errors >= 3)")); + return Err("Scan aborted (consecutive action errors >= 3)".to_string()); } } } @@ -260,7 +257,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate( return Ok(PredicateScanResult::Expired); } - return Ok(PredicateScanResult::ChainTipReached); + Ok(PredicateScanResult::ChainTipReached) } pub async fn process_block_with_predicates( @@ -278,7 +275,7 @@ pub async fn process_block_with_predicates( let (predicates_triggered, _predicates_evaluated, _predicates_expired) = evaluate_bitcoin_chainhooks_on_chain_event(&chain_event, predicates, ctx); - execute_predicates_action(predicates_triggered, &event_observer_config, &ctx).await + execute_predicates_action(predicates_triggered, event_observer_config, ctx).await } pub async fn execute_predicates_action<'a>( @@ -290,7 +287,7 @@ pub async fn execute_predicates_action<'a>( let mut proofs = HashMap::new(); for trigger in hits.into_iter() { if trigger.chainhook.include_proof { - gather_proofs(&trigger, &mut proofs, &config, &ctx); + gather_proofs(&trigger, &mut proofs, config, ctx); } let predicate_uuid = &trigger.chainhook.uuid; match handle_bitcoin_hook_action(trigger, &proofs) { @@ -304,10 +301,10 @@ pub async fn execute_predicates_action<'a>( actions_triggered += 1; match action { BitcoinChainhookOccurrence::Http(request, _) => { - send_request(request, 10, 3, &ctx).await? + send_request(request, 10, 3, ctx).await? } BitcoinChainhookOccurrence::File(path, bytes) => { - file_append(path, bytes, &ctx)? + file_append(path, bytes, ctx)? } BitcoinChainhookOccurrence::Data(_payload) => {} }; diff --git a/components/chainhook-cli/src/scan/stacks.rs b/components/chainhook-cli/src/scan/stacks.rs index 06d32f7fc..9ba580399 100644 --- a/components/chainhook-cli/src/scan/stacks.rs +++ b/components/chainhook-cli/src/scan/stacks.rs @@ -97,15 +97,9 @@ pub async fn get_canonical_fork_from_tsv( for result in reader_builder.deserialize() { line += 1; let record: Record = result.unwrap(); - match &record.kind { - RecordKind::StacksBlockReceived => match record_tx.send(Some((record, line))) { - Err(_e) => { - break; - } - _ => {} - }, - _ => {} - }; + if let RecordKind::StacksBlockReceived = &record.kind { if let Err(_e) = record_tx.send(Some((record, line))) { + break; + } }; } let _ = record_tx.send(None); }) @@ -119,7 +113,7 @@ pub async fn get_canonical_fork_from_tsv( while let Ok(Some((record, line))) = record_rx.recv() { let (block_identifier, parent_block_identifier) = match (&record.kind, &record.blob) { (RecordKind::StacksBlockReceived, Some(blob)) => { - match standardize_stacks_serialized_block_header(&blob) { + match standardize_stacks_serialized_block_header(blob) { Ok(data) => data, Err(e) => { error!( @@ -250,14 +244,11 @@ pub async fn scan_stacks_chainstate_via_rocksdb_using_predicate( let mut loop_did_trigger = false; while let Some(current_block_height) = block_heights_to_scan.pop_front() { if let Some(kill_signal) = kill_signal.clone() { - match kill_signal.read() { - Ok(kill_signal) => { - // if true, we're received the kill signal, so break out of the loop - if *kill_signal { - return Ok(PredicateScanResult::Deregistered); - } + if let Ok(kill_signal) = kill_signal.read() { + // if true, we're received the kill signal, so break out of the loop + if *kill_signal { + return Ok(PredicateScanResult::Deregistered); } - Err(_) => {} } } if let Some(ref mut predicates_db_conn) = predicates_db_conn { @@ -336,18 +327,18 @@ pub async fn scan_stacks_chainstate_via_rocksdb_using_predicate( let blocks: Vec<&dyn AbstractStacksBlock> = vec![&block_data]; let (hits_per_blocks, _predicates_expired) = - evaluate_stacks_chainhook_on_blocks(blocks, &predicate_spec, ctx); + evaluate_stacks_chainhook_on_blocks(blocks, predicate_spec, ctx); if hits_per_blocks.is_empty() { continue; } let trigger = StacksTriggerChainhook { - chainhook: &predicate_spec, + chainhook: predicate_spec, apply: hits_per_blocks, rollback: vec![], }; - let res = match handle_stacks_hook_action(trigger, &proofs, &ctx) { + let res = match handle_stacks_hook_action(trigger, &proofs, ctx) { Err(e) => { warn!( ctx.expect_logger(), @@ -360,9 +351,9 @@ pub async fn scan_stacks_chainstate_via_rocksdb_using_predicate( loop_did_trigger = true; let res = match action { StacksChainhookOccurrence::Http(request, _) => { - send_request(request, 3, 1, &ctx).await + send_request(request, 3, 1, ctx).await } - StacksChainhookOccurrence::File(path, bytes) => file_append(path, bytes, &ctx), + StacksChainhookOccurrence::File(path, bytes) => file_append(path, bytes, ctx), StacksChainhookOccurrence::Data(_payload) => Ok(()), }; match res { @@ -385,7 +376,7 @@ pub async fn scan_stacks_chainstate_via_rocksdb_using_predicate( res.unwrap_err() )); } else { - return Err(format!("Scan aborted (consecutive action errors >= 3)")); + return Err("Scan aborted (consecutive action errors >= 3)".to_string()); } } } @@ -420,10 +411,7 @@ pub async fn scan_stacks_chainstate_via_rocksdb_using_predicate( 3, stacks_db_conn, ) { - Ok(block) => match block { - Some(_) => true, - None => false, - }, + Ok(block) => block.is_some(), Err(e) => { warn!( ctx.expect_logger(), @@ -456,10 +444,7 @@ pub async fn scan_stacks_chainstate_via_csv_using_predicate( config: &mut Config, ctx: &Context, ) -> Result { - let start_block = match predicate_spec.start_block { - Some(start_block) => start_block, - None => 0, - }; + let start_block = predicate_spec.start_block.unwrap_or_default(); if let Some(end_block) = predicate_spec.end_block { if start_block > end_block { return Err( @@ -530,17 +515,17 @@ pub async fn scan_stacks_chainstate_via_csv_using_predicate( let blocks: Vec<&dyn AbstractStacksBlock> = vec![&block_data]; let (hits_per_blocks, _predicates_expired) = - evaluate_stacks_chainhook_on_blocks(blocks, &predicate_spec, ctx); + evaluate_stacks_chainhook_on_blocks(blocks, predicate_spec, ctx); if hits_per_blocks.is_empty() { continue; } let trigger = StacksTriggerChainhook { - chainhook: &predicate_spec, + chainhook: predicate_spec, apply: hits_per_blocks, rollback: vec![], }; - match handle_stacks_hook_action(trigger, &proofs, &ctx) { + match handle_stacks_hook_action(trigger, &proofs, ctx) { Err(e) => { error!(ctx.expect_logger(), "unable to handle action {}", e); } @@ -548,9 +533,9 @@ pub async fn scan_stacks_chainstate_via_csv_using_predicate( occurrences_found += 1; let res = match action { StacksChainhookOccurrence::Http(request, _) => { - send_request(request, 10, 3, &ctx).await + send_request(request, 10, 3, ctx).await } - StacksChainhookOccurrence::File(path, bytes) => file_append(path, bytes, &ctx), + StacksChainhookOccurrence::File(path, bytes) => file_append(path, bytes, ctx), StacksChainhookOccurrence::Data(_payload) => unreachable!(), }; if res.is_err() { @@ -562,7 +547,7 @@ pub async fn scan_stacks_chainstate_via_csv_using_predicate( } // We abort after 3 consecutive errors if err_count >= 3 { - return Err(format!("Scan aborted (consecutive action errors >= 3)")); + return Err("Scan aborted (consecutive action errors >= 3)".to_string()); } } info!( @@ -586,7 +571,7 @@ pub async fn consolidate_local_stacks_chainstate_using_csv( if downloaded_new_dataset { let stacks_db = open_readonly_stacks_db_conn_with_retry(&config.expected_cache_path(), 3, ctx)?; - let confirmed_tip = get_last_block_height_inserted(&stacks_db, &ctx); + let confirmed_tip = get_last_block_height_inserted(&stacks_db, ctx); let mut canonical_fork: VecDeque<(BlockIdentifier, BlockIdentifier, u64)> = get_canonical_fork_from_tsv(config, confirmed_tip, ctx).await?; diff --git a/components/chainhook-cli/src/service/http_api.rs b/components/chainhook-cli/src/service/http_api.rs index 9a1e87d08..7aaeb3294 100644 --- a/components/chainhook-cli/src/service/http_api.rs +++ b/components/chainhook-cli/src/service/http_api.rs @@ -89,7 +89,7 @@ fn handle_get_predicates( ctx.try_log(|logger| slog::info!(logger, "Handling HTTP GET /v1/chainhooks")); match open_readwrite_predicates_db_conn(api_config) { Ok(mut predicates_db_conn) => { - let predicates = match get_entries_from_predicates_db(&mut predicates_db_conn, &ctx) { + let predicates = match get_entries_from_predicates_db(&mut predicates_db_conn, ctx) { Ok(predicates) => predicates, Err(e) => { ctx.try_log(|logger| slog::warn!(logger, "unable to retrieve predicates: {e}")); @@ -148,27 +148,21 @@ fn handle_create_predicate( let predicate_uuid = predicate.get_uuid().to_string(); if let Ok(mut predicates_db_conn) = open_readwrite_predicates_db_conn(api_config) { - match get_entry_from_predicates_db( + if let Ok(Some(_)) = get_entry_from_predicates_db( &ChainhookInstance::either_stx_or_btc_key(&predicate_uuid), &mut predicates_db_conn, - &ctx, + ctx, ) { - Ok(Some(_)) => { - return Json(json!({ - "status": 409, - "error": "Predicate uuid already in use", - })) - } - _ => {} + return Json(json!({ + "status": 409, + "error": "Predicate uuid already in use", + })) } } let background_job_tx = background_job_tx.inner(); - match background_job_tx.lock() { - Ok(tx) => { - let _ = tx.send(ObserverCommand::RegisterPredicate(predicate)); - } - _ => {} + if let Ok(tx) = background_job_tx.lock() { + let _ = tx.send(ObserverCommand::RegisterPredicate(predicate)); }; Json(json!({ @@ -197,7 +191,7 @@ fn handle_get_predicate( let (predicate, status) = match get_entry_from_predicates_db( &ChainhookInstance::either_stx_or_btc_key(&predicate_uuid), &mut predicates_db_conn, - &ctx, + ctx, ) { Ok(Some(predicate_with_status)) => predicate_with_status, _ => { @@ -235,11 +229,8 @@ fn handle_delete_stacks_predicate( }); let background_job_tx = background_job_tx.inner(); - match background_job_tx.lock() { - Ok(tx) => { - let _ = tx.send(ObserverCommand::DeregisterStacksPredicate(predicate_uuid)); - } - _ => {} + if let Ok(tx) = background_job_tx.lock() { + let _ = tx.send(ObserverCommand::DeregisterStacksPredicate(predicate_uuid)); }; Json(json!({ @@ -264,11 +255,8 @@ fn handle_delete_bitcoin_predicate( }); let background_job_tx = background_job_tx.inner(); - match background_job_tx.lock() { - Ok(tx) => { - let _ = tx.send(ObserverCommand::DeregisterBitcoinPredicate(predicate_uuid)); - } - _ => {} + if let Ok(tx) = background_job_tx.lock() { + let _ = tx.send(ObserverCommand::DeregisterBitcoinPredicate(predicate_uuid)); }; Json(json!({ @@ -286,7 +274,7 @@ pub fn get_entry_from_predicates_db( format!( "unable to load chainhook associated with key {}: {}", predicate_key, - e.to_string() + e ) })?; @@ -295,7 +283,7 @@ pub fn get_entry_from_predicates_db( Some(payload) => payload, }; - let spec = ChainhookInstance::deserialize_specification(&encoded_spec)?; + let spec = ChainhookInstance::deserialize_specification(encoded_spec)?; let encoded_status = match entry.get("status") { None => Err(format!( @@ -305,7 +293,7 @@ pub fn get_entry_from_predicates_db( Some(payload) => Ok(payload), }?; - let status = serde_json::from_str(&encoded_status).map_err(|e| format!("{}", e.to_string()))?; + let status = serde_json::from_str(encoded_status).map_err(|e| format!("{}", e))?; Ok(Some((spec, status))) } @@ -316,8 +304,7 @@ pub fn get_entries_from_predicates_db( ) -> Result, String> { let chainhooks_to_load: Vec = predicate_db_conn .scan_match(ChainhookInstance::either_stx_or_btc_key("*")) - .map_err(|e| format!("unable to connect to redis: {}", e.to_string()))? - .into_iter() + .map_err(|e| format!("unable to connect to redis: {}", e))? .collect(); let mut predicates = vec![]; @@ -352,17 +339,17 @@ pub fn load_predicates_from_redis( ) -> Result, String> { let redis_uri: &str = config.expected_api_database_uri(); let client = redis::Client::open(redis_uri) - .map_err(|e| format!("unable to connect to redis: {}", e.to_string()))?; + .map_err(|e| format!("unable to connect to redis: {}", e))?; let mut predicate_db_conn = client .get_connection() - .map_err(|e| format!("unable to connect to redis: {}", e.to_string()))?; + .map_err(|e| format!("unable to connect to redis: {}", e))?; get_entries_from_predicates_db(&mut predicate_db_conn, ctx) } pub fn document_predicate_api_server() -> Result { let (_, spec) = get_routes_spec(); let json_spec = serde_json::to_string_pretty(&spec) - .map_err(|e| format!("failed to serialize openapi spec: {}", e.to_string()))?; + .map_err(|e| format!("failed to serialize openapi spec: {}", e))?; Ok(json_spec) } diff --git a/components/chainhook-cli/src/service/mod.rs b/components/chainhook-cli/src/service/mod.rs index 7019b4e2e..439500392 100644 --- a/components/chainhook-cli/src/service/mod.rs +++ b/components/chainhook-cli/src/service/mod.rs @@ -114,19 +114,16 @@ impl Service { if let PredicatesApi::On(api_config) = &self.config.http_api { if let Ok(mut predicates_db_conn) = open_readwrite_predicates_db_conn(api_config) { let uuid = predicate.get_uuid(); - match get_entry_from_predicates_db( - &ChainhookInstance::either_stx_or_btc_key(&uuid), + if let Ok(Some(_)) = get_entry_from_predicates_db( + &ChainhookInstance::either_stx_or_btc_key(uuid), &mut predicates_db_conn, &self.ctx, ) { - Ok(Some(_)) => { - warn!( - self.ctx.expect_logger(), - "Predicate uuid already in use: {uuid}", - ); - continue; - } - _ => {} + warn!( + self.ctx.expect_logger(), + "Predicate uuid already in use: {uuid}", + ); + continue; } }; } @@ -165,8 +162,7 @@ impl Service { // Download and ingest a Stacks dump if self.config.rely_on_remote_stacks_tsv() { - let _ = - consolidate_local_stacks_chainstate_using_csv(&mut self.config, &self.ctx).await?; + consolidate_local_stacks_chainstate_using_csv(&mut self.config, &self.ctx).await?; } // Stacks scan operation threadpool @@ -343,7 +339,7 @@ impl Service { // - contract-id if let PredicatesApi::On(ref config) = self.config.http_api { let Ok(mut predicates_db_conn) = - open_readwrite_predicates_db_conn_verbose(&config, &ctx) + open_readwrite_predicates_db_conn_verbose(config, &ctx) else { continue; }; @@ -378,7 +374,7 @@ impl Service { ObserverEvent::PredicateEnabled(spec) => { if let PredicatesApi::On(ref config) = self.config.http_api { let Ok(mut predicates_db_conn) = - open_readwrite_predicates_db_conn_verbose(&config, &ctx) + open_readwrite_predicates_db_conn_verbose(config, &ctx) else { continue; }; @@ -402,7 +398,7 @@ impl Service { }) => { if let PredicatesApi::On(ref config) = self.config.http_api { let Ok(mut predicates_db_conn) = - open_readwrite_predicates_db_conn_verbose(&config, &ctx) + open_readwrite_predicates_db_conn_verbose(config, &ctx) else { continue; }; @@ -435,7 +431,7 @@ impl Service { debug!(self.ctx.expect_logger(), "Bitcoin update not stored"); if let PredicatesApi::On(ref config) = self.config.http_api { let Ok(mut predicates_db_conn) = - open_readwrite_predicates_db_conn_verbose(&config, &ctx) + open_readwrite_predicates_db_conn_verbose(config, &ctx) else { continue; }; @@ -445,27 +441,24 @@ impl Service { data, ) => { for confirmed_block in &data.confirmed_blocks { - match expire_predicates_for_block( + if let Some(expired_predicate_uuids) = expire_predicates_for_block( &Chain::Bitcoin, confirmed_block.block_identifier.index, &mut predicates_db_conn, &ctx, ) { - Some(expired_predicate_uuids) => { - for uuid in expired_predicate_uuids.into_iter() { - let _ = observer_command_tx.send( - ObserverCommand::ExpireBitcoinPredicate( - HookExpirationData { - hook_uuid: uuid, - block_height: confirmed_block - .block_identifier - .index, - }, - ), - ); - } + for uuid in expired_predicate_uuids.into_iter() { + let _ = observer_command_tx.send( + ObserverCommand::ExpireBitcoinPredicate( + HookExpirationData { + hook_uuid: uuid, + block_height: confirmed_block + .block_identifier + .index, + }, + ), + ); } - None => {} } } } @@ -473,27 +466,24 @@ impl Service { data, ) => { for confirmed_block in &data.confirmed_blocks { - match expire_predicates_for_block( + if let Some(expired_predicate_uuids) = expire_predicates_for_block( &Chain::Bitcoin, confirmed_block.block_identifier.index, &mut predicates_db_conn, &ctx, ) { - Some(expired_predicate_uuids) => { - for uuid in expired_predicate_uuids.into_iter() { - let _ = observer_command_tx.send( - ObserverCommand::ExpireBitcoinPredicate( - HookExpirationData { - hook_uuid: uuid, - block_height: confirmed_block - .block_identifier - .index, - }, - ), - ); - } + for uuid in expired_predicate_uuids.into_iter() { + let _ = observer_command_tx.send( + ObserverCommand::ExpireBitcoinPredicate( + HookExpirationData { + hook_uuid: uuid, + block_height: confirmed_block + .block_identifier + .index, + }, + ), + ); } - None => {} } } } @@ -571,7 +561,7 @@ impl Service { if let PredicatesApi::On(ref config) = self.config.http_api { let Ok(mut predicates_db_conn) = - open_readwrite_predicates_db_conn_verbose(&config, &ctx) + open_readwrite_predicates_db_conn_verbose(config, &ctx) else { continue; }; @@ -580,53 +570,47 @@ impl Service { StacksChainEvent::ChainUpdatedWithBlocks(data) => { stacks_event += 1; for confirmed_block in &data.confirmed_blocks { - match expire_predicates_for_block( + if let Some(expired_predicate_uuids) = expire_predicates_for_block( &Chain::Stacks, confirmed_block.block_identifier.index, &mut predicates_db_conn, &ctx, ) { - Some(expired_predicate_uuids) => { - for uuid in expired_predicate_uuids.into_iter() { - let _ = observer_command_tx.send( - ObserverCommand::ExpireStacksPredicate( - HookExpirationData { - hook_uuid: uuid, - block_height: confirmed_block - .block_identifier - .index, - }, - ), - ); - } + for uuid in expired_predicate_uuids.into_iter() { + let _ = observer_command_tx.send( + ObserverCommand::ExpireStacksPredicate( + HookExpirationData { + hook_uuid: uuid, + block_height: confirmed_block + .block_identifier + .index, + }, + ), + ); } - None => {} } } } StacksChainEvent::ChainUpdatedWithReorg(data) => { for confirmed_block in &data.confirmed_blocks { - match expire_predicates_for_block( + if let Some(expired_predicate_uuids) = expire_predicates_for_block( &Chain::Stacks, confirmed_block.block_identifier.index, &mut predicates_db_conn, &ctx, ) { - Some(expired_predicate_uuids) => { - for uuid in expired_predicate_uuids.into_iter() { - let _ = observer_command_tx.send( - ObserverCommand::ExpireStacksPredicate( - HookExpirationData { - hook_uuid: uuid, - block_height: confirmed_block - .block_identifier - .index, - }, - ), - ); - } + for uuid in expired_predicate_uuids.into_iter() { + let _ = observer_command_tx.send( + ObserverCommand::ExpireStacksPredicate( + HookExpirationData { + hook_uuid: uuid, + block_height: confirmed_block + .block_identifier + .index, + }, + ), + ); } - None => {} } } } @@ -645,19 +629,15 @@ impl Service { if stacks_event > 32 { stacks_event = 0; if self.config.rely_on_remote_stacks_tsv() { - match consolidate_local_stacks_chainstate_using_csv( + if let Err(e) = consolidate_local_stacks_chainstate_using_csv( &mut self.config, &self.ctx, ) - .await - { - Err(e) => { - error!( - self.ctx.expect_logger(), - "Failed to update database from archive: {e}" - ) - } - Ok(()) => {} + .await { + error!( + self.ctx.expect_logger(), + "Failed to update database from archive: {e}" + ) }; } } @@ -668,7 +648,7 @@ impl Service { }) => { if let PredicatesApi::On(ref config) = self.config.http_api { let Ok(mut predicates_db_conn) = - open_readwrite_predicates_db_conn_verbose(&config, &ctx) + open_readwrite_predicates_db_conn_verbose(config, &ctx) else { continue; }; @@ -748,7 +728,7 @@ fn update_status_from_report( ctx: &Context, ) { for (predicate_uuid, blocks_ids) in report.predicates_triggered.iter() { - if let Some(last_triggered_height) = blocks_ids.last().and_then(|b| Some(b.index)) { + if let Some(last_triggered_height) = blocks_ids.last().map(|b| b.index) { let triggered_count = blocks_ids.len().try_into().unwrap_or(0); set_predicate_streaming_status( StreamingDataType::Occurrence { @@ -757,7 +737,7 @@ fn update_status_from_report( }, &(ChainhookInstance::either_stx_or_btc_key(predicate_uuid)), predicates_db_conn, - &ctx, + ctx, ); } } @@ -777,7 +757,7 @@ fn update_status_from_report( blocks_ids.remove(expired_id); } } - if let Some(last_evaluated_height) = blocks_ids.last().and_then(|b| Some(b.index)) { + if let Some(last_evaluated_height) = blocks_ids.last().map(|b| b.index) { let evaluated_count = blocks_ids.len().try_into().unwrap_or(0); set_predicate_streaming_status( StreamingDataType::Evaluation { @@ -786,12 +766,12 @@ fn update_status_from_report( }, &(ChainhookInstance::either_stx_or_btc_key(predicate_uuid)), predicates_db_conn, - &ctx, + ctx, ); } } for (predicate_uuid, blocks_ids) in report.predicates_expired.iter() { - if let Some(last_evaluated_height) = blocks_ids.last().and_then(|b| Some(b.index)) { + if let Some(last_evaluated_height) = blocks_ids.last().map(|b| b.index) { let evaluated_count = blocks_ids.len().try_into().unwrap_or(0); set_unconfirmed_expiration_status( &chain, @@ -799,7 +779,7 @@ fn update_status_from_report( last_evaluated_height, &(ChainhookInstance::either_stx_or_btc_key(predicate_uuid)), predicates_db_conn, - &ctx, + ctx, ); } } @@ -849,7 +829,7 @@ fn set_predicate_streaming_status( number_of_times_triggered, last_evaluated_block_height, ) = { - let current_status = retrieve_predicate_status(&predicate_key, predicates_db_conn); + let current_status = retrieve_predicate_status(predicate_key, predicates_db_conn); match current_status { Some(status) => match status { PredicateStatus::Streaming(StreamingData { @@ -907,7 +887,7 @@ fn set_predicate_streaming_status( last_triggered_height, triggered_count, } => ( - Some(now_secs.clone()), + Some(now_secs), number_of_times_triggered + triggered_count, number_of_blocks_evaluated + triggered_count, last_triggered_height, @@ -939,7 +919,7 @@ fn set_predicate_streaming_status( number_of_blocks_evaluated, }), predicates_db_conn, - &ctx, + ctx, ); } @@ -959,7 +939,7 @@ pub fn set_predicate_scanning_status( .duration_since(UNIX_EPOCH) .expect("Could not get current time in ms") .as_secs(); - let current_status = retrieve_predicate_status(&predicate_key, predicates_db_conn); + let current_status = retrieve_predicate_status(predicate_key, predicates_db_conn); let last_occurrence = match current_status { Some(status) => match status { PredicateStatus::Scanning(scanning_data) => { @@ -1008,7 +988,7 @@ pub fn set_predicate_scanning_status( last_evaluated_block_height: current_block_height, }), predicates_db_conn, - &ctx, + ctx, ); } @@ -1021,7 +1001,7 @@ pub fn set_unconfirmed_expiration_status( predicates_db_conn: &mut Connection, ctx: &Context, ) { - let current_status = retrieve_predicate_status(&predicate_key, predicates_db_conn); + let current_status = retrieve_predicate_status(predicate_key, predicates_db_conn); let mut previously_was_unconfirmed = false; let ( number_of_blocks_evaluated, @@ -1087,7 +1067,7 @@ pub fn set_unconfirmed_expiration_status( expired_at_block_height, }), predicates_db_conn, - &ctx, + ctx, ); // don't insert this entry more than once if !previously_was_unconfirmed { @@ -1096,7 +1076,7 @@ pub fn set_unconfirmed_expiration_status( expired_at_block_height, predicate_key, predicates_db_conn, - &ctx, + ctx, ); } } @@ -1106,7 +1086,7 @@ pub fn set_confirmed_expiration_status( predicates_db_conn: &mut Connection, ctx: &Context, ) { - let current_status = retrieve_predicate_status(&predicate_key, predicates_db_conn); + let current_status = retrieve_predicate_status(predicate_key, predicates_db_conn); let expired_data = match current_status { Some(status) => match status { PredicateStatus::UnconfirmedExpiration(expired_data) => expired_data, @@ -1128,7 +1108,7 @@ pub fn set_confirmed_expiration_status( predicate_key, PredicateStatus::ConfirmedExpiration(expired_data), predicates_db_conn, - &ctx, + ctx, ); } @@ -1164,8 +1144,8 @@ fn insert_predicate_expiration( ) { let key = get_predicate_expiration_key(chain, expired_at_block_height); let mut predicates_expiring_at_block = - get_predicates_expiring_at_block(chain, expired_at_block_height, predicates_db_conn, &ctx) - .unwrap_or(vec![]); + get_predicates_expiring_at_block(chain, expired_at_block_height, predicates_db_conn, ctx) + .unwrap_or_default(); predicates_expiring_at_block.push(predicate_key.to_owned()); let serialized_expiring_predicates = json!(predicates_expiring_at_block).to_string(); if let Err(e) = @@ -1278,7 +1258,7 @@ pub fn open_readwrite_predicates_db_conn( let client = redis::Client::open(redis_uri.clone()).unwrap(); client .get_connection() - .map_err(|e| format!("unable to connect to db: {}", e.to_string())) + .map_err(|e| format!("unable to connect to db: {}", e)) } pub fn open_readwrite_predicates_db_conn_verbose( diff --git a/components/chainhook-cli/src/service/runloops.rs b/components/chainhook-cli/src/service/runloops.rs index 2322c1545..c271b60e0 100644 --- a/components/chainhook-cli/src/service/runloops.rs +++ b/components/chainhook-cli/src/service/runloops.rs @@ -111,10 +111,8 @@ pub fn start_stacks_scan_runloop( &moved_ctx, ); } - - return; } - }; + } }); } StacksScanOp::KillScan(predicate_uuid) => { @@ -126,7 +124,7 @@ pub fn start_stacks_scan_runloop( } } } - let _ = stacks_scan_pool.join(); + stacks_scan_pool.join(); } pub enum BitcoinScanOp { @@ -197,9 +195,8 @@ pub fn start_bitcoin_scan_runloop( &moved_ctx, ) } - return; } - }; + } }); } BitcoinScanOp::KillScan(predicate_uuid) => { @@ -211,5 +208,5 @@ pub fn start_bitcoin_scan_runloop( } } } - let _ = bitcoin_scan_pool.join(); + bitcoin_scan_pool.join(); } diff --git a/components/chainhook-cli/src/service/tests/helpers/mock_bitcoin_rpc.rs b/components/chainhook-cli/src/service/tests/helpers/mock_bitcoin_rpc.rs index 53daa2d5e..f212d52e3 100644 --- a/components/chainhook-cli/src/service/tests/helpers/mock_bitcoin_rpc.rs +++ b/components/chainhook-cli/src/service/tests/helpers/mock_bitcoin_rpc.rs @@ -136,7 +136,7 @@ fn handle_rpc( value: Amount::ZERO, n: 0, script_pub_key: GetRawTransactionResultVoutScriptPubKey { - asm: format!(""), + asm: String::new(), hex: vec![], req_sigs: None, type_: None, @@ -151,10 +151,10 @@ fn handle_rpc( sequence: 0, txid: Some(branch_and_height_to_hash_str(Some(branch), height + 1)), vout: Some(1), - script_sig: Some(GetRawTransactionResultVinScriptSig { hex: format!("") }), + script_sig: Some(GetRawTransactionResultVinScriptSig { hex: String::new() }), txinwitness: Some(vec![format!("")]), prevout: Some(BitcoinTransactionInputPrevoutFullBreakdown { - height: height, + height, value: Amount::ZERO, }), }], @@ -162,7 +162,7 @@ fn handle_rpc( value: Amount::ZERO, n: 0, script_pub_key: GetRawTransactionResultVoutScriptPubKey { - asm: format!(""), + asm: String::new(), hex: vec![], req_sigs: None, type_: None, @@ -189,8 +189,7 @@ fn handle_rpc( "getblockchaininfo" => { let (branch, (chain_tip, _)) = fork_tracker .iter() - .max_by(|a, b| a.1.cmp(&b.1)) - .map(|kv| kv) + .max_by(|a, b| a.1.cmp(b.1)) .unwrap(); let hash = branch_and_height_to_hash(Some(*branch), *chain_tip); @@ -246,8 +245,7 @@ fn handle_rpc( "getblockhash" => { let (branch, _) = fork_tracker .iter() - .max_by(|a, b| a.1.cmp(&b.1)) - .map(|kv| kv) + .max_by(|a, b| a.1.cmp(b.1)) .unwrap(); let height = rpc.params[0].as_u64().unwrap(); diff --git a/components/chainhook-cli/src/service/tests/helpers/mock_service.rs b/components/chainhook-cli/src/service/tests/helpers/mock_service.rs index 2f6293f56..b9c821429 100644 --- a/components/chainhook-cli/src/service/tests/helpers/mock_service.rs +++ b/components/chainhook-cli/src/service/tests/helpers/mock_service.rs @@ -42,20 +42,20 @@ pub async fn get_predicate_status(uuid: &str, port: u16) -> Result match result.get("status") { Some(status) => { return serde_json::from_value(status.clone()) - .map_err(|e| format!("failed to parse status {}", e.to_string())); + .map_err(|e| format!("failed to parse status {}", e)); } - None => return Err(format!("no status field on get predicate result")), + None => return Err("no status field on get predicate result".to_string()), }, None => { attempts += 1; if attempts == 10 { - return Err(format!("no result field on get predicate response")); + return Err("no result field on get predicate response".to_string()); } else { tokio::time::sleep(std::time::Duration::from_secs(1)).await; } } }, - None => return Err(format!("failed to parse get predicate response")), + None => return Err("failed to parse get predicate response".to_string()), } } } @@ -83,13 +83,11 @@ pub async fn filter_predicate_status_from_all_predicates( Some(predicate) => match predicate.get("status") { Some(status) => { return serde_json::from_value(status.clone()).map_err(|e| { - format!("failed to parse status {}", e.to_string()) + format!("failed to parse status {}", e) }); } None => { - return Err(format!( - "no status field on matching get predicates result" - )) + return Err("no status field on matching get predicates result".to_string()) } }, None => { @@ -100,21 +98,19 @@ pub async fn filter_predicate_status_from_all_predicates( } } None => { - return Err(format!( - "failed to parse get predicate response's result field" - )) + return Err("failed to parse get predicate response's result field".to_string()) } }, None => { attempts += 1; if attempts == 10 { - return Err(format!("no result field on get predicates response")); + return Err("no result field on get predicates response".to_string()); } else { tokio::time::sleep(std::time::Duration::from_secs(1)).await; } } }, - None => return Err(format!("failed to parse get predicate response")), + None => return Err("failed to parse get predicate response".to_string()), } } } @@ -181,8 +177,8 @@ pub async fn call_ping(port: u16) -> Result { let res = call_observer_svc(&url, Method::GET, None).await?; match res.get("result") { Some(result) => serde_json::from_value(result.clone()) - .map_err(|e| format!("failed to parse observer metrics {}", e.to_string())), - None => Err(format!("Failed parse result of observer ping")), + .map_err(|e| format!("failed to parse observer metrics {}", e)), + None => Err("Failed parse result of observer ping".to_string()), } } @@ -242,7 +238,7 @@ pub async fn start_redis(port: u16) -> Result { .arg(format!("--port {port}")) .stdout(Stdio::null()) .spawn() - .map_err(|e| format!("failed to create start-redis command: {}", e.to_string()))?; + .map_err(|e| format!("failed to create start-redis command: {}", e))?; let mut attempts = 0; loop { match redis::Client::open(format!("redis://localhost:{port}/")) { @@ -251,7 +247,7 @@ pub async fn start_redis(port: u16) -> Result { Err(e) => { attempts += 1; if attempts == 10 { - return Err(format!("failed to start redis service: {}", e.to_string())); + return Err(format!("failed to start redis service: {}", e)); } tokio::time::sleep(std::time::Duration::from_secs(1)).await } @@ -259,7 +255,7 @@ pub async fn start_redis(port: u16) -> Result { Err(e) => { attempts += 1; if attempts == 10 { - return Err(format!("failed to start redis service: {}", e.to_string())); + return Err(format!("failed to start redis service: {}", e)); } tokio::time::sleep(std::time::Duration::from_secs(1)).await } @@ -274,7 +270,6 @@ pub fn flush_redis(port: u16) { let db_keys: Vec = predicate_db_conn .scan_match("*") .unwrap() - .into_iter() .collect(); for k in db_keys { predicate_db_conn.del::<_, ()>(&k).unwrap(); @@ -343,7 +338,7 @@ pub async fn start_chainhook_service( let _ = hiro_system_kit::thread_named("Chainhook service") .spawn(move || { let future = service.run( - startup_predicates.unwrap_or(vec![]), + startup_predicates.unwrap_or_default(), Some((moved_observer_command_tx, observer_command_rx)), ); let _ = hiro_system_kit::nestable_block_on(future); @@ -351,7 +346,7 @@ pub async fn start_chainhook_service( .map_err(|e| { format!( "failed to start chainhook service thread, {}", - e.to_string() + e ) })?; @@ -360,7 +355,7 @@ pub async fn start_chainhook_service( const MAX_ATTEMPTS: u32 = 10; loop { if attempts >= MAX_ATTEMPTS { - return Err(format!("failed to ping chainhook service")); + return Err("failed to ping chainhook service".to_string()); } if let Ok(_client) = reqwest::Client::new() @@ -525,7 +520,7 @@ pub async fn setup_bitcoin_chainhook_test(starting_chain_tip: u64) -> TestSetupR let _ = hiro_system_kit::thread_named("Bitcoin rpc service") .spawn(move || { let future = mock_bitcoin_rpc(bitcoin_rpc_port, starting_chain_tip); - let _ = hiro_system_kit::nestable_block_on(future); + hiro_system_kit::nestable_block_on(future); }) .expect("unable to spawn thread"); diff --git a/components/chainhook-cli/src/service/tests/helpers/mock_stacks_node.rs b/components/chainhook-cli/src/service/tests/helpers/mock_stacks_node.rs index 6d03534ef..a13198e36 100644 --- a/components/chainhook-cli/src/service/tests/helpers/mock_stacks_node.rs +++ b/components/chainhook-cli/src/service/tests/helpers/mock_stacks_node.rs @@ -18,7 +18,7 @@ pub fn create_tmp_working_dir() -> Result<(String, String), String> { let working_dir = format!("{TEST_WORKING_DIR}/{random_digit}"); let tsv_dir = format!("./{working_dir}/stacks_blocks.tsv"); std::fs::create_dir_all(&working_dir) - .map_err(|e| format!("failed to create temp working dir: {}", e.to_string()))?; + .map_err(|e| format!("failed to create temp working dir: {}", e))?; Ok((working_dir, tsv_dir)) } fn create_stacks_new_event( @@ -28,67 +28,67 @@ fn create_stacks_new_event( ) -> NewEvent { let mut event_type = String::new(); let stx_transfer_event = if let StacksTransactionEventPayload::STXTransferEvent(data) = &event { - event_type = format!("stx_transfer"); + event_type = "stx_transfer".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let stx_mint_event = if let StacksTransactionEventPayload::STXMintEvent(data) = &event { - event_type = format!("stx_mint"); + event_type = "stx_mint".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let stx_burn_event = if let StacksTransactionEventPayload::STXBurnEvent(data) = &event { - event_type = format!("stx_burn"); + event_type = "stx_burn".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let stx_lock_event = if let StacksTransactionEventPayload::STXLockEvent(data) = &event { - event_type = format!("stx_lock"); + event_type = "stx_lock".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let nft_transfer_event = if let StacksTransactionEventPayload::NFTTransferEvent(data) = &event { - event_type = format!("nft_transfer"); + event_type = "nft_transfer".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let nft_mint_event = if let StacksTransactionEventPayload::NFTMintEvent(data) = &event { - event_type = format!("nft_mint"); + event_type = "nft_mint".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let nft_burn_event = if let StacksTransactionEventPayload::NFTBurnEvent(data) = &event { - event_type = format!("nft_burn"); + event_type = "nft_burn".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let ft_transfer_event = if let StacksTransactionEventPayload::FTTransferEvent(data) = &event { - event_type = format!("ft_transfer"); + event_type = "ft_transfer".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let ft_mint_event = if let StacksTransactionEventPayload::FTMintEvent(data) = &event { - event_type = format!("ft_mint"); + event_type = "ft_mint".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let ft_burn_event = if let StacksTransactionEventPayload::FTBurnEvent(data) = &event { - event_type = format!("ft_burn"); + event_type = "ft_burn".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let contract_event = if let StacksTransactionEventPayload::SmartContractEvent(data) = &event { - event_type = format!("smart_contract_print_event"); + event_type = "smart_contract_print_event".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None @@ -120,9 +120,9 @@ fn create_stacks_new_transaction(index: u64) -> NewTransaction { NewTransaction { txid: format!("transaction_id_{index}"), tx_index: index as usize, - status: format!("success"), - raw_result: format!("0x0703"), - raw_tx: format!("0x00000000010400e2cd0871da5bdd38c4d5569493dc3b14aac4e0a10000000000000019000000000000000000008373b16e4a6f9d87864c314dd77bbd8b27a2b1805e96ec5a6509e7e4f833cd6a7bdb2462c95f6968a867ab6b0e8f0a6498e600dbc46cfe9f84c79709da7b9637010200000000040000000000000000000000000000000000000000000000000000000000000000"), + status: "success".to_string(), + raw_result: "0x0703".to_string(), + raw_tx: "0x00000000010400e2cd0871da5bdd38c4d5569493dc3b14aac4e0a10000000000000019000000000000000000008373b16e4a6f9d87864c314dd77bbd8b27a2b1805e96ec5a6509e7e4f833cd6a7bdb2462c95f6968a867ab6b0e8f0a6498e600dbc46cfe9f84c79709da7b9637010200000000040000000000000000000000000000000000000000000000000000000000000000".to_string(), execution_cost: None, contract_abi: None } @@ -148,106 +148,106 @@ pub fn create_stacks_new_block( 0, events.len() as u32, StacksTransactionEventPayload::STXTransferEvent(STXTransferEventData { - sender: format!(""), - recipient: format!(""), - amount: format!("1"), + sender: String::new(), + recipient: String::new(), + amount: "1".to_string(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::STXMintEvent(STXMintEventData { - recipient: format!(""), - amount: format!("1"), + recipient: String::new(), + amount: "1".to_string(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::STXBurnEvent(STXBurnEventData { - sender: format!(""), - amount: format!("1"), + sender: String::new(), + amount: "1".to_string(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::STXLockEvent(STXLockEventData { - locked_amount: format!("1"), - unlock_height: format!(""), - locked_address: format!(""), + locked_amount: "1".to_string(), + unlock_height: String::new(), + locked_address: String::new(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::NFTTransferEvent(NFTTransferEventData { - asset_class_identifier: format!(""), - hex_asset_identifier: format!(""), - sender: format!(""), - recipient: format!(""), + asset_class_identifier: String::new(), + hex_asset_identifier: String::new(), + sender: String::new(), + recipient: String::new(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::NFTMintEvent(NFTMintEventData { - asset_class_identifier: format!(""), - hex_asset_identifier: format!(""), - recipient: format!(""), + asset_class_identifier: String::new(), + hex_asset_identifier: String::new(), + recipient: String::new(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::NFTBurnEvent(NFTBurnEventData { - asset_class_identifier: format!(""), - hex_asset_identifier: format!(""), - sender: format!(""), + asset_class_identifier: String::new(), + hex_asset_identifier: String::new(), + sender: String::new(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::FTTransferEvent(FTTransferEventData { - asset_class_identifier: format!(""), - sender: format!(""), - recipient: format!(""), - amount: format!("1"), + asset_class_identifier: String::new(), + sender: String::new(), + recipient: String::new(), + amount: "1".to_string(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::FTMintEvent(FTMintEventData { - asset_class_identifier: format!(""), - recipient: format!(""), - amount: format!("1"), + asset_class_identifier: String::new(), + recipient: String::new(), + amount: "1".to_string(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::FTBurnEvent(FTBurnEventData { - asset_class_identifier: format!(""), - sender: format!(""), - amount: format!("1"), + asset_class_identifier: String::new(), + sender: String::new(), + amount: "1".to_string(), }), )); events.push(create_stacks_new_event( 0, events.len() as u32, StacksTransactionEventPayload::SmartContractEvent(SmartContractEventData { - contract_identifier: format!(""), - topic: format!("print"), - hex_value: format!(""), + contract_identifier: String::new(), + topic: "print".to_string(), + hex_value: String::new(), }), )); NewBlock { block_height: height, block_hash: make_block_hash(fork_id, height), index_block_hash: make_block_hash(fork_id, height), - burn_block_height: burn_block_height, + burn_block_height, burn_block_hash: make_block_hash(0, burn_block_height), parent_block_hash: make_block_hash(parent_fork_id, parent_height), parent_index_block_hash: make_block_hash(parent_fork_id, parent_height), @@ -257,7 +257,7 @@ pub fn create_stacks_new_block( parent_burn_block_hash: make_block_hash(0, parent_burn_block_height), parent_burn_block_height: burn_block_height, parent_burn_block_timestamp: 0, - transactions: (0..4).map(|i| create_stacks_new_transaction(i)).collect(), + transactions: (0..4).map(create_stacks_new_transaction).collect(), events, matured_miner_rewards: vec![], } @@ -271,7 +271,7 @@ fn create_stacks_block_received_record( ) -> Result { let block = create_stacks_new_block(fork_id, height, parent_fork_id, burn_block_height); let serialized_block = serde_json::to_string(&block) - .map_err(|e| format!("failed to serialize stacks block: {}", e.to_string()))?; + .map_err(|e| format!("failed to serialize stacks block: {}", e))?; Ok(Record { id: height, created_at: height.to_string(), @@ -291,7 +291,7 @@ pub fn write_stacks_blocks_to_tsv(block_count: u64, dir: &str) -> Result<(), Str for i in 1..block_count + 1 { writer .serialize(create_stacks_block_received_record(0, i, 0, i + 100)?) - .map_err(|e| format!("failed to write tsv file: {}", e.to_string()))?; + .map_err(|e| format!("failed to write tsv file: {}", e))?; } Ok(()) } @@ -312,13 +312,13 @@ pub async fn mine_stacks_block( .body(serialized_block) .send() .await - .map_err(|e| format!("failed to send new_block request: {}", e.to_string()))? + .map_err(|e| format!("failed to send new_block request: {}", e))? .text() .await .map_err(|e| { format!( "failed to parse response for new_block request: {}", - e.to_string() + e ) })?; Ok(()) @@ -358,7 +358,7 @@ async fn call_increment_chain_tip( .map_err(|e| { format!( "mock bitcoin rpc endpoint increment-chain-tip failed: {}", - e.to_string() + e ) })? .text() @@ -366,7 +366,7 @@ async fn call_increment_chain_tip( .map_err(|e| { format!( "failed to parse response for mock bitcoin rpc increment-chain-tip endpoint: {}", - e.to_string() + e ) })?; assert_eq!(burn_block_height.to_string(), res); @@ -380,7 +380,7 @@ async fn call_new_burn_block( ) -> Result<(), String> { let block = create_new_burn_block(branch, burn_block_height); let serialized_block = serde_json::to_string(&block) - .map_err(|e| format!("failed to serialize burn block: {}", e.to_string()))?; + .map_err(|e| format!("failed to serialize burn block: {}", e))?; let client = reqwest::Client::new(); let _res = client .post(format!( @@ -390,13 +390,13 @@ async fn call_new_burn_block( .body(serialized_block) .send() .await - .map_err(|e| format!("failed to send new_burn_block request: {}", e.to_string()))? + .map_err(|e| format!("failed to send new_burn_block request: {}", e))? .text() .await .map_err(|e| { format!( "failed to parse response for new_burn_block request: {}", - e.to_string() + e ) })?; Ok(()) diff --git a/components/chainhook-cli/src/service/tests/helpers/mod.rs b/components/chainhook-cli/src/service/tests/helpers/mod.rs index 0dd9b9c71..3d3273a7c 100644 --- a/components/chainhook-cli/src/service/tests/helpers/mod.rs +++ b/components/chainhook-cli/src/service/tests/helpers/mod.rs @@ -24,10 +24,10 @@ fn branch_and_height_to_hash_str(branch: Option, height: u64) -> String { pub fn get_free_port() -> Result { let listener = TcpListener::bind("127.0.0.1:0") - .map_err(|e| format!("Failed to bind to port 0: {}", e.to_string()))?; + .map_err(|e| format!("Failed to bind to port 0: {}", e))?; let port = listener .local_addr() - .map_err(|e| format!("failed to parse address: {}", e.to_string()))? + .map_err(|e| format!("failed to parse address: {}", e))? .port(); drop(listener); Ok(port) diff --git a/components/chainhook-cli/src/service/tests/mod.rs b/components/chainhook-cli/src/service/tests/mod.rs index 0ad6d6891..274ece223 100644 --- a/components/chainhook-cli/src/service/tests/mod.rs +++ b/components/chainhook-cli/src/service/tests/mod.rs @@ -61,7 +61,7 @@ async fn test_register_predicate(predicate: JsonValue) -> Result<(), (String, Sh let result = obj.get("result").unwrap().to_string(); Ok((status, result)) } - _ => Err(format!("Register predicate result is not correct type")), + _ => Err("Register predicate result is not correct type".to_string()), } .map_err(|e| (e, moved_shutdown))?; @@ -81,9 +81,7 @@ async fn test_register_predicate(predicate: JsonValue) -> Result<(), (String, Sh .unwrap(); Ok(registered_predicate) } - _ => Err(format!( - "Received wrong observer command for predicate registration" - )), + _ => Err("Received wrong observer command for predicate registration".to_string()), } .map_err(|e| (e, moved_shutdown))?; @@ -356,7 +354,7 @@ async fn await_new_scanning_status_complete( PredicateStatus::New | PredicateStatus::Scanning(_) => { attempts += 1; if attempts == 10 { - return Err(format!("predicate stuck in new/scanning status")); + return Err("predicate stuck in new/scanning status".to_string()); } sleep(Duration::new(1, 0)); } @@ -1009,7 +1007,7 @@ pub fn cleanup_err( } pub fn cleanup(working_dir: &str, redis_port: u16, redis_process: &mut Child) { - let _ = std::fs::remove_dir_all(&working_dir); + let _ = std::fs::remove_dir_all(working_dir); flush_redis(redis_port); redis_process.kill().unwrap(); } diff --git a/components/chainhook-cli/src/service/tests/observer_tests.rs b/components/chainhook-cli/src/service/tests/observer_tests.rs index cfb7699be..f3ebd2009 100644 --- a/components/chainhook-cli/src/service/tests/observer_tests.rs +++ b/components/chainhook-cli/src/service/tests/observer_tests.rs @@ -89,7 +89,7 @@ async fn prometheus_endpoint_returns_encoded_metrics() -> Result<(), String> { .await .map_err(|e| cleanup_err(e, &working_dir, redis_port, &mut redis_process))?; - const EXPECTED: &'static str = "# HELP chainhook_stx_registered_predicates The number of Stacks predicates that have been registered by the Chainhook node.\n# TYPE chainhook_stx_registered_predicates gauge\nchainhook_stx_registered_predicates 1\n"; + const EXPECTED: &str = "# HELP chainhook_stx_registered_predicates The number of Stacks predicates that have been registered by the Chainhook node.\n# TYPE chainhook_stx_registered_predicates gauge\nchainhook_stx_registered_predicates 1\n"; assert!(metrics.contains(EXPECTED)); sleep(Duration::new(1, 0)); @@ -191,13 +191,13 @@ async fn it_responds_200_for_unimplemented_endpoints( let config = EventObserverConfig { registered_chainhooks: ChainhookStore::new(), bitcoin_rpc_proxy_enabled: false, - bitcoind_rpc_username: format!(""), - bitcoind_rpc_password: format!(""), - bitcoind_rpc_url: format!(""), + bitcoind_rpc_username: String::new(), + bitcoind_rpc_password: String::new(), + bitcoind_rpc_url: String::new(), bitcoin_block_signaling: chainhook_sdk::types::BitcoinBlockSignaling::Stacks( StacksNodeConfig { - rpc_url: format!(""), - ingestion_port: ingestion_port, + rpc_url: String::new(), + ingestion_port, }, ), display_stacks_ingestion_logs: false, diff --git a/components/chainhook-cli/src/service/tests/runloop_tests.rs b/components/chainhook-cli/src/service/tests/runloop_tests.rs index b672499d7..43a930464 100644 --- a/components/chainhook-cli/src/service/tests/runloop_tests.rs +++ b/components/chainhook-cli/src/service/tests/runloop_tests.rs @@ -109,7 +109,7 @@ async fn test_stacks_bitcoin_kill_scan() { let _ = hiro_system_kit::thread_named("Bitcoin rpc service") .spawn(move || { let future = mock_bitcoin_rpc(bitcoin_rpc_port, 1_000); - let _ = hiro_system_kit::nestable_block_on(future); + hiro_system_kit::nestable_block_on(future); }) .expect("unable to spawn thread"); diff --git a/components/chainhook-cli/src/storage/mod.rs b/components/chainhook-cli/src/storage/mod.rs index 7e456ca0d..55fa9e8f9 100644 --- a/components/chainhook-cli/src/storage/mod.rs +++ b/components/chainhook-cli/src/storage/mod.rs @@ -60,7 +60,7 @@ pub fn open_readonly_stacks_db_conn_with_retry( } pub fn open_readonly_stacks_db_conn(base_dir: &PathBuf, ctx: &Context) -> Result { - let path = get_default_stacks_db_file_path(&base_dir); + let path = get_default_stacks_db_file_path(base_dir); let opts = get_db_default_options(); match DB::open_for_read_only(&opts, path.clone(), false) { Ok(db) => Ok(db), @@ -68,27 +68,27 @@ pub fn open_readonly_stacks_db_conn(base_dir: &PathBuf, ctx: &Context) -> Result if e.to_string() .contains("IO error: No such file or directory") { - return match open_readwrite_stacks_db_conn(base_dir, ctx) { + match open_readwrite_stacks_db_conn(base_dir, ctx) { Ok(_) => { let db = DB::open_for_read_only(&opts, path, false).map_err(|e| { - format!("unable to open stacks.rocksdb: {}", e.to_string()) + format!("unable to open stacks.rocksdb: {}", e) })?; Ok(db) } Err(e) => Err(e), - }; + } } else { - return Err(format!("unable to open stacks.rocksdb: {}", e.to_string())); + Err(format!("unable to open stacks.rocksdb: {}", e)) } } } } pub fn open_readwrite_stacks_db_conn(base_dir: &PathBuf, _ctx: &Context) -> Result { - let path = get_default_stacks_db_file_path(&base_dir); + let path = get_default_stacks_db_file_path(base_dir); let opts = get_db_default_options(); let db = DB::open(&opts, path) - .map_err(|e| format!("unable to open stacks.rocksdb: {}", e.to_string()))?; + .map_err(|e| format!("unable to open stacks.rocksdb: {}", e))?; Ok(db) } @@ -124,7 +124,7 @@ pub fn insert_entry_in_stacks_blocks( let key = get_block_key(&block.block_identifier); let block_bytes = json!(block); stacks_db_rw - .put(&key, &block_bytes.to_string().as_bytes()) + .put(key, block_bytes.to_string().as_bytes()) .map_err(|e| format!("unable to insert blocks: {}", e))?; let previous_last_inserted = get_last_block_height_inserted(stacks_db_rw, ctx).unwrap_or(0); if block.block_identifier.index > previous_last_inserted { @@ -155,7 +155,7 @@ pub fn insert_unconfirmed_entry_in_stacks_blocks( let key = get_unconfirmed_block_key(&block.block_identifier); let block_bytes = json!(block); stacks_db_rw - .put(&key, &block_bytes.to_string().as_bytes()) + .put(key, block_bytes.to_string().as_bytes()) .map_err(|e| format!("unable to insert blocks: {}", e))?; let previous_last_inserted = get_last_unconfirmed_block_height_inserted(stacks_db_rw, _ctx).unwrap_or(0); @@ -175,9 +175,9 @@ pub fn delete_unconfirmed_entry_from_stacks_blocks( stacks_db_rw: &DB, _ctx: &Context, ) -> Result<(), String> { - let key = get_unconfirmed_block_key(&block_identifier); + let key = get_unconfirmed_block_key(block_identifier); stacks_db_rw - .delete(&key) + .delete(key) .map_err(|e| format!("unable to delete blocks: {}", e)) } @@ -186,21 +186,18 @@ pub fn delete_confirmed_entry_from_stacks_blocks( stacks_db_rw: &DB, _ctx: &Context, ) -> Result<(), String> { - let key = get_block_key(&block_identifier); + let key = get_block_key(block_identifier); stacks_db_rw - .delete(&key) + .delete(key) .map_err(|e| format!("unable to delete blocks: {}", e)) } pub fn get_last_unconfirmed_block_height_inserted(stacks_db: &DB, _ctx: &Context) -> Option { stacks_db .get(get_last_unconfirmed_insert_key()) - .unwrap_or(None) - .and_then(|bytes| { - Some(u64::from_be_bytes([ + .unwrap_or(None).map(|bytes| u64::from_be_bytes([ bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], ])) - }) } pub fn get_all_unconfirmed_blocks( @@ -229,12 +226,9 @@ pub fn get_all_unconfirmed_blocks( pub fn get_last_block_height_inserted(stacks_db: &DB, _ctx: &Context) -> Option { stacks_db .get(get_last_confirmed_insert_key()) - .unwrap_or(None) - .and_then(|bytes| { - Some(u64::from_be_bytes([ + .unwrap_or(None).map(|bytes| u64::from_be_bytes([ bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], ])) - }) } pub fn confirm_entries_in_stacks_blocks( @@ -281,7 +275,7 @@ pub fn get_stacks_block_at_block_height( return Ok(Some({ let spec: StacksBlockData = serde_json::from_slice(&entry[..]).map_err(|e| { - format!("unable to deserialize Stacks block {}", e.to_string()) + format!("unable to deserialize Stacks block {}", e) })?; spec })) diff --git a/components/chainhook-sdk/src/chainhooks/bitcoin/mod.rs b/components/chainhook-sdk/src/chainhooks/bitcoin/mod.rs index 7d49ec127..00253c766 100644 --- a/components/chainhook-sdk/src/chainhooks/bitcoin/mod.rs +++ b/components/chainhook-sdk/src/chainhooks/bitcoin/mod.rs @@ -456,8 +456,8 @@ impl DescriptorMatchingRule { let DescriptorMatchingRule { expression, range } = self; // To derive from descriptors, we need to provide a secp context. let (sig, ver) = (&Secp256k1::signing_only(), &Secp256k1::verification_only()); - let (desc, _) = Descriptor::parse_descriptor(&sig, expression) - .map_err(|e| format!("invalid descriptor: {}", e.to_string()))?; + let (desc, _) = Descriptor::parse_descriptor(sig, expression) + .map_err(|e| format!("invalid descriptor: {}", e))?; // If the descriptor is derivable (`has_wildcard()`), we rely on the `range` field // defined by the predicate OR fallback to a default range of [0,5] when not set. @@ -473,7 +473,7 @@ impl DescriptorMatchingRule { // Derive the addresses and try to match them against the outputs. for i in range[0]..range[1] { let derived = desc - .derived_descriptor(&ver, i) + .derived_descriptor(ver, i) .map_err(|e| format!("error deriving descriptor: {}", e))?; // Extract and encode the derived pubkey. @@ -489,7 +489,7 @@ where D: Deserializer<'de>, { let range: [u32; 2] = Deserialize::deserialize(deserializer)?; - if !(range[0] < range[1]) { + if range[0] >= range[1] { Err(de::Error::custom( "First element of 'range' must be lower than the second element", )) @@ -506,8 +506,8 @@ pub struct BitcoinChainhookOccurrencePayload { } impl BitcoinChainhookOccurrencePayload { - pub fn from_trigger<'a>( - trigger: BitcoinTriggerChainhook<'a>, + pub fn from_trigger( + trigger: BitcoinTriggerChainhook<'_>, ) -> BitcoinChainhookOccurrencePayload { BitcoinChainhookOccurrencePayload { apply: trigger @@ -516,8 +516,7 @@ impl BitcoinChainhookOccurrencePayload { .map(|(transactions, block)| { let mut block = block.clone(); block.transactions = transactions - .into_iter() - .map(|t| t.clone()) + .into_iter().cloned() .collect::>(); BitcoinTransactionPayload { block } }) @@ -528,8 +527,7 @@ impl BitcoinChainhookOccurrencePayload { .map(|(transactions, block)| { let mut block = block.clone(); block.transactions = transactions - .into_iter() - .map(|t| t.clone()) + .into_iter().cloned() .collect::>(); BitcoinTransactionPayload { block } }) @@ -572,11 +570,11 @@ pub fn evaluate_bitcoin_chainhooks_on_chain_event<'a>( if end_block >= block.block_identifier.index { let mut hits = vec![]; for tx in block.transactions.iter() { - if chainhook.predicate.evaluate_transaction_predicate(&tx, ctx) { + if chainhook.predicate.evaluate_transaction_predicate(tx, ctx) { hits.push(tx); } } - if hits.len() > 0 { + if !hits.is_empty() { apply.push((hits, block)); } } else { @@ -603,11 +601,11 @@ pub fn evaluate_bitcoin_chainhooks_on_chain_event<'a>( if end_block >= block.block_identifier.index { let mut hits = vec![]; for tx in block.transactions.iter() { - if chainhook.predicate.evaluate_transaction_predicate(&tx, ctx) { + if chainhook.predicate.evaluate_transaction_predicate(tx, ctx) { hits.push(tx); } } - if hits.len() > 0 { + if !hits.is_empty() { rollback.push((hits, block)); } } else { @@ -619,11 +617,11 @@ pub fn evaluate_bitcoin_chainhooks_on_chain_event<'a>( if end_block >= block.block_identifier.index { let mut hits = vec![]; for tx in block.transactions.iter() { - if chainhook.predicate.evaluate_transaction_predicate(&tx, ctx) { + if chainhook.predicate.evaluate_transaction_predicate(tx, ctx) { hits.push(tx); } } - if hits.len() > 0 { + if !hits.is_empty() { apply.push((hits, block)); } } else { @@ -658,7 +656,7 @@ pub fn serialize_bitcoin_payload_to_json<'a>( "block_identifier": block.block_identifier, "parent_block_identifier": block.parent_block_identifier, "timestamp": block.timestamp, - "transactions": serialize_bitcoin_transactions_to_json(&predicate_spec, &transactions, proofs), + "transactions": serialize_bitcoin_transactions_to_json(predicate_spec, transactions, proofs), "metadata": block.metadata, }) }).collect::>(), @@ -667,7 +665,7 @@ pub fn serialize_bitcoin_payload_to_json<'a>( "block_identifier": block.block_identifier, "parent_block_identifier": block.parent_block_identifier, "timestamp": block.timestamp, - "transactions": serialize_bitcoin_transactions_to_json(&predicate_spec, &transactions, proofs), + "transactions": serialize_bitcoin_transactions_to_json(predicate_spec, transactions, proofs), "metadata": block.metadata, }) }).collect::>(), @@ -679,13 +677,13 @@ pub fn serialize_bitcoin_payload_to_json<'a>( }) } -pub fn serialize_bitcoin_transactions_to_json<'a>( +pub fn serialize_bitcoin_transactions_to_json( predicate_spec: &BitcoinChainhookInstance, transactions: &Vec<&BitcoinTransactionData>, - proofs: &HashMap<&'a TransactionIdentifier, String>, + proofs: &HashMap<&TransactionIdentifier, String>, ) -> Vec { transactions - .into_iter() + .iter() .map(|transaction| { let mut metadata = serde_json::Map::new(); @@ -767,11 +765,11 @@ pub fn handle_bitcoin_hook_action<'a>( HookAction::HttpPost(http) => { let client = Client::builder() .build() - .map_err(|e| format!("unable to build http client: {}", e.to_string()))?; - let host = format!("{}", http.url); + .map_err(|e| format!("unable to build http client: {}", e))?; + let host = http.url.to_string(); let method = Method::POST; let body = serde_json::to_vec(&serialize_bitcoin_payload_to_json(&trigger, proofs)) - .map_err(|e| format!("unable to serialize payload {}", e.to_string()))?; + .map_err(|e| format!("unable to serialize payload {}", e))?; let request = client .request(method, &host) .header("Content-Type", "application/json") @@ -783,7 +781,7 @@ pub fn handle_bitcoin_hook_action<'a>( } HookAction::FileAppend(disk) => { let bytes = serde_json::to_vec(&serialize_bitcoin_payload_to_json(&trigger, proofs)) - .map_err(|e| format!("unable to serialize payload {}", e.to_string()))?; + .map_err(|e| format!("unable to serialize payload {}", e))?; Ok(BitcoinChainhookOccurrence::File( disk.path.to_string(), bytes, @@ -1003,7 +1001,7 @@ impl BitcoinPredicateType { return !tx.metadata.ordinal_operations.is_empty() } OrdinalsMetaProtocol::Brc20 => { - return !tx.metadata.brc20_operation.is_none() + return tx.metadata.brc20_operation.is_some() } } } diff --git a/components/chainhook-sdk/src/chainhooks/bitcoin/tests/hook_spec_validation.rs b/components/chainhook-sdk/src/chainhooks/bitcoin/tests/hook_spec_validation.rs index 33d7861aa..861ca85e6 100644 --- a/components/chainhook-sdk/src/chainhooks/bitcoin/tests/hook_spec_validation.rs +++ b/components/chainhook-sdk/src/chainhooks/bitcoin/tests/hook_spec_validation.rs @@ -148,13 +148,11 @@ fn it_validates_bitcoin_predicates(predicate: &BitcoinPredicateType, expected_er predicate ); } - } else { - if let Some(_) = expected_err { - panic!( - "Missing expected error for predicate validation: {:?}", - predicate - ); - } + } else if expected_err.is_some() { + panic!( + "Missing expected error for predicate validation: {:?}", + predicate + ); } } @@ -172,13 +170,11 @@ fn it_validates_hook_actions(action: &HookAction, expected_err: Option {} StacksPredicate::StxEvent(_) => {} StacksPredicate::Txid(ExactMatchingRule::Equals(txid)) => { - if let Err(e) = validate_txid(&txid) { + if let Err(e) = validate_txid(txid) { return Err(append_error_context( "invalid predicate for scope 'txid'", vec![e], @@ -318,8 +318,8 @@ pub struct StacksContractCallBasedPredicate { } fn validate_contract_identifier(id: &String) -> Result<(), String> { - if let Err(e) = QualifiedContractIdentifier::parse(&id) { - return Err(format!("invalid contract identifier: {}", e.to_string())); + if let Err(e) = QualifiedContractIdentifier::parse(id) { + return Err(format!("invalid contract identifier: {}", e)); } Ok(()) } @@ -355,7 +355,7 @@ impl StacksContractDeploymentPredicate { match self { StacksContractDeploymentPredicate::Deployer(deployer) => { if !deployer.eq("*") { - if let Err(e) = PrincipalData::parse_standard_principal(&deployer) { + if let Err(e) = PrincipalData::parse_standard_principal(deployer) { return Err(format!( "contract deployer must be a valid Stacks address: {}", e @@ -402,7 +402,7 @@ impl StacksPrintEventBasedPredicate { .. } => { if !contract_identifier.eq("*") { - if let Err(e) = validate_contract_identifier(&contract_identifier) { + if let Err(e) = validate_contract_identifier(contract_identifier) { errors.push(e); } } @@ -412,12 +412,12 @@ impl StacksPrintEventBasedPredicate { regex, } => { if !contract_identifier.eq("*") { - if let Err(e) = validate_contract_identifier(&contract_identifier) { + if let Err(e) = validate_contract_identifier(contract_identifier) { errors.push(e); } } if let Err(e) = Regex::new(regex) { - errors.push(format!("invalid regex: {}", e.to_string())) + errors.push(format!("invalid regex: {}", e)) } } } @@ -482,8 +482,8 @@ pub struct StacksChainhookOccurrencePayload { } impl StacksChainhookOccurrencePayload { - pub fn from_trigger<'a>( - trigger: StacksTriggerChainhook<'a>, + pub fn from_trigger( + trigger: StacksTriggerChainhook<'_>, ) -> StacksChainhookOccurrencePayload { StacksChainhookOccurrencePayload { apply: trigger @@ -491,8 +491,7 @@ impl StacksChainhookOccurrencePayload { .into_iter() .map(|(transactions, block)| { let transactions = transactions - .into_iter() - .map(|t| t.clone()) + .into_iter().cloned() .collect::>(); StacksApplyTransactionPayload { block_identifier: block.get_identifier().clone(), @@ -505,8 +504,7 @@ impl StacksChainhookOccurrencePayload { .into_iter() .map(|(transactions, block)| { let transactions = transactions - .into_iter() - .map(|t| t.clone()) + .into_iter().cloned() .collect::>(); StacksRollbackTransactionPayload { block_identifier: block.get_identifier().clone(), @@ -757,7 +755,7 @@ pub fn evaluate_stacks_chainhook_on_blocks<'a>( } } } - if hits.len() > 0 { + if !hits.is_empty() { occurrences.push((hits, block)); } } else { @@ -817,19 +815,17 @@ pub fn evaluate_stacks_predicate_on_transaction<'a>( }, StacksPredicate::ContractDeployment(StacksContractDeploymentPredicate::ImplementTrait( stacks_trait, - )) => match stacks_trait { - _ => match &transaction.metadata.kind { - StacksTransactionKind::ContractDeployment(_actual_deployment) => { - ctx.try_log(|logger| { - slog::warn!( - logger, - "StacksContractDeploymentPredicate::ImplementTrait uninmplemented" - ) - }); - false - } - _ => false, - }, + )) => match &transaction.metadata.kind { + StacksTransactionKind::ContractDeployment(_actual_deployment) => { + ctx.try_log(|logger| { + slog::warn!( + logger, + "StacksContractDeploymentPredicate::ImplementTrait uninmplemented" + ) + }); + false + } + _ => false, }, StacksPredicate::ContractCall(expected_contract_call) => match &transaction.metadata.kind { StacksTransactionKind::ContractCall(actual_contract_call) => { @@ -951,55 +947,52 @@ pub fn evaluate_stacks_predicate_on_transaction<'a>( } StacksPredicate::PrintEvent(expected_event) => { for event in transaction.metadata.receipt.events.iter() { - match &event.event_payload { - StacksTransactionEventPayload::SmartContractEvent(actual) => { - if actual.topic == "print" { - match expected_event { - StacksPrintEventBasedPredicate::Contains { - contract_identifier, - contains, - } => { - if contract_identifier == &actual.contract_identifier - || contract_identifier == "*" - { - if contains == "*" { - return true; - } + if let StacksTransactionEventPayload::SmartContractEvent(actual) = &event.event_payload { + if actual.topic == "print" { + match expected_event { + StacksPrintEventBasedPredicate::Contains { + contract_identifier, + contains, + } => { + if contract_identifier == &actual.contract_identifier + || contract_identifier == "*" + { + if contains == "*" { + return true; + } + let value = format!( + "{}", + expect_decoded_clarity_value(&actual.hex_value) + ); + if value.contains(contains) { + return true; + } + } + } + StacksPrintEventBasedPredicate::MatchesRegex { + contract_identifier, + regex, + } => { + if contract_identifier == &actual.contract_identifier + || contract_identifier == "*" + { + if let Ok(regex) = Regex::new(regex) { let value = format!( "{}", expect_decoded_clarity_value(&actual.hex_value) ); - if value.contains(contains) { + if regex.is_match(&value) { return true; } - } - } - StacksPrintEventBasedPredicate::MatchesRegex { - contract_identifier, - regex, - } => { - if contract_identifier == &actual.contract_identifier - || contract_identifier == "*" - { - if let Ok(regex) = Regex::new(regex) { - let value = format!( - "{}", - expect_decoded_clarity_value(&actual.hex_value) - ); - if regex.is_match(&value) { - return true; - } - } else { - ctx.try_log(|logger| { - slog::error!(logger, "unable to parse print_event matching rule as regex") - }); - } + } else { + ctx.try_log(|logger| { + slog::error!(logger, "unable to parse print_event matching rule as regex") + }); } } } } } - _ => {} } } false @@ -1023,7 +1016,7 @@ fn serialize_stacks_block( "parent_block_identifier": block.get_parent_identifier(), "timestamp": block.get_timestamp(), "transactions": transactions.into_iter().map(|transaction| { - serialize_stacks_transaction(&transaction, decode_clarity_values, include_contract_abi, ctx) + serialize_stacks_transaction(transaction, decode_clarity_values, include_contract_abi, ctx) }).collect::>(), "metadata": block.get_serialized_metadata(), }) @@ -1227,7 +1220,7 @@ pub fn expect_decoded_clarity_value(hex_value: &str) -> ClarityValue { pub fn try_decode_clarity_value(hex_value: &str) -> Option { let hex_value = hex_value.strip_prefix("0x")?; - let value_bytes = hex::decode(&hex_value).ok()?; + let value_bytes = hex::decode(hex_value).ok()?; ClarityValue::consensus_deserialize(&mut Cursor::new(&value_bytes)).ok() } @@ -1236,20 +1229,20 @@ pub fn serialized_decoded_clarity_value(hex_value: &str, ctx: &Context) -> serde Some(hex_value) => hex_value, _ => return json!(hex_value.to_string()), }; - let value_bytes = match hex::decode(&hex_value) { + let value_bytes = match hex::decode(hex_value) { Ok(bytes) => bytes, _ => return json!(hex_value.to_string()), }; - let value = match ClarityValue::consensus_deserialize(&mut Cursor::new(&value_bytes)) { + + match ClarityValue::consensus_deserialize(&mut Cursor::new(&value_bytes)) { Ok(value) => serialize_to_json(&value), Err(e) => { ctx.try_log(|logger| { slog::error!(logger, "unable to deserialize clarity value {:?}", e) }); - return json!(hex_value.to_string()); + json!(hex_value.to_string()) } - }; - value + } } pub fn serialize_to_json(value: &ClarityValue) -> serde_json::Value { @@ -1277,13 +1270,13 @@ pub fn serialize_to_json(value: &ClarityValue) -> serde_json::Value { } ClarityValue::Optional(opt_data) => match &opt_data.data { None => serde_json::Value::Null, - Some(value) => serialize_to_json(&*value), + Some(value) => serialize_to_json(value), }, ClarityValue::Response(res_data) => { json!({ "result": { "success": res_data.committed, - "value": serialize_to_json(&*res_data.data), + "value": serialize_to_json(&res_data.data), } }) } @@ -1338,15 +1331,15 @@ pub fn handle_stacks_hook_action<'a>( HookAction::HttpPost(http) => { let client = Client::builder() .build() - .map_err(|e| format!("unable to build http client: {}", e.to_string()))?; - let host = format!("{}", http.url); + .map_err(|e| format!("unable to build http client: {}", e))?; + let host = http.url.to_string(); let method = Method::POST; let body = serde_json::to_vec(&serialize_stacks_payload_to_json( trigger.clone(), proofs, ctx, )) - .map_err(|e| format!("unable to serialize payload {}", e.to_string()))?; + .map_err(|e| format!("unable to serialize payload {}", e))?; Ok(StacksChainhookOccurrence::Http( client .request(method, &host) @@ -1358,7 +1351,7 @@ pub fn handle_stacks_hook_action<'a>( } HookAction::FileAppend(disk) => { let bytes = serde_json::to_vec(&serialize_stacks_payload_to_json(trigger, proofs, ctx)) - .map_err(|e| format!("unable to serialize payload {}", e.to_string()))?; + .map_err(|e| format!("unable to serialize payload {}", e))?; Ok(StacksChainhookOccurrence::File( disk.path.to_string(), bytes, diff --git a/components/chainhook-sdk/src/chainhooks/stacks/tests/hook_spec_validation.rs b/components/chainhook-sdk/src/chainhooks/stacks/tests/hook_spec_validation.rs index b541e0e7a..e0ea08259 100644 --- a/components/chainhook-sdk/src/chainhooks/stacks/tests/hook_spec_validation.rs +++ b/components/chainhook-sdk/src/chainhooks/stacks/tests/hook_spec_validation.rs @@ -184,13 +184,11 @@ fn it_validates_stacks_predicates(predicate: &StacksPredicate, expected_err: Opt } else { panic!("Unexpected error in predicate validation: {:?}", predicate); } - } else { - if let Some(_) = expected_err { - panic!( - "Missing expected error for predicate validation: {:?}", - predicate - ); - } + } else if expected_err.is_some() { + panic!( + "Missing expected error for predicate validation: {:?}", + predicate + ); } } diff --git a/components/chainhook-sdk/src/chainhooks/tests/mod.rs b/components/chainhook-sdk/src/chainhooks/tests/mod.rs index a503d9340..00fa5d6bf 100644 --- a/components/chainhook-sdk/src/chainhooks/tests/mod.rs +++ b/components/chainhook-sdk/src/chainhooks/tests/mod.rs @@ -400,7 +400,7 @@ fn test_stacks_predicates( capture_all_events: None, decode_clarity_values: None, include_contract_abi: None, - predicate: predicate, + predicate, action: HookAction::Noop, enabled: true, expired_at: None, @@ -480,7 +480,7 @@ fn test_stacks_predicate_contract_deploy(predicate: StacksPredicate, expected_ap capture_all_events: None, decode_clarity_values: None, include_contract_abi: None, - predicate: predicate, + predicate, action: HookAction::Noop, enabled: true, expired_at: None, @@ -492,7 +492,7 @@ fn test_stacks_predicate_contract_deploy(predicate: StacksPredicate, expected_ap if expected_applies == 0 { assert_eq!(triggered.len(), 0) - } else if triggered.len() == 0 { + } else if triggered.is_empty() { panic!("expected more than one block to be applied, but no predicates were triggered") } else { let actual_applies: u64 = triggered[0].apply.len().try_into().unwrap(); @@ -674,7 +674,7 @@ fn test_stacks_predicate_contract_call(predicate: StacksPredicate, expected_appl capture_all_events: None, decode_clarity_values: None, include_contract_abi: None, - predicate: predicate, + predicate, action: HookAction::Noop, enabled: true, expired_at: None, @@ -686,7 +686,7 @@ fn test_stacks_predicate_contract_call(predicate: StacksPredicate, expected_appl if expected_applies == 0 { assert_eq!(triggered.len(), 0) - } else if triggered.len() == 0 { + } else if triggered.is_empty() { panic!("expected more than one block to be applied, but no predicates were triggered") } else { let actual_applies: u64 = triggered[0].apply.len().try_into().unwrap(); @@ -718,11 +718,11 @@ fn test_stacks_hook_action_noop() { }; let apply_block_data = fixtures::build_stacks_testnet_block_with_contract_call(); - let apply_transactions = apply_block_data.transactions.iter().map(|t| t).collect(); + let apply_transactions = apply_block_data.transactions.iter().collect(); let apply_blocks: &dyn AbstractStacksBlock = &apply_block_data; let rollback_block_data = fixtures::build_stacks_testnet_block_with_contract_deployment(); - let rollback_transactions = rollback_block_data.transactions.iter().map(|t| t).collect(); + let rollback_transactions = rollback_block_data.transactions.iter().collect(); let rollback_blocks: &dyn AbstractStacksBlock = &apply_block_data; let trigger = StacksTriggerChainhook { chainhook: &chainhook, @@ -792,18 +792,18 @@ fn test_stacks_hook_action_file_append() { .iter() .map(|b| { ( - b.transactions.iter().map(|t| t).collect(), + b.transactions.iter().collect(), b as &dyn AbstractStacksBlock, ) }) .collect(); let rollback_block_data = fixtures::build_stacks_testnet_block_with_contract_deployment(); - let rollback_transactions = rollback_block_data.transactions.iter().map(|t| t).collect(); + let rollback_transactions = rollback_block_data.transactions.iter().collect(); let rollback_block: &dyn AbstractStacksBlock = &rollback_block_data; let trigger = StacksTriggerChainhook { chainhook: &chainhook, - apply: apply, + apply, rollback: vec![(rollback_transactions, rollback_block)], }; diff --git a/components/chainhook-sdk/src/chainhooks/types.rs b/components/chainhook-sdk/src/chainhooks/types.rs index ea3a0bdb2..c925a8da0 100644 --- a/components/chainhook-sdk/src/chainhooks/types.rs +++ b/components/chainhook-sdk/src/chainhooks/types.rs @@ -17,6 +17,12 @@ pub struct ChainhookStore { pub bitcoin_chainhooks: Vec, } +impl Default for ChainhookStore { + fn default() -> Self { + Self::new() + } +} + impl ChainhookStore { pub fn new() -> ChainhookStore { ChainhookStore { @@ -183,7 +189,7 @@ impl ChainhookInstance { pub fn deserialize_specification(spec: &str) -> Result { let spec: ChainhookInstance = serde_json::from_str(spec) - .map_err(|e| format!("unable to deserialize predicate {}", e.to_string()))?; + .map_err(|e| format!("unable to deserialize predicate {}", e))?; Ok(spec) } @@ -255,7 +261,7 @@ impl ChainhookSpecificationNetworkMap { _key: &str, ) -> Result { let spec: ChainhookSpecificationNetworkMap = serde_json::from_str(spec) - .map_err(|e| format!("unable to deserialize predicate {}", e.to_string()))?; + .map_err(|e| format!("unable to deserialize predicate {}", e))?; Ok(spec) } } @@ -294,12 +300,12 @@ impl HttpHook { pub fn validate(&self) -> Result<(), Vec> { let mut errors = vec![]; if let Err(e) = reqwest::Url::from_str(&self.url) { - errors.push(format!("url string must be a valid Url: {}", e.to_string())); + errors.push(format!("url string must be a valid Url: {}", e)); } if let Err(e) = reqwest::header::HeaderValue::from_str(&self.authorization_header) { errors.push(format!( "auth header must be a valid header value: {}", - e.to_string() + e )); }; @@ -436,11 +442,11 @@ pub fn get_canonical_pox_config(network: &BitcoinNetwork) -> PoxConfig { #[derive(Debug, Clone, PartialEq)] #[repr(u8)] pub enum StacksOpcodes { - BlockCommit = '[' as u8, - KeyRegister = '^' as u8, - StackStx = 'x' as u8, - PreStx = 'p' as u8, - TransferStx = '$' as u8, + BlockCommit = b'[', + KeyRegister = b'^', + StackStx = b'x', + PreStx = b'p', + TransferStx = b'$', } impl TryFrom for StacksOpcodes { @@ -1061,7 +1067,7 @@ pub fn append_error_context(context: &str, errors: Vec) -> Vec { } pub fn is_hex(s: &str) -> bool { - s.chars().all(|c| c.is_digit(16)) + s.chars().all(|c| c.is_ascii_hexdigit()) } pub fn validate_txid(txid: &String) -> Result<(), String> { diff --git a/components/chainhook-sdk/src/indexer/bitcoin/mod.rs b/components/chainhook-sdk/src/indexer/bitcoin/mod.rs index 141032d0a..0deba45fa 100644 --- a/components/chainhook-sdk/src/indexer/bitcoin/mod.rs +++ b/components/chainhook-sdk/src/indexer/bitcoin/mod.rs @@ -38,15 +38,15 @@ pub struct BitcoinBlockFullBreakdown { impl BitcoinBlockFullBreakdown { pub fn get_block_header(&self) -> BlockHeader { // Block id - let hash = format!("0x{}", self.hash.to_string()); + let hash = format!("0x{}", self.hash); let block_identifier = BlockIdentifier { index: self.height as u64, - hash: hash, + hash, }; // Parent block id let parent_block_hash = match self.previousblockhash { Some(ref value) => format!("0x{}", value), - None => format!("0x{}", BlockHash::all_zeros().to_string()), + None => format!("0x{}", BlockHash::all_zeros()), }; let parent_block_identifier = BlockIdentifier { index: (self.height - 1) as u64, @@ -349,8 +349,8 @@ pub fn standardize_bitcoin_block( ) -> Result { let mut transactions = vec![]; let block_height = block.height as u64; - let expected_magic_bytes = get_stacks_canonical_magic_bytes(&network); - let pox_config = get_canonical_pox_config(&network); + let expected_magic_bytes = get_stacks_canonical_magic_bytes(network); + let pox_config = get_canonical_pox_config(network); ctx.try_log(|logger| slog::debug!(logger, "Standardizing Bitcoin block {}", block.hash,)); @@ -525,7 +525,7 @@ fn try_parse_stacks_operation( StacksBaseChainOperation::LeaderRegistered(res) } StacksOpcodes::PreStx => { - let _ = try_parse_pre_stx_op(&op_return_output[6..])?; + try_parse_pre_stx_op(&op_return_output[6..])?; return None; } StacksOpcodes::TransferStx => { @@ -543,28 +543,28 @@ fn try_parse_stacks_operation( let output_1 = outputs .get(1) - .ok_or(format!("expected output 1 not found")) + .ok_or("expected output 1 not found".to_string()) .ok()?; let script_1 = output_1 .script_pub_key .script() - .map_err(|_e| format!("expected output 1 corrupted")) + .map_err(|_e| "expected output 1 corrupted".to_string()) .ok()?; let address_1 = Address::from_script(&script_1, bitcoin::Network::Bitcoin) - .map_err(|_e| format!("expected output 1 corrupted")) + .map_err(|_e| "expected output 1 corrupted".to_string()) .ok()?; let output_2 = outputs .get(2) - .ok_or(format!("expected output 2 not found")) + .ok_or("expected output 2 not found".to_string()) .ok()?; let script_2 = output_2 .script_pub_key .script() - .map_err(|_e| format!("expected output 2 corrupted")) + .map_err(|_e| "expected output 2 corrupted".to_string()) .ok()?; let address_2 = Address::from_script(&script_2, bitcoin::Network::Bitcoin) - .map_err(|_e| format!("expected output 2 corrupted")) + .map_err(|_e| "expected output 2 corrupted".to_string()) .ok()?; let output_1_is_burn = address_1.to_string().eq(pox_config.get_burn_address()); @@ -627,8 +627,7 @@ fn try_parse_stacks_operation( if let Some(mining_post_commit) = outputs.get(mining_output_index) { mining_sats_left = mining_post_commit.value.to_sat(); mining_address_post_commit = match mining_post_commit.script_pub_key.script() { - Ok(script) => Address::from_script(&script, bitcoin::Network::Bitcoin) - .and_then(|a| Ok(a.to_string())) + Ok(script) => Address::from_script(&script, bitcoin::Network::Bitcoin).map(|a| a.to_string()) .ok(), Err(_) => None, }; diff --git a/components/chainhook-sdk/src/indexer/fork_scratch_pad.rs b/components/chainhook-sdk/src/indexer/fork_scratch_pad.rs index 6e56b2817..d95c3a984 100644 --- a/components/chainhook-sdk/src/indexer/fork_scratch_pad.rs +++ b/components/chainhook-sdk/src/indexer/fork_scratch_pad.rs @@ -16,6 +16,12 @@ pub struct ForkScratchPad { headers_store: BTreeMap, } pub const CONFIRMED_SEGMENT_MINIMUM_LENGTH: i32 = 7; +impl Default for ForkScratchPad { + fn default() -> Self { + Self::new() + } +} + impl ForkScratchPad { pub fn new() -> ForkScratchPad { let mut forks = BTreeMap::new(); @@ -222,7 +228,7 @@ impl ForkScratchPad { // [1] ... [6] [7] let canonical_segment = { let mut segment = vec![]; - while let Some(ancestor) = self.headers_store.get(&ancestor_identifier) { + while let Some(ancestor) = self.headers_store.get(ancestor_identifier) { ancestor_identifier = &ancestor.parent_block_identifier; segment.push(ancestor.block_identifier.clone()); } @@ -237,7 +243,7 @@ impl ForkScratchPad { // Prune forks using the confirmed block let mut blocks_to_prune = vec![]; for (fork_id, fork) in self.forks.iter_mut() { - let mut res = fork.prune_confirmed_blocks(&cut_off); + let mut res = fork.prune_confirmed_blocks(cut_off); blocks_to_prune.append(&mut res); if fork.block_ids.is_empty() { forks_to_prune.push(*fork_id); @@ -260,7 +266,7 @@ impl ForkScratchPad { canonical_segment[6..].len() ) }); - for confirmed_block in canonical_segment[6..].into_iter() { + for confirmed_block in canonical_segment[6..].iter() { let block = match self.headers_store.remove(confirmed_block) { None => { ctx.try_log(|logger| { diff --git a/components/chainhook-sdk/src/indexer/mod.rs b/components/chainhook-sdk/src/indexer/mod.rs index 2a3195115..737f044a8 100644 --- a/components/chainhook-sdk/src/indexer/mod.rs +++ b/components/chainhook-sdk/src/indexer/mod.rs @@ -45,6 +45,12 @@ impl StacksChainContext { pub struct BitcoinChainContext {} +impl Default for BitcoinChainContext { + fn default() -> Self { + Self::new() + } +} + impl BitcoinChainContext { pub fn new() -> BitcoinChainContext { BitcoinChainContext {} @@ -103,8 +109,8 @@ impl Indexer { header: BlockHeader, ctx: &Context, ) -> Result, String> { - let event = self.bitcoin_blocks_pool.process_header(header, ctx); - event + + self.bitcoin_blocks_pool.process_header(header, ctx) } pub fn standardize_stacks_marshalled_block( @@ -185,6 +191,12 @@ pub struct ChainSegmentDivergence { block_ids_to_rollback: Vec, } +impl Default for ChainSegment { + fn default() -> Self { + Self::new() + } +} + impl ChainSegment { pub fn new() -> ChainSegment { let block_ids = VecDeque::new(); @@ -199,7 +211,7 @@ impl ChainSegment { if let Some(tip) = self.block_ids.front() { return block_identifier.index > (tip.index + 1); } - return false; + false } fn get_relative_index(&self, block_identifier: &BlockIdentifier) -> usize { @@ -207,7 +219,7 @@ impl ChainSegment { let segment_index = tip.index.saturating_sub(block_identifier.index); return segment_index.try_into().unwrap(); } - return 0; + 0 } fn can_append_block( @@ -215,7 +227,7 @@ impl ChainSegment { block: &dyn AbstractBlock, ctx: &Context, ) -> Result<(), ChainSegmentIncompatibility> { - if self.is_block_id_newer_than_segment(&block.get_identifier()) { + if self.is_block_id_newer_than_segment(block.get_identifier()) { // Chain segment looks outdated, we should just prune it? return Err(ChainSegmentIncompatibility::OutdatedSegment); } @@ -232,8 +244,8 @@ impl ChainSegment { false => return Err(ChainSegmentIncompatibility::ParentBlockUnknown), } } - if let Some(colliding_block) = self.get_block_id(&block.get_identifier(), ctx) { - match colliding_block.eq(&block.get_identifier()) { + if let Some(colliding_block) = self.get_block_id(block.get_identifier(), ctx) { + match colliding_block.eq(block.get_identifier()) { true => return Err(ChainSegmentIncompatibility::AlreadyPresent), false => return Err(ChainSegmentIncompatibility::BlockCollision), } @@ -285,7 +297,7 @@ impl ChainSegment { loop { match self.block_ids.pop_front() { Some(tip) => { - if tip.eq(&block_identifier) { + if tip.eq(block_identifier) { self.block_ids.push_front(tip); break (true, mutated); } @@ -354,7 +366,7 @@ impl ChainSegment { }); match self.can_append_block(block, ctx) { Ok(()) => { - self.append_block_identifier(&block.get_identifier()); + self.append_block_identifier(block.get_identifier()); block_appended = true; } Err(incompatibility) => { @@ -366,11 +378,11 @@ impl ChainSegment { let mut new_fork = self.clone(); let (parent_found, _) = new_fork .keep_blocks_from_oldest_to_block_identifier( - &block.get_parent_identifier(), + block.get_parent_identifier(), ); if parent_found { ctx.try_log(|logger| slog::info!(logger, "Success")); - new_fork.append_block_identifier(&block.get_identifier()); + new_fork.append_block_identifier(block.get_identifier()); fork = Some(new_fork); block_appended = true; } diff --git a/components/chainhook-sdk/src/indexer/stacks/blocks_pool.rs b/components/chainhook-sdk/src/indexer/stacks/blocks_pool.rs index 025e50795..56dac755c 100644 --- a/components/chainhook-sdk/src/indexer/stacks/blocks_pool.rs +++ b/components/chainhook-sdk/src/indexer/stacks/blocks_pool.rs @@ -26,6 +26,12 @@ pub struct StacksBlockPool { canonical_micro_fork_id: HashMap, } +impl Default for StacksBlockPool { + fn default() -> Self { + Self::new() + } +} + impl StacksBlockPool { pub fn new() -> StacksBlockPool { let mut forks = BTreeMap::new(); @@ -317,7 +323,7 @@ impl StacksBlockPool { // [7] ... [2] [1] let canonical_segment = { let mut segment = vec![]; - while let Some(ancestor) = self.block_store.get(&ancestor_identifier) { + while let Some(ancestor) = self.block_store.get(ancestor_identifier) { ancestor_identifier = &ancestor.parent_block_identifier; segment.push(ancestor.block_identifier.clone()); } @@ -334,7 +340,7 @@ impl StacksBlockPool { // Prune forks using the confirmed block let mut blocks_to_prune = vec![]; for (fork_id, fork) in self.forks.iter_mut() { - let mut res = fork.prune_confirmed_blocks(&cut_off); + let mut res = fork.prune_confirmed_blocks(cut_off); blocks_to_prune.append(&mut res); if fork.block_ids.is_empty() { forks_to_prune.push(*fork_id); @@ -478,7 +484,7 @@ impl StacksBlockPool { ) }); let mut microfork = ChainSegment::new(); - microfork.append_block_identifier(&µblock.block_identifier); + microfork.append_block_identifier(µblock.block_identifier); match self .micro_forks @@ -493,42 +499,40 @@ impl StacksBlockPool { .micro_forks .get_mut(µblock.metadata.anchor_block_identifier) .and_then(|microfork| microfork.last_mut()) - } else { - if let Some(microforks) = self - .micro_forks - .get_mut(µblock.metadata.anchor_block_identifier) - { - for micro_fork in microforks.iter_mut() { - let (block_appended, mut new_micro_fork) = - micro_fork.try_append_block(µblock, ctx); - if block_appended { - ctx.try_log(|logger| { - slog::info!(logger, - "Attempt to append micro fork {} with {} (parent = {}) succeeded", + } else if let Some(microforks) = self + .micro_forks + .get_mut(µblock.metadata.anchor_block_identifier) + { + for micro_fork in microforks.iter_mut() { + let (block_appended, mut new_micro_fork) = + micro_fork.try_append_block(µblock, ctx); + if block_appended { + ctx.try_log(|logger| { + slog::info!(logger, + "Attempt to append micro fork {} with {} (parent = {}) succeeded", + micro_fork, + microblock.block_identifier, + microblock.parent_block_identifier + ) + }); + if let Some(new_micro_fork) = new_micro_fork.take() { + microforks.push(new_micro_fork); + micro_fork_updated = microforks.last_mut(); + } else { + micro_fork_updated = Some(micro_fork); + } + // A block can only be added to one segment + break; + } else { + ctx.try_log(|logger| { + slog::error!( + logger, + "Attempt to append micro fork {} with {} (parent = {}) failed", micro_fork, microblock.block_identifier, microblock.parent_block_identifier ) - }); - if let Some(new_micro_fork) = new_micro_fork.take() { - microforks.push(new_micro_fork); - micro_fork_updated = microforks.last_mut(); - } else { - micro_fork_updated = Some(micro_fork); - } - // A block can only be added to one segment - break; - } else { - ctx.try_log(|logger| { - slog::error!( - logger, - "Attempt to append micro fork {} with {} (parent = {}) failed", - micro_fork, - microblock.block_identifier, - microblock.parent_block_identifier - ) - }); - } + }); } } } @@ -690,22 +694,18 @@ impl StacksBlockPool { self.micro_forks.get(&block.parent_block_identifier), ) { (Some(last_microblock), Some(microforks)) => { - let previous_canonical_segment = match self + let previous_canonical_segment = self .canonical_micro_fork_id - .get(&block.parent_block_identifier) - { - Some(id) => Some(microforks[*id].clone()), - None => None, - }; + .get(&block.parent_block_identifier).map(|id| microforks[*id].clone()); let mut new_canonical_segment = None; for (microfork_id, microfork) in microforks.iter().enumerate() { self.canonical_micro_fork_id .insert(block.parent_block_identifier.clone(), microfork_id); - if microfork.block_ids.contains(&last_microblock) { + if microfork.block_ids.contains(last_microblock) { let mut confirmed_microblocks = microfork.clone(); let (_, mutated) = confirmed_microblocks - .keep_blocks_from_oldest_to_block_identifier(&last_microblock); + .keep_blocks_from_oldest_to_block_identifier(last_microblock); new_canonical_segment = Some(( confirmed_microblocks, if mutated { @@ -1035,7 +1035,7 @@ impl StacksBlockPool { } }; - if new_canonical_segment.eq(&previous_canonical_segment) { + if new_canonical_segment.eq(previous_canonical_segment) { return Ok(None); } diff --git a/components/chainhook-sdk/src/indexer/stacks/mod.rs b/components/chainhook-sdk/src/indexer/stacks/mod.rs index 88b3648c6..25b80c7d1 100644 --- a/components/chainhook-sdk/src/indexer/stacks/mod.rs +++ b/components/chainhook-sdk/src/indexer/stacks/mod.rs @@ -255,7 +255,7 @@ impl NewEvent { }, }); } - return Err(format!("unable to support event type")); + Err("unable to support event type".to_string()) } } @@ -277,11 +277,11 @@ pub fn standardize_stacks_serialized_block_header( serialized_block: &str, ) -> Result<(BlockIdentifier, BlockIdentifier), String> { let mut block_header: NewBlockHeader = serde_json::from_str(serialized_block) - .map_err(|e| format!("unable to parse stacks block_header {}", e.to_string()))?; + .map_err(|e| format!("unable to parse stacks block_header {}", e))?; let hash = block_header .index_block_hash .take() - .ok_or(format!("unable to retrieve index_block_hash"))?; + .ok_or("unable to retrieve index_block_hash".to_string())?; let block_identifier = BlockIdentifier { hash, index: block_header.block_height, @@ -289,7 +289,7 @@ pub fn standardize_stacks_serialized_block_header( let parent_hash = block_header .parent_index_block_hash .take() - .ok_or(format!("unable to retrieve parent_index_block_hash"))?; + .ok_or("unable to retrieve parent_index_block_hash".to_string())?; let parent_height = block_identifier.index.saturating_sub(1); let parent_block_identifier = BlockIdentifier { @@ -306,7 +306,7 @@ pub fn standardize_stacks_serialized_block( ctx: &Context, ) -> Result { let mut block: NewBlock = serde_json::from_str(serialized_block) - .map_err(|e| format!("unable to parse stacks block_header {}", e.to_string()))?; + .map_err(|e| format!("unable to parse stacks block_header {}", e))?; standardize_stacks_block(indexer_config, &mut block, chain_ctx, ctx) } @@ -317,7 +317,7 @@ pub fn standardize_stacks_marshalled_block( ctx: &Context, ) -> Result { let mut block: NewBlock = serde_json::from_value(marshalled_block) - .map_err(|e| format!("unable to parse stacks block {}", e.to_string()))?; + .map_err(|e| format!("unable to parse stacks block {}", e))?; standardize_stacks_block(indexer_config, &mut block, chain_ctx, ctx) } @@ -327,23 +327,23 @@ pub fn standardize_stacks_block( chain_ctx: &mut StacksChainContext, ctx: &Context, ) -> Result { - let pox_cycle_length: u64 = (chain_ctx.pox_config.get_pox_cycle_len()).into(); + let pox_cycle_length: u64 = chain_ctx.pox_config.get_pox_cycle_len(); let current_len = u64::saturating_sub( block.burn_block_height, - 1 + (chain_ctx.pox_config.first_burnchain_block_height as u64), + 1 + chain_ctx.pox_config.first_burnchain_block_height, ); let pox_cycle_id: u32 = (current_len / pox_cycle_length).try_into().unwrap_or(0); let mut events: HashMap<&String, Vec<&NewEvent>> = HashMap::new(); for event in block.events.iter() { events .entry(&event.txid) - .and_modify(|events| events.push(&event)) + .and_modify(|events| events.push(event)) .or_insert(vec![&event]); } let mut transactions = vec![]; for tx in block.transactions.iter() { - let tx_events = events.remove(&tx.txid).unwrap_or(vec![]); + let tx_events = events.remove(&tx.txid).unwrap_or_default(); let (description, tx_type, fee, nonce, sender, sponsor) = match get_tx_description(&tx.raw_tx, &tx_events) { Ok(desc) => desc, @@ -355,7 +355,7 @@ pub fn standardize_stacks_block( return Err(format!( "unable to standardize block #{} ({})", block.block_height, - e.to_string() + e )); } }; @@ -446,7 +446,7 @@ pub fn standardize_stacks_serialized_microblock_trail( ) -> Result, String> { let mut microblock_trail: NewMicroblockTrail = serde_json::from_str(serialized_microblock_trail) - .map_err(|e| format!("unable to parse microblock trail {}", e.to_string()))?; + .map_err(|e| format!("unable to parse microblock trail {}", e))?; standardize_stacks_microblock_trail(indexer_config, &mut microblock_trail, chain_ctx, ctx) } @@ -458,7 +458,7 @@ pub fn standardize_stacks_marshalled_microblock_trail( ) -> Result, String> { let mut microblock_trail: NewMicroblockTrail = serde_json::from_value(marshalled_microblock_trail) - .map_err(|e| format!("unable to parse microblock trail {}", e.to_string()))?; + .map_err(|e| format!("unable to parse microblock trail {}", e))?; standardize_stacks_microblock_trail(indexer_config, &mut microblock_trail, chain_ctx, ctx) } @@ -472,7 +472,7 @@ pub fn standardize_stacks_microblock_trail( for event in microblock_trail.events.iter() { events .entry(&event.txid) - .and_modify(|events| events.push(&event)) + .and_modify(|events| events.push(event)) .or_insert(vec![&event]); } let mut microblocks_set: BTreeMap< @@ -480,7 +480,7 @@ pub fn standardize_stacks_microblock_trail( Vec, > = BTreeMap::new(); for tx in microblock_trail.transactions.iter() { - let tx_events = events.remove(&tx.txid).unwrap_or(vec![]); + let tx_events = events.remove(&tx.txid).unwrap_or_default(); let (description, tx_type, fee, nonce, sender, sponsor) = get_tx_description(&tx.raw_tx, &tx_events).expect("unable to parse transaction"); @@ -567,21 +567,21 @@ pub fn get_value_description(raw_value: &str, ctx: &Context) -> String { Some(raw_value) => raw_value, _ => return raw_value.to_string(), }; - let value_bytes = match hex::decode(&raw_value) { + let value_bytes = match hex::decode(raw_value) { Ok(bytes) => bytes, _ => return raw_value.to_string(), }; - let value = match ClarityValue::consensus_deserialize(&mut Cursor::new(&value_bytes)) { + + match ClarityValue::consensus_deserialize(&mut Cursor::new(&value_bytes)) { Ok(value) => format!("{}", value), Err(e) => { ctx.try_log(|logger| { slog::error!(logger, "unable to deserialize clarity value {:?}", e) }); - return raw_value.to_string(); + raw_value.to_string() } - }; - value + } } pub fn get_tx_description( @@ -602,22 +602,20 @@ pub fn get_tx_description( Some(raw_tx) => raw_tx, _ => return Err("unable to read txid".into()), }; - let tx_bytes = match hex::decode(&raw_tx) { + let tx_bytes = match hex::decode(raw_tx) { Ok(bytes) => bytes, - Err(e) => return Err(format!("unable to read txid {}", e.to_string())), + Err(e) => return Err(format!("unable to read txid {}", e)), }; // Handle Stacks transitions operated through Bitcoin transactions if tx_bytes.eq(&[0]) { if tx_events.is_empty() { - return Err(format!( - "received block with transaction '0x00' and no events" - )); + return Err("received block with transaction '0x00' and no events".to_string()); }; for event in tx_events.iter() { if let Some(ref event_data) = event.stx_transfer_event { let data: STXTransferEventData = serde_json::from_value(event_data.clone()) - .map_err(|e| format!("unable to decode event_data {}", e.to_string()))?; + .map_err(|e| format!("unable to decode event_data {}", e))?; let description = format!( "transfered: {} µSTX from {} to {} through Bitcoin transaction", data.amount, data.sender, data.recipient @@ -626,7 +624,7 @@ pub fn get_tx_description( return Ok((description, tx_type, 0, 0, data.sender, None)); } else if let Some(ref event_data) = event.stx_lock_event { let data: STXLockEventData = serde_json::from_value(event_data.clone()) - .map_err(|e| format!("unable to decode event_data {}", e.to_string()))?; + .map_err(|e| format!("unable to decode event_data {}", e))?; let description = format!( "stacked: {} µSTX by {} through Bitcoin transaction", data.locked_amount, data.locked_address, @@ -640,85 +638,82 @@ pub fn get_tx_description( return Ok((description, tx_type, 0, 0, data.locked_address, None)); } else if let Some(ref event_data) = event.contract_event { let data: SmartContractEventData = serde_json::from_value(event_data.clone()) - .map_err(|e| format!("unable to decode event_data {}", e.to_string()))?; + .map_err(|e| format!("unable to decode event_data {}", e))?; if let Some(ClarityValue::Response(data)) = try_decode_clarity_value(&data.hex_value) { if data.committed { if let ClarityValue::Tuple(outter) = *data.data { if let Some(ClarityValue::Tuple(inner)) = outter.data_map.get("data") { - match ( + if let ( + Some(ClarityValue::Principal(stacking_address)), + Some(ClarityValue::UInt(amount_ustx)), + Some(ClarityValue::Principal(delegate)), + Some(ClarityValue::Optional(pox_addr)), + Some(ClarityValue::Optional(unlock_burn_height)), + ) = ( &outter.data_map.get("stacker"), &inner.data_map.get("amount-ustx"), &inner.data_map.get("delegate-to"), &inner.data_map.get("pox-addr"), &inner.data_map.get("unlock-burn-height"), ) { - ( - Some(ClarityValue::Principal(stacking_address)), - Some(ClarityValue::UInt(amount_ustx)), - Some(ClarityValue::Principal(delegate)), - Some(ClarityValue::Optional(pox_addr)), - Some(ClarityValue::Optional(unlock_burn_height)), - ) => { - let description = format!( - "stacked: {} µSTX delegated to {} through Bitcoin transaction", - amount_ustx, delegate.to_string(), - ); - let tx_type = StacksTransactionKind::BitcoinOp( - BitcoinOpData::DelegateStackSTX(DelegateStackSTXData { - stacking_address: stacking_address.to_string(), - amount: amount_ustx.to_string(), - delegate: delegate.to_string(), - pox_address: match &pox_addr.data { - Some(value) => match &**value { - ClarityValue::Tuple(address_comps) => { - match ( - &address_comps - .data_map - .get("version"), - &address_comps - .data_map - .get("hashbytes"), - ) { - ( - Some(ClarityValue::UInt( - _version, - )), - Some(ClarityValue::Sequence( - SequenceData::Buffer( - _hashbytes, - ), - )), - ) => None, - _ => None, - } + let description = format!( + "stacked: {} µSTX delegated to {} through Bitcoin transaction", + amount_ustx, delegate, + ); + let tx_type = StacksTransactionKind::BitcoinOp( + BitcoinOpData::DelegateStackSTX(DelegateStackSTXData { + stacking_address: stacking_address.to_string(), + amount: amount_ustx.to_string(), + delegate: delegate.to_string(), + pox_address: match &pox_addr.data { + Some(value) => match &**value { + ClarityValue::Tuple(address_comps) => { + match ( + &address_comps + .data_map + .get("version"), + &address_comps + .data_map + .get("hashbytes"), + ) { + ( + Some(ClarityValue::UInt( + _version, + )), + Some(ClarityValue::Sequence( + SequenceData::Buffer( + _hashbytes, + ), + )), + ) => None, + _ => None, } - _ => None, - }, + } _ => None, }, - unlock_height: match &*(&unlock_burn_height.data) { - Some(value) => match &**value { - ClarityValue::UInt(value) => { - Some(value.to_string()) - } - _ => None, - }, + _ => None, + }, + unlock_height: match &unlock_burn_height.data { + Some(value) => match &**value { + ClarityValue::UInt(value) => { + Some(value.to_string()) + } _ => None, }, - }), - ); - return Ok(( - description, - tx_type, - 0, - 0, - "".to_string(), - None, - )); - } - _ => {} + _ => None, + }, + }), + ); + return Ok(( + description, + tx_type, + 0, + 0, + "".to_string(), + None, + )); } } } @@ -742,7 +737,7 @@ pub fn get_tx_description( } let tx = StacksTransaction::consensus_deserialize(&mut Cursor::new(&tx_bytes)) - .map_err(|e| format!("unable to consensus decode transaction {}", e.to_string()))?; + .map_err(|e| format!("unable to consensus decode transaction {}", e))?; let (fee, nonce, sender, sponsor) = match tx.auth { TransactionAuth::Standard(ref conditions) => ( @@ -817,14 +812,14 @@ pub fn get_tx_description( ) } TransactionPayload::Coinbase(_, _, _) => { - (format!("coinbase"), StacksTransactionKind::Coinbase) + ("coinbase".to_string(), StacksTransactionKind::Coinbase) } TransactionPayload::TenureChange(_) => ( - format!("tenure change"), + "tenure change".to_string(), StacksTransactionKind::TenureChange, ), TransactionPayload::PoisonMicroblock(_, _) => { - (format!("other"), StacksTransactionKind::Unsupported) + ("other".to_string(), StacksTransactionKind::Unsupported) } }; Ok((description, tx_type, fee, nonce, sender, sponsor)) diff --git a/components/chainhook-sdk/src/indexer/stacks/tests.rs b/components/chainhook-sdk/src/indexer/stacks/tests.rs index ec6a06f6c..51d4d2a5c 100644 --- a/components/chainhook-sdk/src/indexer/stacks/tests.rs +++ b/components/chainhook-sdk/src/indexer/stacks/tests.rs @@ -287,81 +287,81 @@ fn test_stacks_vector_055() { } #[test_case(StacksTransactionEventPayload::STXTransferEvent(STXTransferEventData { - sender: format!(""), - recipient: format!(""), - amount: format!("1"), + sender: String::new(), + recipient: String::new(), + amount: "1".to_string(), }); "stx_transfer")] #[test_case(StacksTransactionEventPayload::STXMintEvent(STXMintEventData { - recipient: format!(""), - amount: format!("1"), + recipient: String::new(), + amount: "1".to_string(), }); "stx_mint")] #[test_case(StacksTransactionEventPayload::STXBurnEvent(STXBurnEventData { - sender: format!(""), - amount: format!("1"), + sender: String::new(), + amount: "1".to_string(), }); "stx_burn")] #[test_case(StacksTransactionEventPayload::STXLockEvent(STXLockEventData { - locked_amount: format!("1"), - unlock_height: format!(""), - locked_address: format!(""), + locked_amount: "1".to_string(), + unlock_height: String::new(), + locked_address: String::new(), }); "stx_lock")] #[test_case(StacksTransactionEventPayload::NFTTransferEvent(NFTTransferEventData { - asset_class_identifier: format!(""), - hex_asset_identifier: format!(""), - sender: format!(""), - recipient: format!(""), + asset_class_identifier: String::new(), + hex_asset_identifier: String::new(), + sender: String::new(), + recipient: String::new(), }); "nft_transfer")] #[test_case(StacksTransactionEventPayload::NFTMintEvent(NFTMintEventData { - asset_class_identifier: format!(""), - hex_asset_identifier: format!(""), - recipient: format!(""), + asset_class_identifier: String::new(), + hex_asset_identifier: String::new(), + recipient: String::new(), }); "nft_mint")] #[test_case(StacksTransactionEventPayload::NFTBurnEvent(NFTBurnEventData { - asset_class_identifier: format!(""), - hex_asset_identifier: format!(""), - sender: format!(""), + asset_class_identifier: String::new(), + hex_asset_identifier: String::new(), + sender: String::new(), }); "nft_burn")] #[test_case(StacksTransactionEventPayload::FTTransferEvent(FTTransferEventData { - asset_class_identifier: format!(""), - sender: format!(""), - recipient: format!(""), - amount: format!("1"), + asset_class_identifier: String::new(), + sender: String::new(), + recipient: String::new(), + amount: "1".to_string(), }); "ft_transfer")] #[test_case(StacksTransactionEventPayload::FTMintEvent(FTMintEventData { - asset_class_identifier: format!(""), - recipient: format!(""), - amount: format!("1"), + asset_class_identifier: String::new(), + recipient: String::new(), + amount: "1".to_string(), }); "ft_mint")] #[test_case(StacksTransactionEventPayload::FTBurnEvent(FTBurnEventData { - asset_class_identifier: format!(""), - sender: format!(""), - amount: format!("1"), + asset_class_identifier: String::new(), + sender: String::new(), + amount: "1".to_string(), }); "ft_burn")] #[test_case(StacksTransactionEventPayload::DataVarSetEvent(DataVarSetEventData { - contract_identifier: format!(""), - var: format!(""), - hex_new_value: format!(""), + contract_identifier: String::new(), + var: String::new(), + hex_new_value: String::new(), }); "data_var_set")] #[test_case(StacksTransactionEventPayload::DataMapInsertEvent(DataMapInsertEventData { - contract_identifier: format!(""), - hex_inserted_key: format!(""), - hex_inserted_value: format!(""), - map: format!("") + contract_identifier: String::new(), + hex_inserted_key: String::new(), + hex_inserted_value: String::new(), + map: String::new() }); "data_map_insert")] #[test_case(StacksTransactionEventPayload::DataMapUpdateEvent(DataMapUpdateEventData { - contract_identifier: format!(""), - hex_new_value: format!(""), - hex_key: format!(""), - map: format!("") + contract_identifier: String::new(), + hex_new_value: String::new(), + hex_key: String::new(), + map: String::new() }); "data_map_update")] #[test_case(StacksTransactionEventPayload::DataMapDeleteEvent(DataMapDeleteEventData { - contract_identifier: format!(""), - hex_deleted_key: format!(""), - map: format!("") + contract_identifier: String::new(), + hex_deleted_key: String::new(), + map: String::new() }); "data_map_delete")] #[test_case(StacksTransactionEventPayload::SmartContractEvent(SmartContractEventData { - contract_identifier: format!(""), - topic: format!("print"), - hex_value: format!(""), + contract_identifier: String::new(), + topic: "print".to_string(), + hex_value: String::new(), }); "smart_contract_print_event")] fn new_events_can_be_converted_into_chainhook_event(original_event: StacksTransactionEventPayload) { let new_event = create_new_event_from_stacks_event(original_event.clone()); @@ -374,10 +374,10 @@ fn new_events_can_be_converted_into_chainhook_event(original_event: StacksTransa #[test] fn into_chainhook_event_rejects_invalid_missing_event() { let new_event = NewEvent { - txid: format!(""), + txid: String::new(), committed: false, event_index: 0, - event_type: format!(""), + event_type: String::new(), stx_transfer_event: None, stx_mint_event: None, stx_burn_event: None, diff --git a/components/chainhook-sdk/src/indexer/tests/helpers/accounts.rs b/components/chainhook-sdk/src/indexer/tests/helpers/accounts.rs index 5208c6e7f..57b12da3b 100644 --- a/components/chainhook-sdk/src/indexer/tests/helpers/accounts.rs +++ b/components/chainhook-sdk/src/indexer/tests/helpers/accounts.rs @@ -1,79 +1,79 @@ pub fn deployer_stx_address() -> String { - format!("ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM") + "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM".to_string() } pub fn wallet_1_stx_address() -> String { - format!("ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5") + "ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5".to_string() } pub fn wallet_2_stx_address() -> String { - format!("ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG") + "ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG".to_string() } pub fn wallet_3_stx_address() -> String { - format!("ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC") + "ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC".to_string() } pub fn wallet_4_stx_address() -> String { - format!("ST2NEB84ASENDXKYGJPQW86YXQCEFEX2ZQPG87ND") + "ST2NEB84ASENDXKYGJPQW86YXQCEFEX2ZQPG87ND".to_string() } pub fn wallet_5_stx_address() -> String { - format!("ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB") + "ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB".to_string() } pub fn wallet_6_stx_address() -> String { - format!("ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0") + "ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0".to_string() } pub fn wallet_7_stx_address() -> String { - format!("ST3PF13W7Z0RRM42A8VZRVFQ75SV1K26RXEP8YGKJ") + "ST3PF13W7Z0RRM42A8VZRVFQ75SV1K26RXEP8YGKJ".to_string() } pub fn wallet_8_stx_address() -> String { - format!("ST3NBRSFKX28FQ2ZJ1MAKX58HKHSDGNV5N7R21XCP") + "ST3NBRSFKX28FQ2ZJ1MAKX58HKHSDGNV5N7R21XCP".to_string() } pub fn wallet_9_stx_address() -> String { - format!("STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6") + "STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6".to_string() } pub fn deployer_btc_address() -> String { - format!("mqVnk6NPRdhntvfm4hh9vvjiRkFDUuSYsH") + "mqVnk6NPRdhntvfm4hh9vvjiRkFDUuSYsH".to_string() } pub fn wallet_1_btc_address() -> String { - format!("mr1iPkD9N3RJZZxXRk7xF9d36gffa6exNC") + "mr1iPkD9N3RJZZxXRk7xF9d36gffa6exNC".to_string() } pub fn wallet_2_btc_address() -> String { - format!("muYdXKmX9bByAueDe6KFfHd5Ff1gdN9ErG") + "muYdXKmX9bByAueDe6KFfHd5Ff1gdN9ErG".to_string() } pub fn wallet_3_btc_address() -> String { - format!("mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7") + "mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7".to_string() } pub fn wallet_4_btc_address() -> String { - format!("mg1C76bNTutiCDV3t9nWhZs3Dc8LzUufj8") + "mg1C76bNTutiCDV3t9nWhZs3Dc8LzUufj8".to_string() } pub fn wallet_5_btc_address() -> String { - format!("mweN5WVqadScHdA81aATSdcVr4B6dNokqx") + "mweN5WVqadScHdA81aATSdcVr4B6dNokqx".to_string() } pub fn wallet_6_btc_address() -> String { - format!("mzxXgV6e4BZSsz8zVHm3TmqbECt7mbuErt") + "mzxXgV6e4BZSsz8zVHm3TmqbECt7mbuErt".to_string() } pub fn wallet_7_btc_address() -> String { - format!("n37mwmru2oaVosgfuvzBwgV2ysCQRrLko7") + "n37mwmru2oaVosgfuvzBwgV2ysCQRrLko7".to_string() } pub fn wallet_8_btc_address() -> String { - format!("n2v875jbJ4RjBnTjgbfikDfnwsDV5iUByw") + "n2v875jbJ4RjBnTjgbfikDfnwsDV5iUByw".to_string() } pub fn wallet_9_btc_address() -> String { - format!("mjSrB3wS4xab3kYqFktwBzfTdPg367ZJ2d") + "mjSrB3wS4xab3kYqFktwBzfTdPg367ZJ2d".to_string() } diff --git a/components/chainhook-sdk/src/indexer/tests/helpers/bitcoin_shapes.rs b/components/chainhook-sdk/src/indexer/tests/helpers/bitcoin_shapes.rs index 264134fde..7388738c3 100644 --- a/components/chainhook-sdk/src/indexer/tests/helpers/bitcoin_shapes.rs +++ b/components/chainhook-sdk/src/indexer/tests/helpers/bitcoin_shapes.rs @@ -8,10 +8,7 @@ use hiro_system_kit::slog; pub fn expect_no_chain_update() -> BlockchainEventExpectation { Box::new(move |chain_event_to_check: Option| { assert!( - match chain_event_to_check { - None => true, - _ => false, - }, + chain_event_to_check.is_none(), "expected no Chain update, got {:?}", chain_event_to_check ); diff --git a/components/chainhook-sdk/src/indexer/tests/helpers/stacks_blocks.rs b/components/chainhook-sdk/src/indexer/tests/helpers/stacks_blocks.rs index 88223f023..95e4208a4 100644 --- a/components/chainhook-sdk/src/indexer/tests/helpers/stacks_blocks.rs +++ b/components/chainhook-sdk/src/indexer/tests/helpers/stacks_blocks.rs @@ -65,13 +65,13 @@ pub fn generate_test_stacks_block( metadata: StacksBlockMetadata { bitcoin_anchor_block_identifier: BlockIdentifier { index: parent_height, - hash: format!(""), + hash: String::new(), }, pox_cycle_index: 1, pox_cycle_position: block_height.try_into().unwrap(), pox_cycle_length: 100, confirm_microblock_identifier, - stacks_block_hash: format!(""), + stacks_block_hash: String::new(), }, }) } diff --git a/components/chainhook-sdk/src/indexer/tests/helpers/stacks_events.rs b/components/chainhook-sdk/src/indexer/tests/helpers/stacks_events.rs index 3db3c9ed3..4ca977bc5 100644 --- a/components/chainhook-sdk/src/indexer/tests/helpers/stacks_events.rs +++ b/components/chainhook-sdk/src/indexer/tests/helpers/stacks_events.rs @@ -5,100 +5,100 @@ use crate::indexer::stacks::NewEvent; pub fn create_new_event_from_stacks_event(event: StacksTransactionEventPayload) -> NewEvent { let mut event_type = String::new(); let stx_transfer_event = if let StacksTransactionEventPayload::STXTransferEvent(data) = &event { - event_type = format!("stx_transfer"); + event_type = "stx_transfer".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let stx_mint_event = if let StacksTransactionEventPayload::STXMintEvent(data) = &event { - event_type = format!("stx_mint"); + event_type = "stx_mint".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let stx_burn_event = if let StacksTransactionEventPayload::STXBurnEvent(data) = &event { - event_type = format!("stx_burn"); + event_type = "stx_burn".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let stx_lock_event = if let StacksTransactionEventPayload::STXLockEvent(data) = &event { - event_type = format!("stx_lock"); + event_type = "stx_lock".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let nft_transfer_event = if let StacksTransactionEventPayload::NFTTransferEvent(data) = &event { - event_type = format!("nft_transfer"); + event_type = "nft_transfer".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let nft_mint_event = if let StacksTransactionEventPayload::NFTMintEvent(data) = &event { - event_type = format!("nft_mint"); + event_type = "nft_mint".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let nft_burn_event = if let StacksTransactionEventPayload::NFTBurnEvent(data) = &event { - event_type = format!("nft_burn"); + event_type = "nft_burn".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let ft_transfer_event = if let StacksTransactionEventPayload::FTTransferEvent(data) = &event { - event_type = format!("ft_transfer"); + event_type = "ft_transfer".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let ft_mint_event = if let StacksTransactionEventPayload::FTMintEvent(data) = &event { - event_type = format!("ft_mint"); + event_type = "ft_mint".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let ft_burn_event = if let StacksTransactionEventPayload::FTBurnEvent(data) = &event { - event_type = format!("ft_burn"); + event_type = "ft_burn".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let data_var_set_event = if let StacksTransactionEventPayload::DataVarSetEvent(data) = &event { - event_type = format!("data_var_set"); + event_type = "data_var_set".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let data_map_insert_event = if let StacksTransactionEventPayload::DataMapInsertEvent(data) = &event { - event_type = format!("data_map_insert"); + event_type = "data_map_insert".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let data_map_update_event = if let StacksTransactionEventPayload::DataMapUpdateEvent(data) = &event { - event_type = format!("data_map_update"); + event_type = "data_map_update".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let data_map_delete_event = if let StacksTransactionEventPayload::DataMapDeleteEvent(data) = &event { - event_type = format!("data_map_delete"); + event_type = "data_map_delete".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; let contract_event = if let StacksTransactionEventPayload::SmartContractEvent(data) = &event { - event_type = format!("smart_contract_print_event"); + event_type = "smart_contract_print_event".to_string(); Some(serde_json::to_value(data).unwrap()) } else { None }; NewEvent { - txid: format!(""), + txid: String::new(), committed: false, event_index: 0, event_type, diff --git a/components/chainhook-sdk/src/indexer/tests/helpers/stacks_shapes.rs b/components/chainhook-sdk/src/indexer/tests/helpers/stacks_shapes.rs index ad013d190..718ea5604 100644 --- a/components/chainhook-sdk/src/indexer/tests/helpers/stacks_shapes.rs +++ b/components/chainhook-sdk/src/indexer/tests/helpers/stacks_shapes.rs @@ -8,10 +8,7 @@ use hiro_system_kit::slog; pub fn expect_no_chain_update() -> StacksChainEventExpectation { Box::new(move |chain_event_to_check: Option| { assert!( - match chain_event_to_check { - None => true, - _ => false, - }, + chain_event_to_check.is_none(), "expected no Chain update, got {:?}", chain_event_to_check ); @@ -190,7 +187,7 @@ pub fn expect_chain_updated_with_block_and_microblock_updates( .as_ref() .unwrap(); assert!( - &expected_microblock_id.eq(µblock_id), + &expected_microblock_id.eq(microblock_id), "{} ≠ {}", expected_microblock_id, microblock_id @@ -298,7 +295,7 @@ pub fn expect_chain_updated_with_block_reorg_and_microblock_updates( .as_ref() .unwrap(); assert!( - &expected_microblock_id.eq(µblock_id), + &expected_microblock_id.eq(microblock_id), "{} ≠ {}", expected_microblock_id, microblock_id @@ -316,7 +313,7 @@ pub fn expect_chain_updated_with_block_reorg_and_microblock_updates( .as_ref() .unwrap(); assert!( - &expected_microblock_id.eq(µblock_id), + &expected_microblock_id.eq(microblock_id), "{} ≠ {}", expected_microblock_id, microblock_id diff --git a/components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs b/components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs index 849b3ca1a..847992860 100644 --- a/components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs +++ b/components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs @@ -43,9 +43,9 @@ pub fn generate_test_tx_stacks_contract_call( operations: vec![], metadata: StacksTransactionMetadata { success: true, - raw_tx: format!("__raw_tx__"), - result: format!("(ok true)"), - sender: format!("{}", sender), + raw_tx: "__raw_tx__".to_string(), + result: "(ok true)".to_string(), + sender: sender.to_string(), fee: 0, nonce: 0, kind: StacksTransactionKind::ContractCall(StacksContractCallData { @@ -109,7 +109,7 @@ pub fn generate_test_tx_bitcoin_p2pkh_transfer( let script = BitcoinScriptBuilder::new() .push_opcode(opcodes::all::OP_DUP) .push_opcode(opcodes::all::OP_HASH160) - .push_slice(&slice) + .push_slice(slice) .push_opcode(opcodes::all::OP_EQUALVERIFY) .push_opcode(opcodes::all::OP_CHECKSIG) .into_script(); diff --git a/components/chainhook-sdk/src/indexer/tests/mod.rs b/components/chainhook-sdk/src/indexer/tests/mod.rs index 6682805c3..8d5989833 100644 --- a/components/chainhook-sdk/src/indexer/tests/mod.rs +++ b/components/chainhook-sdk/src/indexer/tests/mod.rs @@ -7,7 +7,7 @@ use self::helpers::BlockEvent; use super::{fork_scratch_pad::ForkScratchPad, StacksBlockPool}; use chainhook_types::{BitcoinBlockData, BlockchainEvent, StacksBlockData, StacksChainEvent}; -pub type StacksChainEventExpectation = Box) -> ()>; +pub type StacksChainEventExpectation = Box)>; pub fn process_stacks_blocks_and_check_expectations( (steps, block_pool_seed): ( @@ -41,7 +41,7 @@ pub fn process_stacks_blocks_and_check_expectations( } } -pub type BlockchainEventExpectation = Box) -> ()>; +pub type BlockchainEventExpectation = Box)>; pub fn process_bitcoin_blocks_and_check_expectations( steps: Vec<(BitcoinBlockData, BlockchainEventExpectation)>, diff --git a/components/chainhook-sdk/src/monitoring.rs b/components/chainhook-sdk/src/monitoring.rs index 05d78d061..dfb33ded7 100644 --- a/components/chainhook-sdk/src/monitoring.rs +++ b/components/chainhook-sdk/src/monitoring.rs @@ -44,6 +44,12 @@ pub struct PrometheusMonitoring { pub registry: Registry, } +impl Default for PrometheusMonitoring { + fn default() -> Self { + Self::new() + } +} + impl PrometheusMonitoring { pub fn new() -> PrometheusMonitoring { let registry = Registry::new(); @@ -264,7 +270,7 @@ impl PrometheusMonitoring { let time = SystemTime::now() .duration_since(UNIX_EPOCH) .expect("Could not get current time in ms") - .as_secs() as u64; + .as_secs(); self.stx_last_block_ingestion_time.set(time); } @@ -332,7 +338,7 @@ impl PrometheusMonitoring { let time = SystemTime::now() .duration_since(UNIX_EPOCH) .expect("Could not get current time in ms") - .as_secs() as u64; + .as_secs(); self.btc_last_block_ingestion_time.set(time); } diff --git a/components/chainhook-sdk/src/observer/http.rs b/components/chainhook-sdk/src/observer/http.rs index e32cb039a..0c91acb46 100644 --- a/components/chainhook-sdk/src/observer/http.rs +++ b/components/chainhook-sdk/src/observer/http.rs @@ -118,7 +118,7 @@ pub async fn handle_new_bitcoin_block( }; let chain_update = match indexer_rw_lock.inner().write() { - Ok(mut indexer) => indexer.handle_bitcoin_header(header, &ctx), + Ok(mut indexer) => indexer.handle_bitcoin_header(header, ctx), Err(e) => { ctx.try_log(|logger| { slog::warn!( @@ -199,7 +199,7 @@ pub fn handle_new_stacks_block( }; let new_tip = block.block_identifier.index; prometheus_monitoring.stx_metrics_block_received(new_tip); - let chain_event = indexer.process_stacks_block(block, &ctx); + let chain_event = indexer.process_stacks_block(block, ctx); (pox_config, chain_event, new_tip) } Err(e) => { @@ -268,11 +268,11 @@ pub fn handle_new_microblocks( // kind of update that this new microblock would imply let chain_event = match indexer_rw_lock.inner().write() { Ok(mut indexer) => { - let chain_event = indexer.handle_stacks_marshalled_microblock_trail( + + indexer.handle_stacks_marshalled_microblock_trail( marshalled_microblock.into_inner(), - &ctx, - ); - chain_event + ctx, + ) } Err(e) => { ctx.try_log(|logger| { @@ -335,7 +335,7 @@ pub fn handle_new_mempool_tx( let transactions = raw_txs .iter() .map(|tx_data| { - let (tx_description, ..) = indexer::stacks::get_tx_description(&tx_data, &vec![]) + let (tx_description, ..) = indexer::stacks::get_tx_description(tx_data, &vec![]) .expect("unable to parse transaction"); MempoolAdmissionData { tx_data: tx_data.clone(), @@ -345,13 +345,10 @@ pub fn handle_new_mempool_tx( .collect::>(); let background_job_tx = background_job_tx.inner(); - match background_job_tx.lock() { - Ok(tx) => { - let _ = tx.send(ObserverCommand::PropagateStacksMempoolEvent( - StacksChainMempoolEvent::TransactionsAdmitted(transactions), - )); - } - _ => {} + if let Ok(tx) = background_job_tx.lock() { + let _ = tx.send(ObserverCommand::PropagateStacksMempoolEvent( + StacksChainMempoolEvent::TransactionsAdmitted(transactions), + )); }; Json(json!({ @@ -411,14 +408,14 @@ pub async fn handle_bitcoin_wallet_rpc_call( let bitcoin_rpc_call = bitcoin_rpc_call.into_inner().clone(); - let body = rocket::serde::json::serde_json::to_vec(&bitcoin_rpc_call).unwrap_or(vec![]); + let body = rocket::serde::json::serde_json::to_vec(&bitcoin_rpc_call).unwrap_or_default(); let token = BASE64.encode(format!( "{}:{}", bitcoin_config.username, bitcoin_config.password )); - let url = format!("{}", bitcoin_config.rpc_url); + let url = bitcoin_config.rpc_url.to_string(); let client = Client::new(); let builder = client .post(&url) @@ -450,7 +447,7 @@ pub async fn handle_bitcoin_rpc_call( let bitcoin_rpc_call = bitcoin_rpc_call.into_inner().clone(); let method = bitcoin_rpc_call.method.clone(); - let body = rocket::serde::json::serde_json::to_vec(&bitcoin_rpc_call).unwrap_or(vec![]); + let body = rocket::serde::json::serde_json::to_vec(&bitcoin_rpc_call).unwrap_or_default(); let token = BASE64.encode(format!( "{}:{}", @@ -481,11 +478,8 @@ pub async fn handle_bitcoin_rpc_call( if method == "sendrawtransaction" { let background_job_tx = background_job_tx.inner(); - match background_job_tx.lock() { - Ok(tx) => { - let _ = tx.send(ObserverCommand::NotifyBitcoinTransactionProxied); - } - _ => {} + if let Ok(tx) = background_job_tx.lock() { + let _ = tx.send(ObserverCommand::NotifyBitcoinTransactionProxied); }; } diff --git a/components/chainhook-sdk/src/observer/mod.rs b/components/chainhook-sdk/src/observer/mod.rs index 0b887acba..d762ec294 100644 --- a/components/chainhook-sdk/src/observer/mod.rs +++ b/components/chainhook-sdk/src/observer/mod.rs @@ -109,6 +109,12 @@ pub struct EventObserverConfigBuilder { pub prometheus_monitoring_port: Option, } +impl Default for EventObserverConfigBuilder { + fn default() -> Self { + Self::new() + } +} + impl EventObserverConfigBuilder { pub fn new() -> Self { EventObserverConfigBuilder { @@ -218,6 +224,12 @@ pub struct BitcoinEventObserverConfigBuilder { pub bitcoind_zmq_url: Option, pub prometheus_monitoring_port: Option, } +impl Default for BitcoinEventObserverConfigBuilder { + fn default() -> Self { + Self::new() + } +} + impl BitcoinEventObserverConfigBuilder { pub fn new() -> Self { BitcoinEventObserverConfigBuilder { @@ -272,7 +284,7 @@ impl BitcoinEventObserverConfigBuilder { /// This function will return an error if the `bitcoin_network` string is set and is not a valid [BitcoinNetwork]. pub fn finish(&self) -> Result { let bitcoin_network = if let Some(network) = self.bitcoin_network.as_ref() { - BitcoinNetwork::from_str(&network)? + BitcoinNetwork::from_str(network)? } else { BitcoinNetwork::Regtest }; @@ -297,7 +309,7 @@ impl BitcoinEventObserverConfigBuilder { .unwrap_or_else(|| "tcp://0.0.0.0:18543".into()), ), display_stacks_ingestion_logs: false, - bitcoin_network: bitcoin_network, + bitcoin_network, stacks_network: StacksNetwork::Devnet, prometheus_monitoring_port: self.prometheus_monitoring_port, }) @@ -351,14 +363,14 @@ impl EventObserverConfig { } pub fn get_bitcoin_config(&self) -> BitcoinConfig { - let bitcoin_config = BitcoinConfig { + + BitcoinConfig { username: self.bitcoind_rpc_username.clone(), password: self.bitcoind_rpc_password.clone(), rpc_url: self.bitcoind_rpc_url.clone(), network: self.bitcoin_network.clone(), bitcoin_block_signaling: self.bitcoin_block_signaling.clone(), - }; - bitcoin_config + } } pub fn get_stacks_node_config(&self) -> &StacksNodeConfig { @@ -410,12 +422,12 @@ impl EventObserverConfig { .unwrap_or_else(|| DEFAULT_STACKS_NODE_RPC.to_string()), overrides .and_then(|c| c.chainhook_stacks_block_ingestion_port) - .unwrap_or_else(|| DEFAULT_INGESTION_PORT), + .unwrap_or(DEFAULT_INGESTION_PORT), )) }), display_stacks_ingestion_logs: overrides .and_then(|c| c.display_stacks_ingestion_logs) - .unwrap_or_else(|| false), + .unwrap_or(false), bitcoin_network, stacks_network, prometheus_monitoring_port: overrides.and_then(|c| c.prometheus_monitoring_port), @@ -472,6 +484,12 @@ pub struct PredicateEvaluationReport { pub predicates_expired: BTreeMap>, } +impl Default for PredicateEvaluationReport { + fn default() -> Self { + Self::new() + } +} + impl PredicateEvaluationReport { pub fn new() -> PredicateEvaluationReport { PredicateEvaluationReport { @@ -495,7 +513,7 @@ impl PredicateEvaluationReport { } pub fn track_trigger(&mut self, uuid: &str, blocks: &Vec<&BlockIdentifier>) { - for block_id in blocks.into_iter() { + for block_id in blocks.iter() { self.predicates_triggered .entry(uuid.to_string()) .and_modify(|e| { @@ -695,9 +713,9 @@ impl EventObserverBuilder { ctx: &Context, ) -> Self { EventObserverBuilder { - config: config, + config, observer_commands_tx: observer_commands_tx.clone(), - observer_commands_rx: observer_commands_rx, + observer_commands_rx, ctx: ctx.clone(), observer_events_tx: None, observer_sidecar: None, @@ -852,7 +870,7 @@ pub async fn start_bitcoin_event_observer( let config_moved = config.clone(); let _ = hiro_system_kit::thread_named("ZMQ handler").spawn(move || { let future = zmq::start_zeromq_runloop(&config_moved, observer_commands_tx, &ctx_moved); - let _ = hiro_system_kit::nestable_block_on(future); + hiro_system_kit::nestable_block_on(future); }); } @@ -867,7 +885,7 @@ pub async fn start_bitcoin_event_observer( let registry_moved = prometheus_monitoring.registry.clone(); let ctx_cloned = ctx.clone(); let _ = std::thread::spawn(move || { - let _ = hiro_system_kit::nestable_block_on(start_serving_prometheus_metrics( + hiro_system_kit::nestable_block_on(start_serving_prometheus_metrics( port, registry_moved, ctx_cloned, @@ -942,7 +960,7 @@ pub async fn start_stacks_event_observer( let registry_moved = prometheus_monitoring.registry.clone(); let ctx_cloned = ctx.clone(); let _ = std::thread::spawn(move || { - let _ = hiro_system_kit::nestable_block_on(start_serving_prometheus_metrics( + hiro_system_kit::nestable_block_on(start_serving_prometheus_metrics( port, registry_moved, ctx_cloned, @@ -962,7 +980,7 @@ pub async fn start_stacks_event_observer( address: IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), keep_alive: 5, temp_dir: std::env::temp_dir().into(), - log_level: log_level.clone(), + log_level, cli_colors: false, limits, shutdown: shutdown_config, @@ -1022,17 +1040,17 @@ pub fn get_bitcoin_proof( block_identifier: &BlockIdentifier, ) -> Result { let txid = - Txid::from_str(&transaction_identifier.get_hash_bytes_str()).expect("unable to build txid"); + Txid::from_str(transaction_identifier.get_hash_bytes_str()).expect("unable to build txid"); let block_hash = BlockHash::from_str(&block_identifier.hash[2..]).expect("unable to build block_hash"); - let res = bitcoin_client_rpc.get_tx_out_proof(&vec![txid], Some(&block_hash)); + let res = bitcoin_client_rpc.get_tx_out_proof(&[txid], Some(&block_hash)); match res { Ok(proof) => Ok(format!("0x{}", hex::encode(&proof))), Err(e) => Err(format!( "failed collecting proof for transaction {}: {}", transaction_identifier.hash, - e.to_string() + e )), } } @@ -1341,18 +1359,14 @@ pub async fn start_observer_commands_handler( } } - match blocks_to_apply + if let Some(highest_tip_block) = blocks_to_apply .iter() - .max_by_key(|b| b.block_identifier.index) - { - Some(highest_tip_block) => { - prometheus_monitoring.btc_metrics_set_reorg( - highest_tip_block.timestamp.into(), - blocks_to_apply.len() as u64, - blocks_to_rollback.len() as u64, - ); - } - None => {} + .max_by_key(|b| b.block_identifier.index) { + prometheus_monitoring.btc_metrics_set_reorg( + highest_tip_block.timestamp.into(), + blocks_to_apply.len() as u64, + blocks_to_rollback.len() as u64, + ); } ( @@ -1446,7 +1460,7 @@ pub async fn start_observer_commands_handler( let mut proofs = HashMap::new(); for trigger in chainhooks_to_trigger.iter() { if trigger.chainhook.include_proof { - gather_proofs(&trigger, &mut proofs, &config, &ctx); + gather_proofs(trigger, &mut proofs, &config, &ctx); } } diff --git a/components/chainhook-sdk/src/observer/tests/mod.rs b/components/chainhook-sdk/src/observer/tests/mod.rs index aee263086..32b19893c 100644 --- a/components/chainhook-sdk/src/observer/tests/mod.rs +++ b/components/chainhook-sdk/src/observer/tests/mod.rs @@ -80,14 +80,14 @@ fn stacks_chainhook_contract_call( }, ); - let spec = StacksChainhookSpecificationNetworkMap { + + StacksChainhookSpecificationNetworkMap { uuid: format!("{}", id), name: format!("Chainhook {}", id), owner_uuid: None, networks, version: 1, - }; - spec + } } fn bitcoin_chainhook_p2pkh( @@ -114,14 +114,14 @@ fn bitcoin_chainhook_p2pkh( }, ); - let spec = BitcoinChainhookSpecificationNetworkMap { + + BitcoinChainhookSpecificationNetworkMap { uuid: format!("{}", id), name: format!("Chainhook {}", id), owner_uuid: None, version: 1, networks, - }; - spec + } } fn bitcoin_chainhook_ordinals(id: u8) -> BitcoinChainhookSpecificationNetworkMap { @@ -146,14 +146,14 @@ fn bitcoin_chainhook_ordinals(id: u8) -> BitcoinChainhookSpecificationNetworkMap }, ); - let spec = BitcoinChainhookSpecificationNetworkMap { + + BitcoinChainhookSpecificationNetworkMap { uuid: format!("{}", id), name: format!("Chainhook {}", id), owner_uuid: None, version: 1, networks, - }; - spec + } } fn generate_and_register_new_stacks_chainhook( @@ -208,7 +208,7 @@ fn generate_and_register_new_bitcoin_chainhook( p2pkh_address: &str, expire_after_occurrence: Option, ) -> BitcoinChainhookInstance { - let chainhook = bitcoin_chainhook_p2pkh(id, &p2pkh_address, expire_after_occurrence); + let chainhook = bitcoin_chainhook_p2pkh(id, p2pkh_address, expire_after_occurrence); let _ = observer_commands_tx.send(ObserverCommand::RegisterPredicate( ChainhookSpecificationNetworkMap::Bitcoin(chainhook.clone()), )); diff --git a/components/chainhook-sdk/src/observer/zmq.rs b/components/chainhook-sdk/src/observer/zmq.rs index 5d31a7dea..c9b91f3df 100644 --- a/components/chainhook-sdk/src/observer/zmq.rs +++ b/components/chainhook-sdk/src/observer/zmq.rs @@ -87,7 +87,7 @@ pub async fn start_zeromq_runloop( &http_client, &block_hash, &bitcoin_config, - &ctx, + ctx, ) .await { @@ -116,7 +116,7 @@ pub async fn start_zeromq_runloop( let _ = observer_commands_tx.send(ObserverCommand::ProcessBitcoinBlock(block)); if bitcoin_blocks_pool.can_process_header(&header) { - match bitcoin_blocks_pool.process_header(header, &ctx) { + match bitcoin_blocks_pool.process_header(header, ctx) { Ok(Some(event)) => { let _ = observer_commands_tx .send(ObserverCommand::PropagateBitcoinChainEvent(event)); diff --git a/components/chainhook-sdk/src/utils/mod.rs b/components/chainhook-sdk/src/utils/mod.rs index 541b6f352..550eb56a5 100644 --- a/components/chainhook-sdk/src/utils/mod.rs +++ b/components/chainhook-sdk/src/utils/mod.rs @@ -156,9 +156,7 @@ pub async fn send_request( Some(rb) => rb, None => { ctx.try_log(|logger| slog::warn!(logger, "unable to clone request builder")); - return Err(format!( - "internal server error: unable to clone request builder" - )); + return Err("internal server error: unable to clone request builder".to_string()); } }; let err_msg = match request_builder.send().await { @@ -176,7 +174,7 @@ pub async fn send_request( } Err(e) => { retry += 1; - let err_msg = format!("unable to send request {}", e.to_string()); + let err_msg = format!("unable to send request {}", e); ctx.try_log(|logger| slog::warn!(logger, "{}", err_msg)); err_msg } @@ -196,7 +194,7 @@ pub async fn send_request( pub fn file_append(path: String, bytes: Vec, ctx: &Context) -> Result<(), String> { let mut file_path = match std::env::current_dir() { Err(e) => { - let msg = format!("unable to retrieve current_dir {}", e.to_string()); + let msg = format!("unable to retrieve current_dir {}", e); ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); return Err(msg); } @@ -212,7 +210,7 @@ pub fn file_append(path: String, bytes: Vec, ctx: &Context) -> Result<(), St let msg = format!( "unable to create file {}: {}", file_path.display(), - e.to_string() + e ); ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); return Err(msg); @@ -222,12 +220,12 @@ pub fn file_append(path: String, bytes: Vec, ctx: &Context) -> Result<(), St let mut file = match OpenOptions::new() .create(false) - .write(true) + .append(true) .open(file_path) { Err(e) => { - let msg = format!("unable to open file {}", e.to_string()); + let msg = format!("unable to open file {}", e); ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); return Err(msg); } @@ -237,14 +235,14 @@ pub fn file_append(path: String, bytes: Vec, ctx: &Context) -> Result<(), St let utf8 = match String::from_utf8(bytes) { Ok(string) => string, Err(e) => { - let msg = format!("unable serialize bytes as utf8 string {}", e.to_string()); + let msg = format!("unable serialize bytes as utf8 string {}", e); ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); return Err(msg); } }; if let Err(e) = writeln!(file, "{}", utf8) { - let msg = format!("unable to open file {}", e.to_string()); + let msg = format!("unable to open file {}", e); ctx.try_log(|logger| slog::warn!(logger, "{}", msg)); eprintln!("Couldn't write to file: {}", e); return Err(msg); @@ -399,7 +397,7 @@ pub fn write_file_content_at_path(file_path: &PathBuf, content: &[u8]) -> Result e ) })?; - let mut file = File::create(&file_path) + let mut file = File::create(file_path) .map_err(|e| format!("unable to open file {}\n{}", file_path.display(), e))?; file.write_all(content) .map_err(|e| format!("unable to write file {}\n{}", file_path.display(), e))?; diff --git a/rust-toolchain b/rust-toolchain index 83025f972..a56a283d2 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,2 +1,2 @@ [toolchain] -channel = "1.77.0" +channel = "1.80.1"