diff --git a/Cargo.lock b/Cargo.lock index 46088c1f0..841ee5d55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -153,90 +153,12 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "async-trait" -version = "0.1.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - [[package]] name = "autocfg" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" -[[package]] -name = "axum" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core", - "bitflags 1.3.2", - "bytes", - "futures-util", - "http 0.2.12", - "http-body", - "hyper", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 0.2.12", - "http-body", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] - [[package]] name = "backtrace" version = "0.3.73" @@ -258,12 +180,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -276,12 +192,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.6.0" @@ -429,7 +339,6 @@ dependencies = [ "chia-protocol", "chia-ssl", "chia-traits 0.10.0", - "console-subscriber", "dns-lookup", "env_logger", "futures-util", @@ -795,44 +704,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" -[[package]] -name = "console-api" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a257c22cd7e487dd4a13d413beabc512c5052f0bc048db0da6a84c3d8a6142fd" -dependencies = [ - "futures-core", - "prost", - "prost-types", - "tonic", - "tracing-core", -] - -[[package]] -name = "console-subscriber" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c4cc54bae66f7d9188996404abdf7fdfa23034ef8e43478c8810828abad758" -dependencies = [ - "console-api", - "crossbeam-channel", - "crossbeam-utils", - "futures-task", - "hdrhistogram", - "humantime", - "prost", - "prost-types", - "serde", - "serde_json", - "thread_local", - "tokio", - "tokio-stream", - "tonic", - "tracing", - "tracing-core", - "tracing-subscriber", -] - [[package]] name = "const-oid" version = "0.9.6" @@ -864,15 +735,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - [[package]] name = "criterion" version = "0.5.1" @@ -885,7 +747,7 @@ dependencies = [ "clap", "criterion-plot", "is-terminal", - "itertools 0.10.5", + "itertools", "num-traits", "once_cell", "oorandom", @@ -906,7 +768,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools 0.10.5", + "itertools", ] [[package]] @@ -1164,16 +1026,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "flate2" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1353,25 +1205,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.3.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "half" version = "2.4.1" @@ -1382,12 +1215,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.5" @@ -1404,20 +1231,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown 0.14.5", -] - -[[package]] -name = "hdrhistogram" -version = "7.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d" -dependencies = [ - "base64 0.21.7", - "byteorder", - "flate2", - "nom", - "num-traits", + "hashbrown", ] [[package]] @@ -1468,17 +1282,6 @@ dependencies = [ "digest", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.1.0" @@ -1490,71 +1293,18 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "httparse" version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "0.14.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-timeout" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" -dependencies = [ - "hyper", - "pin-project-lite", - "tokio", - "tokio-io-timeout", -] - [[package]] name = "idna" version = "0.5.0" @@ -1565,16 +1315,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.3.0" @@ -1582,7 +1322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown", ] [[package]] @@ -1623,15 +1363,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11" @@ -1751,24 +1482,9 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ - "hashbrown 0.14.5", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", + "hashbrown", ] -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "memchr" version = "2.7.4" @@ -1784,12 +1500,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1953,7 +1663,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.6.0", + "bitflags", "cfg-if", "foreign-types", "libc", @@ -2042,7 +1752,7 @@ version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.22.1", + "base64", "serde", ] @@ -2061,26 +1771,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -2197,38 +1887,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "prost" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-derive" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" -dependencies = [ - "anyhow", - "itertools 0.12.1", - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "prost-types" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" -dependencies = [ - "prost", -] - [[package]] name = "pyo3" version = "0.21.2" @@ -2373,7 +2031,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] @@ -2384,17 +2042,8 @@ checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -2405,15 +2054,9 @@ checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.4" @@ -2497,7 +2140,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.6.0", + "bitflags", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -2535,7 +2178,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -2548,12 +2191,6 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" -[[package]] -name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - [[package]] name = "ryu" version = "1.0.18" @@ -2604,7 +2241,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -2681,15 +2318,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -2784,12 +2412,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "synstructure" version = "0.13.1" @@ -2860,16 +2482,6 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "thread_local" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" -dependencies = [ - "cfg-if", - "once_cell", -] - [[package]] name = "threadpool" version = "1.8.1" @@ -2950,20 +2562,9 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "tracing", "windows-sys 0.52.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.4.0" @@ -2985,17 +2586,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-tungstenite" version = "0.21.0" @@ -3010,19 +2600,6 @@ dependencies = [ "tungstenite", ] -[[package]] -name = "tokio-util" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - [[package]] name = "toml_datetime" version = "0.6.8" @@ -3035,123 +2612,11 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.3.0", + "indexmap", "toml_datetime", "winnow", ] -[[package]] -name = "tonic" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" -dependencies = [ - "async-stream", - "async-trait", - "axum", - "base64 0.21.7", - "bytes", - "h2", - "http 0.2.12", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "tokio", - "tokio-stream", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite", - "rand", - "slab", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "once_cell", - "regex", - "sharded-slab", - "thread_local", - "tracing", - "tracing-core", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "tungstenite" version = "0.21.0" @@ -3161,7 +2626,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http 1.1.0", + "http", "httparse", "log", "native-tls", @@ -3240,12 +2705,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "vcpkg" version = "0.2.15" @@ -3268,15 +2727,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/crates/chia-client/Cargo.toml b/crates/chia-client/Cargo.toml index d5fa7c428..99ef3f6f4 100644 --- a/crates/chia-client/Cargo.toml +++ b/crates/chia-client/Cargo.toml @@ -27,7 +27,6 @@ hex-literal = { workspace = true } rand = { workspace = true } semver = { workspace = true } hex = { workspace = true } -console-subscriber = { workspace = true } [dev-dependencies] chia-ssl = { path = "../chia-ssl" } diff --git a/crates/chia-client/examples/client.rs b/crates/chia-client/examples/client.rs index 1d1c265cb..d79e5697f 100644 --- a/crates/chia-client/examples/client.rs +++ b/crates/chia-client/examples/client.rs @@ -9,7 +9,6 @@ use tokio::{sync::Mutex, time::sleep}; #[tokio::main] async fn main() -> anyhow::Result<()> { env_logger::init(); - // console_subscriber::init(); log::info!("Generating certificate"); let cert = ChiaCertificate::generate()?; @@ -20,8 +19,8 @@ async fn main() -> anyhow::Result<()> { tls_connector, ClientOptions { network: Network::mainnet(), - target_peers: 500, - connection_concurrency: 200, + target_peers: 1000, + connection_concurrency: 50, node_type: NodeType::Wallet, capabilities: vec![ (1, "1".to_string()), @@ -30,9 +29,9 @@ async fn main() -> anyhow::Result<()> { ], protocol_version: "0.0.34".parse()?, software_version: "0.0.0".to_string(), - connection_timeout: Duration::from_secs(3), - handshake_timeout: Duration::from_secs(2), - request_peers_timeout: Duration::from_secs(3), + connection_timeout: Duration::from_secs(5), + handshake_timeout: Duration::from_secs(5), + request_peers_timeout: Duration::from_secs(5), }, ); diff --git a/crates/chia-client/src/client.rs b/crates/chia-client/src/client.rs index 09dc7b2fb..c8f56da13 100644 --- a/crates/chia-client/src/client.rs +++ b/crates/chia-client/src/client.rs @@ -8,7 +8,7 @@ use std::{ time::Duration, }; -use chia_protocol::{Handshake, Message, NodeType, ProtocolMessageTypes, RespondPeers}; +use chia_protocol::{Handshake, Message, NodeType, ProtocolMessageTypes}; use chia_traits::Streamable; use dns_lookup::lookup_host; use futures_util::{stream::FuturesUnordered, StreamExt}; @@ -64,13 +64,13 @@ struct ClientInner { state: Arc>, options: ClientOptions, tls_connector: TlsConnector, + sender: Arc>, } /// A client that can connect to many different peers on the network. #[derive(Debug)] pub struct ClientState { peers: HashMap, - sender: mpsc::Sender, banned_ips: HashSet, trusted_ips: HashSet, } @@ -84,7 +84,6 @@ impl Client { let state = ClientState { peers: HashMap::new(), - sender, banned_ips: HashSet::new(), trusted_ips: HashSet::new(), }; @@ -93,6 +92,7 @@ impl Client { state: Arc::new(Mutex::new(state)), options, tls_connector, + sender: Arc::new(sender), })); (client, receiver) @@ -111,7 +111,6 @@ impl Client { if self.lock().await.peers.is_empty() { return; } - } else { } let state = self.lock().await; @@ -136,18 +135,34 @@ impl Client { } // Request new peers from the peer. - let Ok(Ok(response)): std::result::Result, _> = maybe_timeout( + let response = match maybe_timeout( trusted.contains(&peer.socket_addr().ip()), self.0.options.request_peers_timeout, peer.request_peers(), ) .await - else { - log::info!("Failed to request peers from {}", peer.socket_addr()); - - self.lock().await.ban(peer.socket_addr().ip()); - - continue; + { + Ok(Ok(response)) => response, + Err(error) | Ok(Err(error)) => { + log::info!( + "Failed to request peers from {} with error {error}", + peer.socket_addr() + ); + for peer_id in self.lock().await.ban(peer.socket_addr().ip()) { + self.lock().await.disconnect_peer(&peer_id); + self.0 + .sender + .send(Event::Disconnected(peer.socket_addr())) + .await + .ok(); + } + self.0 + .sender + .send(Event::Banned(peer.socket_addr().ip())) + .await + .ok(); + continue; + } }; log::info!("Requested peers from {}", peer.socket_addr()); @@ -249,7 +264,6 @@ impl Client { for &socket_addr in socket_addrs { // Skip peers which we are already connected to. - if self .lock() .await @@ -270,15 +284,25 @@ impl Client { while let Some((socket_addr, result)) = connections.next().await { match result { Err(error) => { - log::debug!("Failed to connect to peer {socket_addr} with error: {error}"); - - self.lock().await.ban(socket_addr.ip()); + log::debug!("Failed to connect to peer {socket_addr} with error {error}"); + for peer_id in self.lock().await.ban(socket_addr.ip()) { + self.lock().await.disconnect_peer(&peer_id); + self.0 + .sender + .send(Event::Disconnected(socket_addr)) + .await + .ok(); + } + self.0 + .sender + .send(Event::Banned(socket_addr.ip())) + .await + .ok(); } Ok((peer, receiver)) => { if self.lock().await.peers.len() >= self.0.options.target_peers { break; } - self.insert_peer(peer, receiver).await.ok(); log::info!("Connected to peer {socket_addr}"); } @@ -353,12 +377,16 @@ impl Client { let mut state = self.lock().await; let ip_addr = peer.socket_addr().ip(); + if state.is_banned(&ip_addr) { return Err(Error::BannedPeer(ip_addr)); } state.peers.insert(peer.peer_id(), peer.clone()); - state + + drop(state); + + self.0 .sender .send(Event::Connected(peer.peer_id(), peer.socket_addr())) .await?; @@ -370,6 +398,7 @@ impl Client { peer.peer_id(), peer.socket_addr(), receiver, + self.0.sender.clone(), )); Ok(()) @@ -381,20 +410,6 @@ impl ClientState { &self.peers } - pub fn disconnect_peer(&mut self, peer_id: &PeerId) { - if let Some(peer) = self.peers.remove(peer_id) { - // self.sender - // .send(Event::Disconnected(peer.socket_addr())) - // .await - // .ok(); - log::info!("Peer {} disconnected", peer.socket_addr()); - } - } - - pub fn disconnect_all(&mut self) { - self.peers.clear(); - } - pub fn banned_ips(&self) -> &HashSet { &self.banned_ips } @@ -403,32 +418,6 @@ impl ClientState { self.banned_ips.contains(ip_addr) } - pub fn ban(&mut self, ip_addr: IpAddr) { - if self.is_trusted(&ip_addr) { - log::warn!("Attempted to ban trusted peer {ip_addr}"); - return; - } - - if !self.banned_ips.insert(ip_addr) { - return; - } - - log::info!("Banning peer {ip_addr}"); - - // self.sender.send(Event::Banned(ip_addr)).await.ok(); - - let peer_ids: Vec = self - .peers - .keys() - .filter(|peer_id| self.peers[peer_id].socket_addr().ip() == ip_addr) - .copied() - .collect(); - - for peer_id in peer_ids { - self.disconnect_peer(&peer_id); - } - } - pub fn unban(&mut self, ip_addr: &IpAddr) { self.banned_ips.remove(ip_addr); } @@ -451,6 +440,31 @@ impl ClientState { pub fn untrust(&mut self, ip_addr: &IpAddr) { self.trusted_ips.remove(ip_addr); } + + pub fn disconnect_peer(&mut self, peer_id: &PeerId) { + if let Some(peer) = self.peers.remove(peer_id) { + log::info!("Peer {} disconnected", peer.socket_addr()); + } + } + + pub fn ban(&mut self, ip_addr: IpAddr) -> Vec { + if self.is_trusted(&ip_addr) { + log::warn!("Attempted to ban trusted peer {ip_addr}"); + return Vec::new(); + } + + log::info!("Banning {ip_addr}"); + self.banned_ips.insert(ip_addr); + + let peer_ids: Vec = self + .peers + .keys() + .filter(|peer_id| self.peers[peer_id].socket_addr().ip() == ip_addr) + .copied() + .collect(); + + peer_ids + } } async fn handle_peer_connection( @@ -458,19 +472,13 @@ async fn handle_peer_connection( peer_id: PeerId, socket_addr: SocketAddr, mut receiver: mpsc::Receiver, + sender: Arc>, ) { let mut is_banned = false; while let Some(message) = receiver.recv().await { - // If the client has been dropped, we should gracefully end the task. - let Some(state) = state.upgrade() else { - return; - }; - - let state = state.lock().await; - // Close the connection if an error occurs. - if let Err(error) = state.sender.send(Event::Message(peer_id, message)).await { + if let Err(error) = sender.send(Event::Message(peer_id, message)).await { log::warn!("Failed to send client message event: {error}"); is_banned = true; break; @@ -482,12 +490,15 @@ async fn handle_peer_connection( return; }; - let mut state = state.lock().await; - if is_banned { - state.ban(socket_addr.ip()); + for peer_id in state.lock().await.ban(socket_addr.ip()) { + state.lock().await.disconnect_peer(&peer_id); + sender.send(Event::Disconnected(socket_addr)).await.ok(); + } + sender.send(Event::Banned(socket_addr.ip())).await.ok(); } else { - state.disconnect_peer(&peer_id); + state.lock().await.disconnect_peer(&peer_id); + sender.send(Event::Disconnected(socket_addr)).await.ok(); } }