diff --git a/Cargo.lock b/Cargo.lock index 7f89ef038..31b19baa7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -66,7 +66,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -75,7 +75,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -105,6 +105,28 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2 1.0.86", + "quote 1.0.36", + "syn 2.0.87", +] + [[package]] name = "atty" version = "0.2.14" @@ -113,7 +135,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi 0.1.19", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -146,18 +168,18 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - [[package]] name = "base64" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64ct" version = "1.6.0" @@ -251,9 +273,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.13" +version = "1.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" +checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" dependencies = [ "jobserver", "libc", @@ -326,7 +348,7 @@ checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" dependencies = [ "castaway", "cfg-if 1.0.0", - "itoa 1.0.11", + "itoa", "rustversion", "ryu", "static_assertions", @@ -340,20 +362,14 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "core-foundation" -version = "0.7.0" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ - "core-foundation-sys 0.7.0", + "core-foundation-sys", "libc", ] -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -414,23 +430,14 @@ checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-mac" -version = "0.11.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "25fab6889090c8133f3deb8f73ba3c65a7f456f66436fc012a1b1e272b1e103e" dependencies = [ "generic-array", "subtle", ] -[[package]] -name = "ct-logs" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113" -dependencies = [ - "sct", -] - [[package]] name = "ctor" version = "0.1.26" @@ -532,7 +539,7 @@ dependencies = [ "ident_case", "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] @@ -543,7 +550,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] @@ -605,7 +612,7 @@ checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -650,7 +657,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] @@ -680,7 +687,7 @@ dependencies = [ "darling", "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] @@ -762,7 +769,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -771,22 +778,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags 1.3.2", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" version = "0.1.31" @@ -849,7 +840,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] @@ -877,7 +868,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.14", + "pin-project-lite", "pin-utils", "slab", ] @@ -962,7 +953,8 @@ dependencies = [ name = "grin_api" version = "5.4.0-alpha.0" dependencies = [ - "bytes 0.5.6", + "async-stream", + "bytes 1.7.1", "easy-jsonrpc-mw", "futures 0.3.30", "grin_chain", @@ -978,8 +970,9 @@ dependencies = [ "lazy_static", "log", "regex", - "ring", + "ring 0.16.20", "rustls", + "rustls-pemfile", "serde", "serde_derive", "serde_json", @@ -1134,6 +1127,7 @@ dependencies = [ name = "grin_servers" version = "5.4.0-alpha.0" dependencies = [ + "async-stream", "chrono", "fs2", "futures 0.3.30", @@ -1151,11 +1145,12 @@ dependencies = [ "lmdb-zero", "log", "rand 0.6.5", + "rustls", "serde", "serde_derive", "serde_json", "tokio", - "tokio-util 0.2.0", + "tokio-util", "walkdir", ] @@ -1204,30 +1199,23 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.7" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ - "bytes 0.5.6", + "bytes 1.7.1", "fnv", "futures-core", "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap", "slab", "tokio", - "tokio-util 0.3.1", + "tokio-util", "tracing", - "tracing-futures", ] -[[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" @@ -1276,17 +1264,18 @@ checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes 1.7.1", "fnv", - "itoa 1.0.11", + "itoa", ] [[package]] name = "http-body" -version = "0.3.1" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes 0.5.6", + "bytes 1.7.1", "http", + "pin-project-lite", ] [[package]] @@ -1297,9 +1286,9 @@ checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" -version = "0.3.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humansize" @@ -1324,11 +1313,11 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.13.10" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ - "bytes 0.5.6", + "bytes 1.7.1", "futures-channel", "futures-core", "futures-util", @@ -1337,8 +1326,8 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 0.4.8", - "pin-project", + "itoa", + "pin-project-lite", "socket2", "tokio", "tower-service", @@ -1348,30 +1337,27 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.20.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ - "bytes 0.5.6", - "ct-logs", - "futures-util", + "http", "hyper", "log", "rustls", "rustls-native-certs", "tokio", "tokio-rustls", - "webpki", ] [[package]] name = "hyper-timeout" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d1f9b0b8258e3ef8f45928021d3ef14096c2b93b99e4b8cfcabf1f58ec84b0a" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "bytes 0.5.6", "hyper", + "pin-project-lite", "tokio", "tokio-io-timeout", ] @@ -1383,7 +1369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", - "core-foundation-sys 0.8.7", + "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", @@ -1415,16 +1401,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 1.3.0", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.4.0" @@ -1432,24 +1408,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown", ] -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - [[package]] name = "itoa" version = "1.0.11" @@ -1487,16 +1448,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -1638,7 +1589,7 @@ dependencies = [ "thiserror", "thread-id", "typemap-ors", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1669,7 +1620,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1692,65 +1643,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.23" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", + "hermit-abi 0.3.9", "libc", - "log", - "miow 0.2.2", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-named-pipes" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" -dependencies = [ - "log", - "mio", - "miow 0.3.7", - "winapi 0.3.9", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi 0.3.9", + "wasi", + "windows-sys 0.52.0", ] [[package]] @@ -1764,17 +1664,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "nix" version = "0.29.0" @@ -1916,16 +1805,6 @@ dependencies = [ "autocfg 1.3.0", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - [[package]] name = "num_threads" version = "0.1.7" @@ -1977,7 +1856,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2024,7 +1903,7 @@ dependencies = [ "libc", "redox_syscall 0.1.57", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2042,9 +1921,9 @@ dependencies = [ [[package]] name = "password-hash" -version = "0.2.3" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e0b28ace46c5a396546bcf443bf422b57049617433d8854227352a4a9b24e7" +checksum = "c1a5d4e9c205d2c1ae73b84aab6240e98218c0e72e63b50422cfb2d1ca952282" dependencies = [ "base64ct", "rand_core 0.6.4", @@ -2080,32 +1959,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 1.0.86", - "quote 1.0.36", - "syn 2.0.75", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -2203,7 +2056,7 @@ dependencies = [ "fuchsia-cprng", "libc", "rand_core 0.3.1", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2222,7 +2075,7 @@ dependencies = [ "rand_os", "rand_pcg", "rand_xorshift", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2306,7 +2159,7 @@ checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" dependencies = [ "libc", "rand_core 0.4.2", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2320,7 +2173,7 @@ dependencies = [ "libc", "rand_core 0.4.2", "rdrand", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2416,9 +2269,23 @@ dependencies = [ "libc", "once_cell", "spin", - "untrusted", + "untrusted 0.7.1", "web-sys", - "winapi 0.3.9", + "winapi", +] + +[[package]] +name = "ring" +version = "0.17.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da5349ae27d3887ca812fb375b45a4fbb36d8d12d2df394968cd86e35683fe73" +dependencies = [ + "cc", + "cfg-if 1.0.0", + "getrandom", + "libc", + "untrusted 0.9.0", + "windows-sys 0.52.0", ] [[package]] @@ -2453,29 +2320,37 @@ dependencies = [ [[package]] name = "rustls" -version = "0.17.0" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" dependencies = [ - "base64 0.11.0", "log", - "ring", + "ring 0.16.20", "sct", "webpki", ] [[package]] name = "rustls-native-certs" -version = "0.3.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", - "rustls", + "rustls-pemfile", "schannel", "security-framework", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "rustversion" version = "1.0.17" @@ -2514,34 +2389,34 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.6.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.11", + "untrusted 0.9.0", ] [[package]] name = "security-framework" -version = "0.4.4" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", - "core-foundation-sys 0.7.0", + "core-foundation-sys", "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" -version = "0.4.3" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ - "core-foundation-sys 0.7.0", + "core-foundation-sys", "libc", ] @@ -2572,7 +2447,7 @@ checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] @@ -2581,7 +2456,7 @@ version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ - "itoa 1.0.11", + "itoa", "memchr", "ryu", "serde", @@ -2593,8 +2468,8 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.4.0", - "itoa 1.0.11", + "indexmap", + "itoa", "ryu", "serde", "unsafe-libyaml", @@ -2661,13 +2536,12 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.3.19" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ - "cfg-if 1.0.0", "libc", - "winapi 0.3.9", + "windows-sys 0.52.0", ] [[package]] @@ -2690,9 +2564,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "subtle" -version = "2.4.1" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "supercow" @@ -2724,9 +2598,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.75" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", @@ -2753,7 +2627,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5" dependencies = [ "dirs", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2791,7 +2665,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] @@ -2801,7 +2675,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe8f25bbdd100db7e1d34acf7fd2dc59c4bf8f7483f505eaa7d4f12f76cc0ea" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2811,7 +2685,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", - "itoa 1.0.11", + "itoa", "libc", "num-conv", "num_threads", @@ -2854,56 +2728,49 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "0.2.25" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "iovec", - "lazy_static", + "backtrace", + "bytes 1.7.1", "libc", - "memchr", "mio", - "mio-named-pipes", - "mio-uds", - "num_cpus", - "pin-project-lite 0.1.12", + "parking_lot 0.12.3", + "pin-project-lite", "signal-hook-registry", - "slab", + "socket2", "tokio-macros", - "winapi 0.3.9", + "windows-sys 0.52.0", ] [[package]] name = "tokio-io-timeout" -version = "0.4.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9390a43272c8a6ac912ed1d1e2b6abeafd5047e05530a2fa304deee041a06215" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ - "bytes 0.5.6", + "pin-project-lite", "tokio", ] [[package]] name = "tokio-macros" -version = "0.2.6" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", - "syn 1.0.109", + "syn 2.0.87", ] [[package]] name = "tokio-rustls" -version = "0.13.1" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "futures-core", "rustls", "tokio", "webpki", @@ -2911,29 +2778,14 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.2.0" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ - "bytes 0.5.6", + "bytes 1.7.1", "futures-core", "futures-sink", - "log", - "pin-project-lite 0.1.12", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.1.12", + "pin-project-lite", "tokio", ] @@ -2958,8 +2810,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", - "pin-project-lite 0.2.14", + "pin-project-lite", "tracing-core", ] @@ -2972,16 +2823,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -3063,6 +2904,12 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.2" @@ -3139,7 +2986,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", "wasm-bindgen-shared", ] @@ -3161,7 +3008,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3184,20 +3031,14 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.4" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring", - "untrusted", + "ring 0.17.11", + "untrusted 0.9.0", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -3208,12 +3049,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -3332,17 +3167,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi", ] [[package]] @@ -3375,7 +3200,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] @@ -3395,7 +3220,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", - "syn 2.0.75", + "syn 2.0.87", ] [[package]] diff --git a/api/Cargo.toml b/api/Cargo.toml index ae6b02006..876e94aaa 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" [dependencies] easy-jsonrpc-mw = "0.5.4" -hyper = "0.13" +hyper = { version = "0.14", features = ["full"] } lazy_static = "1" regex = "1" ring = "0.16" @@ -20,15 +20,17 @@ serde_derive = "1" serde_json = "1" thiserror = "1" log = "0.4" -tokio = { version = "0.2", features = ["full"] } -tokio-rustls = "0.13" +tokio = { version = "1", features = ["full"] } +tokio-rustls = "0.23" http = "0.2" -hyper-rustls = "0.20" -hyper-timeout = "0.3" +hyper-rustls = "0.23" +hyper-timeout = "0.4" futures = "0.3" -rustls = "0.17" +rustls = "0.20" +rustls-pemfile = "1.0" +async-stream = "0.3" url = "2.1" -bytes = "0.5" +bytes = "1" grin_core = { path = "../core", version = "5.4.0-alpha.0" } grin_chain = { path = "../chain", version = "5.4.0-alpha.0" } diff --git a/api/src/client.rs b/api/src/client.rs index cc5d490df..a03e8da65 100644 --- a/api/src/client.rs +++ b/api/src/client.rs @@ -216,7 +216,12 @@ where } async fn send_request_async(req: Request, timeout: TimeOut) -> Result { - let https = hyper_rustls::HttpsConnector::new(); + let https = hyper_rustls::HttpsConnectorBuilder::new() + .with_native_roots() + .https_or_http() + .enable_http1() + .build(); + let (connect, read, write) = ( Some(timeout.connect), Some(timeout.read), @@ -242,7 +247,7 @@ async fn send_request_async(req: Request, timeout: TimeOut) -> Result, timeout: TimeOut) -> Result, timeout: TimeOut) -> Result { - let mut rt = Builder::new() - .basic_scheduler() + let rt = Builder::new_current_thread() .enable_all() .build() .map_err(|e| Error::RequestError(format!("{}", e)))?; diff --git a/api/src/json_rpc.rs b/api/src/json_rpc.rs index 6728ca705..2d997e75e 100644 --- a/api/src/json_rpc.rs +++ b/api/src/json_rpc.rs @@ -97,7 +97,7 @@ pub enum Error { /// Json error Json(serde_json::Error), /// Client error - Hyper(hyper::error::Error), + Hyper(hyper::Error), /// Error response Rpc(RpcError), /// Response to a request did not have the expected nonce @@ -120,8 +120,8 @@ impl From for Error { } } -impl From for Error { - fn from(e: hyper::error::Error) -> Error { +impl From for Error { + fn from(e: hyper::Error) -> Error { Error::Hyper(e) } } diff --git a/api/src/rest.rs b/api/src/rest.rs index 31e7468d8..2f97017f9 100644 --- a/api/src/rest.rs +++ b/api/src/rest.rs @@ -21,11 +21,10 @@ use crate::router::{Handler, HandlerObj, ResponseFuture, Router, RouterError}; use crate::web::response; use futures::channel::oneshot; -use futures::TryStreamExt; use hyper::server::accept; use hyper::service::make_service_fn; use hyper::{Body, Request, Server, StatusCode}; -use rustls::internal::pemfile; +use rustls_pemfile as pemfile; use std::convert::Infallible; use std::fs::File; use std::net::SocketAddr; @@ -33,7 +32,6 @@ use std::sync::Arc; use std::{io, thread}; use tokio::net::TcpListener; use tokio::runtime::Runtime; -use tokio::stream::StreamExt; use tokio_rustls::TlsAcceptor; /// Errors that can be returned by an ApiEndpoint implementation. @@ -83,8 +81,10 @@ impl TLSConfig { })?; let mut reader = io::BufReader::new(certfile); - pemfile::certs(&mut reader) - .map_err(|_| Error::Internal("failed to load certificate".to_string())) + let certs = pemfile::certs(&mut reader) + .map_err(|_| Error::Internal("failed to load certificate".to_string()))?; + + Ok(certs.into_iter().map(rustls::Certificate).collect()) } fn load_private_key(&self) -> Result { @@ -97,15 +97,19 @@ impl TLSConfig { if keys.len() != 1 { return Err(Error::Internal("expected a single private key".to_string())); } - Ok(keys[0].clone()) + Ok(rustls::PrivateKey(keys[0].clone())) } pub fn build_server_config(&self) -> Result, Error> { let certs = self.load_certs()?; let key = self.load_private_key()?; - let mut cfg = rustls::ServerConfig::new(rustls::NoClientAuth::new()); - cfg.set_single_cert(certs, key) + + let cfg = rustls::ServerConfig::builder() + .with_safe_defaults() + .with_no_client_auth() + .with_single_cert(certs, key) .map_err(|e| Error::Internal(format!("set single certificate failed {}", e)))?; + Ok(Arc::new(cfg)) } } @@ -175,7 +179,7 @@ impl ApiServer { server.await }; - let mut rt = Runtime::new() + let rt = Runtime::new() .map_err(|e| eprintln!("HTTP API server error: {}", e)) .unwrap(); if let Err(e) = rt.block_on(server) { @@ -214,13 +218,26 @@ impl ApiServer { .name("apis".to_string()) .spawn(move || { let server = async move { - let mut listener = TcpListener::bind(&addr).await.expect("failed to bind"); - let listener = listener - .incoming() - .and_then(move |s| acceptor.accept(s)) - .filter(|r| r.is_ok()); + let listener = TcpListener::bind(&addr).await.expect("failed to bind"); - let server = Server::builder(accept::from_stream(listener)) + let tls_stream = async_stream::stream! { + loop { + let (socket, _addr) = match listener.accept().await { + Ok(conn) => conn, + Err(e) => { + eprintln!("Error accepting connection: {}", e); + continue; + } + }; + + match acceptor.accept(socket).await { + Ok(stream) => yield Ok::<_, std::io::Error>(stream), + Err(_) => continue, + } + } + }; + + let server = Server::builder(accept::from_stream(tls_stream)) .serve(make_service_fn(move |_| { let router = router.clone(); async move { Ok::<_, Infallible>(router) } @@ -232,7 +249,7 @@ impl ApiServer { server.await }; - let mut rt = Runtime::new() + let rt = Runtime::new() .map_err(|e| eprintln!("HTTP API server error: {}", e)) .unwrap(); if let Err(e) = rt.block_on(server) { diff --git a/api/src/web.rs b/api/src/web.rs index dd6ad09cb..2a923d915 100644 --- a/api/src/web.rs +++ b/api/src/web.rs @@ -1,12 +1,12 @@ use crate::rest::*; use crate::router::ResponseFuture; -use bytes::Buf; use futures::future::ok; use hyper::body; use hyper::{Body, Request, Response, StatusCode}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fmt::Debug; +use std::io::Cursor; use url::form_urlencoded; /// Parse request body @@ -18,7 +18,8 @@ where .await .map_err(|e| Error::RequestError(format!("Failed to read request: {}", e)))?; - serde_json::from_reader(raw.bytes()) + let cursor = Cursor::new(raw); + serde_json::from_reader(cursor) .map_err(|e| Error::RequestError(format!("Invalid request body: {}", e))) } diff --git a/core/src/core/pmmr/pmmr.rs b/core/src/core/pmmr/pmmr.rs index 4d503bcb2..17cb21bdd 100644 --- a/core/src/core/pmmr/pmmr.rs +++ b/core/src/core/pmmr/pmmr.rs @@ -188,7 +188,7 @@ where B: 'a + Backend, { /// Build a new prunable Merkle Mountain Range using the provided backend. - pub fn new(backend: &'a mut B) -> PMMR<'_, T, B> { + pub fn new(backend: &'a mut B) -> PMMR<'a, T, B> { PMMR { backend, size: 0, @@ -198,7 +198,7 @@ where /// Build a new prunable Merkle Mountain Range pre-initialized until /// size with the provided backend. - pub fn at(backend: &'a mut B, size: u64) -> PMMR<'_, T, B> { + pub fn at(backend: &'a mut B, size: u64) -> PMMR<'a, T, B> { PMMR { backend, size, diff --git a/core/src/core/pmmr/readonly_pmmr.rs b/core/src/core/pmmr/readonly_pmmr.rs index b9f720e52..0ede953c5 100644 --- a/core/src/core/pmmr/readonly_pmmr.rs +++ b/core/src/core/pmmr/readonly_pmmr.rs @@ -41,7 +41,7 @@ where B: 'a + Backend, { /// Build a new readonly PMMR. - pub fn new(backend: &'a B) -> ReadonlyPMMR<'_, T, B> { + pub fn new(backend: &'a B) -> ReadonlyPMMR<'a, T, B> { ReadonlyPMMR { backend, size: 0, @@ -51,7 +51,7 @@ where /// Build a new readonly PMMR pre-initialized to /// size with the provided backend. - pub fn at(backend: &'a B, size: u64) -> ReadonlyPMMR<'_, T, B> { + pub fn at(backend: &'a B, size: u64) -> ReadonlyPMMR<'a, T, B> { ReadonlyPMMR { backend, size, diff --git a/core/src/core/pmmr/rewindable_pmmr.rs b/core/src/core/pmmr/rewindable_pmmr.rs index 3610d082c..abc5b5535 100644 --- a/core/src/core/pmmr/rewindable_pmmr.rs +++ b/core/src/core/pmmr/rewindable_pmmr.rs @@ -40,7 +40,7 @@ where B: 'a + Backend, { /// Build a new readonly PMMR. - pub fn new(backend: &'a B) -> RewindablePMMR<'_, T, B> { + pub fn new(backend: &'a B) -> RewindablePMMR<'a, T, B> { RewindablePMMR { backend, last_pos: 0, @@ -50,7 +50,7 @@ where /// Build a new readonly PMMR pre-initialized to /// last_pos with the provided backend. - pub fn at(backend: &'a B, last_pos: u64) -> RewindablePMMR<'_, T, B> { + pub fn at(backend: &'a B, last_pos: u64) -> RewindablePMMR<'a, T, B> { RewindablePMMR { backend, last_pos, diff --git a/servers/Cargo.toml b/servers/Cargo.toml index 8890077ab..7195ca661 100644 --- a/servers/Cargo.toml +++ b/servers/Cargo.toml @@ -10,8 +10,8 @@ workspace = ".." edition = "2018" [dependencies] -hyper = "0.13" -hyper-rustls = "0.20" +hyper = { version = "0.14", features = ["full"] } +hyper-rustls = "0.23" fs2 = "0.4" futures = "0.3" http = "0.2" @@ -22,8 +22,10 @@ log = "0.4" serde_derive = "1" serde_json = "1" chrono = "0.4.11" -tokio = {version = "0.2", features = ["full"] } -tokio-util = { version = "0.2", features = ["codec"] } +tokio = { version = "1", features = ["full"] } +tokio-util = { version = "0.7", features = ["codec"] } +async-stream = "0.3" +rustls = "0.20" walkdir = "2.3.1" grin_api = { path = "../api", version = "5.4.0-alpha.0" } diff --git a/servers/src/common/hooks.rs b/servers/src/common/hooks.rs index 966a5a677..b6522d559 100644 --- a/servers/src/common/hooks.rs +++ b/servers/src/common/hooks.rs @@ -220,7 +220,12 @@ impl WebHook { nthreads, timeout ); - let https = HttpsConnector::new(); + let https = hyper_rustls::HttpsConnectorBuilder::new() + .with_native_roots() + .https_only() + .enable_http1() + .build(); + let client = Client::builder() .pool_idle_timeout(keep_alive) .build::<_, hyper::Body>(https); @@ -231,10 +236,9 @@ impl WebHook { header_received_url, block_accepted_url, client, - runtime: Builder::new() - .threaded_scheduler() + runtime: Builder::new_multi_thread() .enable_all() - .core_threads(nthreads as usize) + .worker_threads(nthreads as usize) .build() .unwrap(), } diff --git a/servers/src/mining/stratumserver.rs b/servers/src/mining/stratumserver.rs index eaab65ae6..d39312a56 100644 --- a/servers/src/mining/stratumserver.rs +++ b/servers/src/mining/stratumserver.rs @@ -602,64 +602,72 @@ impl Handler { fn accept_connections(listen_addr: SocketAddr, handler: Arc) { info!("Start tokio stratum server"); let task = async move { - let mut listener = TcpListener::bind(&listen_addr).await.unwrap_or_else(|_| { + let listener = TcpListener::bind(&listen_addr).await.unwrap_or_else(|_| { panic!("Stratum: Failed to bind to listen address {}", listen_addr) }); - let server = listener - .incoming() - .filter_map(|s| async { s.map_err(|e| error!("accept error = {:?}", e)).ok() }) - .for_each(move |socket| { - let handler = handler.clone(); - async move { - // Spawn a task to process the connection - let (tx, mut rx) = mpsc::unbounded(); - - let worker_id = handler.workers.add_worker(tx); - info!("Worker {} connected", worker_id); - - let framed = Framed::new(socket, LinesCodec::new()); - let (mut writer, mut reader) = framed.split(); - - let h = handler.clone(); - let read = async move { - while let Some(line) = reader - .try_next() - .await - .map_err(|e| error!("error reading line: {}", e))? - { - let request = serde_json::from_str(&line) - .map_err(|e| error!("error serializing line: {}", e))?; - let resp = h.handle_rpc_requests(request, worker_id); - h.workers.send_to(worker_id, resp); - } - - Result::<_, ()>::Ok(()) - }; - - let write = async move { - while let Some(line) = rx.next().await { - writer - .send(line) - .await - .map_err(|e| error!("error writing line: {}", e))?; - } - - Result::<_, ()>::Ok(()) - }; - - let task = async move { - pin_mut!(read, write); - futures::future::select(read, write).await; - handler.workers.remove_worker(worker_id); - info!("Worker {} disconnected", worker_id); - }; - tokio::spawn(task); + let server = async_stream::stream! { + loop { + match listener.accept().await { + Ok((socket, _)) => yield socket, + Err(e) => { + error!("accept error = {:?}", e); + continue; + } } - }); + } + } + .for_each(move |socket| { + let handler = handler.clone(); + async move { + // Spawn a task to process the connection + let (tx, mut rx) = mpsc::unbounded(); + + let worker_id = handler.workers.add_worker(tx); + info!("Worker {} connected", worker_id); + + let framed = Framed::new(socket, LinesCodec::new()); + let (mut writer, mut reader) = framed.split(); + + let h = handler.clone(); + let read = async move { + while let Some(line) = reader + .try_next() + .await + .map_err(|e| error!("error reading line: {}", e))? + { + let request = serde_json::from_str(&line) + .map_err(|e| error!("error serializing line: {}", e))?; + let resp = h.handle_rpc_requests(request, worker_id); + h.workers.send_to(worker_id, resp); + } + + Result::<_, ()>::Ok(()) + }; + + let write = async move { + while let Some(line) = rx.next().await { + writer + .send(line) + .await + .map_err(|e| error!("error writing line: {}", e))?; + } + + Result::<_, ()>::Ok(()) + }; + + let task = async move { + pin_mut!(read, write); + futures::future::select(read, write).await; + handler.workers.remove_worker(worker_id); + info!("Worker {} disconnected", worker_id); + }; + tokio::spawn(task); + } + }); server.await }; - let mut rt = Runtime::new().unwrap(); + let rt = Runtime::new().unwrap(); rt.block_on(task); }