diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..5099d2b39 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,42 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-20.04 + env: + CARGO_TERM_COLOR: always + + steps: + - uses: actions/checkout@v2 + + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + + #- name: Check formatting + # run: cargo fmt -- --check + + - name: Check for errors + run: cargo check + + - name: Tests (Bitcoin mode, REST+Electrum) + run: cargo test + + - name: Tests (Liquid mode, REST) + run: cargo test --features liquid \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 4c2ce8b81..7e672485a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.17.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -17,6 +17,30 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aho-corasick" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "ansi_term" version = "0.12.1" @@ -26,6 +50,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + [[package]] name = "arraydeque" version = "0.4.5" @@ -34,15 +64,15 @@ checksum = "f0ffd3d69bd89910509a5d31d1f1353f38ccffdd116dd0099bbd6627f7bd8ad8" [[package]] name = "arrayref" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "ascii" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf56136a5198c7b01a49e3afcbef6cf84597273d298f54432926024107b0109" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" [[package]] name = "atty" @@ -50,7 +80,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi 0.3.9", ] @@ -63,9 +93,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.65" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -76,6 +106,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + [[package]] name = "base64" version = "0.10.1" @@ -87,9 +123,24 @@ dependencies = [ [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "base64-compat" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "5a8d4d2746f89841e49230dd26917df1876050f95abafafbe34f47cb534b88d7" +dependencies = [ + "byteorder", +] [[package]] name = "bech32" @@ -118,7 +169,7 @@ version = "0.59.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -163,12 +214,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" -[[package]] -name = "bitcoin_hashes" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b375d62f341cef9cd9e77793ec8f1db3fc9ce2e4d57e982c8fe697a2c16af3b6" - [[package]] name = "bitcoin_hashes" version = "0.10.0" @@ -178,6 +223,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bitcoin_hashes" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" + [[package]] name = "bitcoin_hashes" version = "0.12.0" @@ -188,17 +239,54 @@ dependencies = [ "serde", ] +[[package]] +name = "bitcoind" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e4a98e66bb7c1f81abf4f8d992e1839fc0f9cbc627effbff122aae7d5e493a0" +dependencies = [ + "anyhow", + "core-rpc", + "log", + "tempfile", + "which", +] + +[[package]] +name = "bitcoind" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee93e3628c679646a9f1cb2e4c55ec10fc3d477a2a8c26dcde4267dfb2e2109a" +dependencies = [ + "anyhow", + "bitcoin_hashes 0.12.0", + "core-rpc", + "flate2", + "log", + "minreq", + "tar", + "tempfile", + "which", + "zip", +] + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" @@ -208,17 +296,39 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.1.0" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] [[package]] name = "cc" -version = "1.0.73" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -238,28 +348,29 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ - "libc", - "num-integer", + "android-tzdata", + "iana-time-zone", + "js-sys", "num-traits", - "time 0.1.43", + "wasm-bindgen", "winapi 0.3.9", ] [[package]] name = "chunked_transfer" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" +checksum = "cca491388666e04d7248af3f60f0c40cfb0991c72205595d7c396e3510207d1a" [[package]] name = "clang-sys" -version = "1.3.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", @@ -274,18 +385,92 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", - "bitflags", + "bitflags 1.3.2", "strsim", "textwrap", "unicode-width", "vec_map", ] +[[package]] +name = "const_fn" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" + +[[package]] +name = "cookie" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" +dependencies = [ + "percent-encoding", + "time 0.2.27", + "version_check", +] + +[[package]] +name = "cookie_store" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3818dfca4b0cb5211a659bbcbb94225b7127407b2b135e650d717bfb78ab10d3" +dependencies = [ + "cookie", + "idna 0.2.3", + "log", + "publicsuffix", + "serde", + "serde_json", + "time 0.2.27", + "url", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "core-rpc" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d77079e1b71c2778d6e1daf191adadcd4ff5ec3ccad8298a79061d865b235b" +dependencies = [ + "bitcoin-private", + "core-rpc-json", + "jsonrpc 0.13.0", + "log", + "serde", + "serde_json", +] + +[[package]] +name = "core-rpc-json" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581898ed9a83f31c64731b1d8ca2dfffcfec14edf1635afacd5234cddbde3a41" +dependencies = [ + "bitcoin 0.30.1", + "bitcoin-private", + "serde", + "serde_json", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -293,9 +478,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -304,28 +489,32 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "lazy_static", "memoffset", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", - "lazy_static", ] +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" + [[package]] name = "dirs" version = "4.0.0" @@ -346,11 +535,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "either" -version = "1.6.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "electrs" @@ -358,14 +553,17 @@ version = "0.4.1" dependencies = [ "arraydeque", "arrayref", - "base64 0.13.0", + "base64 0.13.1", "bincode", "bitcoin 0.30.1", + "bitcoind 0.32.0", "clap", "crossbeam-channel", "dirs", "electrum-client", + "electrumd", "elements", + "elementsd", "error-chain", "glob", "hex-conservative", @@ -386,13 +584,14 @@ dependencies = [ "serde_derive", "serde_json", "signal-hook", - "socket2", + "socket2 0.4.9", "stderrlog", "sysconf", "tempfile", - "time 0.3.9", + "time 0.3.27", "tiny_http", "tokio", + "ureq 2.7.1", "url", ] @@ -403,12 +602,26 @@ source = "git+https://github.com/Blockstream/rust-electrum-client?rev=d379235299 dependencies = [ "bitcoin 0.27.1", "log", - "rustls", + "rustls 0.16.0", "serde", "serde_json", "socks", "webpki", - "webpki-roots", + "webpki-roots 0.19.0", +] + +[[package]] +name = "electrumd" +version = "0.1.0" +source = "git+https://github.com/shesek/electrumd?rev=6eac0b7b1f2447472016e2c1473a6284f7f8648e#6eac0b7b1f2447472016e2c1473a6284f7f8648e" +dependencies = [ + "bitcoin_hashes 0.10.0", + "home", + "jsonrpc 0.12.0", + "log", + "rand 0.8.5", + "tempfile", + "ureq 1.5.5", ] [[package]] @@ -424,6 +637,19 @@ dependencies = [ "slip21", ] +[[package]] +name = "elementsd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e29d7e41d2344815269c7c716c89b8c34758e670e90c00982506ded5d590b402" +dependencies = [ + "bitcoin_hashes 0.12.0", + "bitcoind 0.30.0", + "flate2", + "minreq", + "tar", +] + [[package]] name = "errno" version = "0.2.8" @@ -435,6 +661,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "errno" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + [[package]] name = "errno-dragonfly" version = "0.1.2" @@ -457,11 +694,30 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.7.0" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "filetime" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.3.5", + "windows-sys", +] + +[[package]] +name = "flate2" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ - "instant", + "crc32fast", + "miniz_oxide", ] [[package]] @@ -472,11 +728,10 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ - "matches", "percent-encoding", ] @@ -488,41 +743,41 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.29", ] [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-core", "futures-macro", @@ -540,26 +795,26 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] name = "gimli" -version = "0.26.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hermit-abi" @@ -570,6 +825,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + [[package]] name = "hex" version = "0.4.3" @@ -588,11 +849,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "http" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -601,9 +871,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", @@ -612,21 +882,21 @@ dependencies = [ [[package]] name = "httparse" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6330e8a36bd8c859f3fa6d9382911fbb7147ec39807f63b923933a247240b9ba" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.18" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -638,7 +908,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -658,6 +928,29 @@ dependencies = [ "tokio", ] +[[package]] +name = "iana-time-zone" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "idna" version = "0.2.3" @@ -670,47 +963,70 @@ dependencies = [ ] [[package]] -name = "instant" -version = "0.1.12" +name = "idna" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ - "cfg-if", + "unicode-bidi", + "unicode-normalization", ] [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.57" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonrpc" +version = "0.12.0" +source = "git+https://github.com/shesek/rust-jsonrpc?branch=202201-nonarray#aaa0af349bd4885a59f6f6ba1753e78279014f98" +dependencies = [ + "base64-compat", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "jsonrpc" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd8d6b3f301ba426b30feca834a2a18d48d5b54e5065496b5c1b05537bee3639" +dependencies = [ + "base64 0.13.1", + "serde", + "serde_json", +] + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -735,15 +1051,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.124" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", "winapi 0.3.9", @@ -761,11 +1077,17 @@ dependencies = [ "libc", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -773,30 +1095,27 @@ dependencies = [ [[package]] name = "log" -version = "0.4.16" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" -dependencies = [ - "cfg-if", -] +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" [[package]] name = "matches" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -809,107 +1128,80 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] -name = "mio" -version = "0.8.2" +name = "minreq" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" +checksum = "67aaf8c0382c4bf06dff8318690b7ce57d3a25dd0a777ba635e987e32c638509" dependencies = [ - "libc", "log", - "miow", - "ntapi", - "wasi 0.11.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "once_cell", + "rustls 0.21.6", + "rustls-webpki", + "webpki-roots 0.25.2", ] [[package]] -name = "miow" -version = "0.3.7" +name = "mio" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ - "winapi 0.3.9", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", ] [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "num-integer" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -dependencies = [ - "autocfg", - "num-traits", -] - [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_threads" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba1801fb138d8e85e11d0fc70baf4fe1cdfffda7c6cd34a854905df588e5ed0" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ + "hermit-abi 0.3.2", "libc", ] [[package]] name = "object" -version = "0.28.3" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40bec70ba014595f99f7aa110b84331ffe1ee9aece7fe6f387cc7e3ecda4d456" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.10.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "page_size" @@ -923,27 +1215,25 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", - "instant", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "smallvec", - "winapi 0.3.9", + "windows-targets", ] [[package]] @@ -954,35 +1244,35 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project" -version = "1.0.10" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.29", ] [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -990,26 +1280,38 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + [[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + [[package]] name = "proc-macro2" -version = "1.0.37" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "prometheus" -version = "0.13.0" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f64969ffd5dd8f39bd57a68ac53c163a095ed9d0fb707146da1b27025a3504" +checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" dependencies = [ "cfg-if", "fnv", @@ -1022,15 +1324,34 @@ dependencies = [ [[package]] name = "protobuf" -version = "2.27.1" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + +[[package]] +name = "publicsuffix" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f" +dependencies = [ + "idna 0.2.3", + "url", +] + +[[package]] +name = "qstring" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" +dependencies = [ + "percent-encoding", +] [[package]] name = "quote" -version = "1.0.18" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -1105,21 +1426,19 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.2" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -1138,11 +1457,20 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1152,33 +1480,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "regex" -version = "1.5.5" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", "regex-syntax", ] [[package]] -name = "regex-syntax" -version = "0.6.25" +name = "regex-automata" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "regex-syntax" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "ring" @@ -1225,14 +1558,14 @@ dependencies = [ "libc", "rand 0.3.23", "rustc-serialize", - "time 0.1.43", + "time 0.1.45", ] [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" @@ -1246,6 +1579,28 @@ version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bfe0f2582b4931a45d1fa608f8a8722e8b3c7ac54dd6d5f3b3212791fedef49" +dependencies = [ + "bitflags 2.4.0", + "errno 0.3.2", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustls" version = "0.16.0" @@ -1255,21 +1610,56 @@ dependencies = [ "base64 0.10.1", "log", "ring", - "sct", + "sct 0.6.1", "webpki", ] +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.1", + "log", + "ring", + "sct 0.6.1", + "webpki", +] + +[[package]] +name = "rustls" +version = "0.21.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct 0.7.0", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" @@ -1281,6 +1671,16 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "secp256k1" version = "0.20.3" @@ -1344,37 +1744,67 @@ dependencies = [ "secp256k1-sys 0.8.1", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" -version = "1.0.136" +version = "1.0.187" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "30a7fe14252655bd1e578af19f5fa00fe02fd0013b100ca6b49fde31c41bae4c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.187" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "e46b2a6ca578b3f1d4501b12f78ed4692006d79d82a1a7c561c12dbc3d625eb8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.29", ] [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "sha1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" + [[package]] name = "shlex" version = "1.1.0" @@ -1383,9 +1813,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" dependencies = [ "libc", "signal-hook-registry", @@ -1393,44 +1823,57 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] [[package]] name = "slab" -version = "0.4.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] [[package]] name = "slip21" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acff9a1a0f4d902c8184bdde5338861dd95eb1397a12c4df78fb0b6ebeed4cbe" +checksum = "516f52f3cec67962a9c414130251b512f2ff47f81980411ae01b6ce540b1ca6b" dependencies = [ - "bitcoin_hashes 0.7.6", + "bitcoin_hashes 0.11.0", ] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "socket2" -version = "0.4.4" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi 0.3.9", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "socks" version = "0.3.4" @@ -1448,11 +1891,20 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + [[package]] name = "stderrlog" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a53e2eff3e94a019afa6265e8ee04cb05b9d33fe9f5078b14e4e391d155a38" +checksum = "69a26bbf6de627d389164afa9783739b56746c6c72c4ed16539f4ff54170327b" dependencies = [ "atty", "chrono", @@ -1461,6 +1913,55 @@ dependencies = [ "thread_local", ] +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + [[package]] name = "strsim" version = "0.8.0" @@ -1469,13 +1970,24 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.91" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -1484,24 +1996,34 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59e93f5d45535f49b6a05ef7ac2f0f795d28de494cf53a512751602c9849bea3" dependencies = [ - "errno", + "errno 0.2.8", "kernel32-sys", "libc", "winapi 0.2.8", ] +[[package]] +name = "tar" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "tempfile" -version = "3.3.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi 0.3.9", + "redox_syscall 0.3.5", + "rustix", + "windows-sys", ] [[package]] @@ -1524,60 +2046,110 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.29", ] [[package]] name = "thread_local" -version = "1.0.1" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "lazy_static", + "cfg-if", + "once_cell", ] [[package]] name = "time" -version = "0.1.43" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi 0.3.9", ] [[package]] name = "time" -version = "0.3.9" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" dependencies = [ - "itoa", + "const_fn", "libc", - "num_threads", - "time-macros", + "standback", + "stdweb", + "time-macros 0.1.1", + "version_check", + "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +dependencies = [ + "deranged", + "itoa", + "serde", + "time-core", + "time-macros 0.2.13", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + [[package]] name = "time-macros" -version = "0.2.4" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" +dependencies = [ + "time-core", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn 1.0.109", +] [[package]] name = "tiny_http" @@ -1588,62 +2160,63 @@ dependencies = [ "ascii", "chunked_transfer", "log", - "time 0.3.9", + "time 0.3.27", "url", ] [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.17.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ + "backtrace", "libc", "mio", "num_cpus", "pin-project-lite", - "socket2", + "socket2 0.5.3", "tokio-macros", - "winapi 0.3.9", + "windows-sys", ] [[package]] name = "tokio-macros" -version = "1.7.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.29", ] [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.34" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite", @@ -1652,45 +2225,45 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.26" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "untrusted" @@ -1698,15 +2271,47 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "ureq" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b8b063c2d59218ae09f22b53c42eaad0d53516457905f5235ca4bc9e99daa71" +dependencies = [ + "base64 0.13.1", + "chunked_transfer", + "cookie", + "cookie_store", + "log", + "once_cell", + "qstring", + "rustls 0.19.1", + "url", + "webpki", + "webpki-roots 0.21.1", +] + +[[package]] +name = "ureq" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9" +dependencies = [ + "base64 0.21.2", + "log", + "once_cell", + "serde", + "serde_json", + "url", +] + [[package]] name = "url" -version = "2.2.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", - "idna", - "matches", + "idna 0.4.0", "percent-encoding", ] @@ -1724,19 +2329,18 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasi" @@ -1746,9 +2350,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1756,24 +2360,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.29", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1781,28 +2385,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.57" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -1827,6 +2431,32 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + +[[package]] +name = "which" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +dependencies = [ + "either", + "libc", + "once_cell", +] + [[package]] name = "winapi" version = "0.2.8" @@ -1869,3 +2499,101 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "xattr" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +dependencies = [ + "libc", +] + +[[package]] +name = "zip" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" +dependencies = [ + "byteorder", + "bzip2", + "crc32fast", + "flate2", + "thiserror", + "time 0.1.45", +] diff --git a/Cargo.toml b/Cargo.toml index 7c4d2da86..8f8bacce1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,10 @@ electrum-client = { version = "0.8", optional = true } [dev-dependencies] +bitcoind = { version = "0.32.0", features = [ "25_0" ] } +elementsd = { version = "0.8.0", features = [ "22_1_1" ] } +electrumd = { version = "0.1.0", features = [ "4_1_5" ] } +ureq = { version = "2.4", default-features = false, features = [ "json" ] } tempfile = "3.0" [profile.release] @@ -71,3 +75,8 @@ codegen-units = 1 [patch.crates-io.electrum-client] git = "https://github.com/Blockstream/rust-electrum-client" rev = "d3792352992a539afffbe11501d1aff9fd5b919d" # add-peer branch + +# not yet published on crates.io +[patch.crates-io.electrumd] +git = "https://github.com/shesek/electrumd" +rev = "6eac0b7b1f2447472016e2c1473a6284f7f8648e" diff --git a/src/chain.rs b/src/chain.rs index 737244efe..9876580f5 100644 --- a/src/chain.rs +++ b/src/chain.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "liquid"))] // use regular Bitcoin data structures pub use bitcoin::{ address, blockdata::block::Header as BlockHeader, blockdata::script, consensus::deserialize, - hash_types::TxMerkleNode, Block, BlockHash, OutPoint, ScriptBuf as Script, Sequence, + hash_types::TxMerkleNode, Address, Block, BlockHash, OutPoint, ScriptBuf as Script, Sequence, Transaction, TxIn, TxOut, Txid, }; diff --git a/src/config.rs b/src/config.rs index 309b4f19b..cec2b3f0d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -341,22 +341,9 @@ impl Config { default_dir.push(".bitcoin"); default_dir }); - match network_type { - #[cfg(not(feature = "liquid"))] - Network::Bitcoin => (), - #[cfg(not(feature = "liquid"))] - Network::Testnet => daemon_dir.push("testnet3"), - #[cfg(not(feature = "liquid"))] - Network::Regtest => daemon_dir.push("regtest"), - #[cfg(not(feature = "liquid"))] - Network::Signet => daemon_dir.push("signet"), - #[cfg(feature = "liquid")] - Network::Liquid => daemon_dir.push("liquidv1"), - #[cfg(feature = "liquid")] - Network::LiquidTestnet => daemon_dir.push("liquidtestnet"), - #[cfg(feature = "liquid")] - Network::LiquidRegtest => daemon_dir.push("liquidregtest"), + if let Some(network_subdir) = get_network_subdir(network_type) { + daemon_dir.push(network_subdir); } let blocks_dir = m .value_of("blocks_dir") @@ -433,6 +420,26 @@ impl Config { } } +pub fn get_network_subdir(network: Network) -> Option<&'static str> { + match network { + #[cfg(not(feature = "liquid"))] + Network::Bitcoin => None, + #[cfg(not(feature = "liquid"))] + Network::Testnet => Some("testnet3"), + #[cfg(not(feature = "liquid"))] + Network::Regtest => Some("regtest"), + #[cfg(not(feature = "liquid"))] + Network::Signet => Some("signet"), + + #[cfg(feature = "liquid")] + Network::Liquid => Some("liquidv1"), + #[cfg(feature = "liquid")] + Network::LiquidTestnet => Some("liquidtestnet"), + #[cfg(feature = "liquid")] + Network::LiquidRegtest => Some("liquidregtest"), + } +} + struct StaticCookie { value: Vec, } diff --git a/src/new_index/mempool.rs b/src/new_index/mempool.rs index 28fe7ad05..97484ef65 100644 --- a/src/new_index/mempool.rs +++ b/src/new_index/mempool.rs @@ -304,16 +304,20 @@ impl Mempool { // Update cached backlog stats (if expired) if self.backlog_stats.1.elapsed() > Duration::from_secs(BACKLOG_STATS_TTL) { - let _timer = self - .latency - .with_label_values(&["update_backlog_stats"]) - .start_timer(); - self.backlog_stats = (BacklogStats::new(&self.feeinfo), Instant::now()); + self.update_backlog_stats(); } Ok(()) } + pub fn update_backlog_stats(&mut self) { + let _timer = self + .latency + .with_label_values(&["update_backlog_stats"]) + .start_timer(); + self.backlog_stats = (BacklogStats::new(&self.feeinfo), Instant::now()); + } + pub fn add_by_txid(&mut self, daemon: &Daemon, txid: &Txid) { if self.txstore.get(txid).is_none() { if let Ok(tx) = daemon.getmempooltx(&txid) { diff --git a/src/new_index/schema.rs b/src/new_index/schema.rs index 800eabf12..f5afd1fb3 100644 --- a/src/new_index/schema.rs +++ b/src/new_index/schema.rs @@ -342,6 +342,10 @@ impl Indexer { }; self.store.history_db.write(rows, self.flush); } + + pub fn fetch_from(&mut self, from: FetchFrom) { + self.from = from; + } } impl ChainQuery { diff --git a/tests/common.rs b/tests/common.rs new file mode 100644 index 000000000..d5bee2074 --- /dev/null +++ b/tests/common.rs @@ -0,0 +1,390 @@ +use std::sync::{Arc, Once, RwLock}; +use std::{env, net}; + +use stderrlog::StdErrLog; +use tempfile::TempDir; + +use serde_json::json; +#[cfg(feature = "liquid")] +use serde_json::Value; + +#[cfg(not(feature = "liquid"))] +use bitcoind::{self as noded, BitcoinD as NodeD}; +#[cfg(feature = "liquid")] +use elementsd::{self as noded, ElementsD as NodeD}; + +use noded::bitcoincore_rpc::{self, RpcApi}; + +use electrs::{ + chain::{Address, BlockHash, Network, Txid}, + config::Config, + daemon::Daemon, + electrum::RPC as ElectrumRPC, + metrics::Metrics, + new_index::{ChainQuery, FetchFrom, Indexer, Mempool, Query, Store}, + rest, + signal::Waiter, +}; + +pub struct TestRunner { + config: Arc, + /// bitcoind::BitcoinD or an elementsd::ElementsD in liquid mode + node: NodeD, + _electrsdb: TempDir, // rm'd when dropped + indexer: Indexer, + query: Arc, + daemon: Arc, + mempool: Arc>, + metrics: Metrics, +} + +impl TestRunner { + pub fn new() -> Result { + let log = init_log(); + + // Setup the bitcoind/elementsd config + let mut node_conf = noded::Conf::default(); + { + #[cfg(not(feature = "liquid"))] + let node_conf = &mut node_conf; + #[cfg(feature = "liquid")] + let node_conf = &mut node_conf.0; + + #[cfg(feature = "liquid")] + node_conf.args.push("-anyonecanspendaremine=1"); + + node_conf.view_stdout = true; + } + + // Setup node + let node = NodeD::with_conf(noded::downloaded_exe_path().unwrap(), &node_conf).unwrap(); + + #[cfg(not(feature = "liquid"))] + let (node_client, params) = (&node.client, &node.params); + #[cfg(feature = "liquid")] + let (node_client, params) = (node.client(), &node.params()); + + log::info!("node params: {:?}", params); + + generate(node_client, 101).chain_err(|| "failed initializing blocks")?; + + // Needed to claim the initialfreecoins as our own + // See https://github.com/ElementsProject/elements/issues/956 + #[cfg(feature = "liquid")] + node_client.call::("rescanblockchain", &[])?; + + #[cfg(not(feature = "liquid"))] + let network_type = Network::Regtest; + #[cfg(feature = "liquid")] + let network_type = Network::LiquidRegtest; + + let mut daemon_subdir = params.cookie_file.clone(); + // drop `.cookie` filename, leaving just the network subdirectory + daemon_subdir.pop(); + + let electrsdb = tempfile::tempdir().unwrap(); + + let config = Arc::new(Config { + log, + network_type, + db_path: electrsdb.path().to_path_buf(), + daemon_dir: daemon_subdir.clone(), + blocks_dir: daemon_subdir.join("blocks"), + daemon_rpc_addr: params.rpc_socket.into(), + cookie: None, + electrum_rpc_addr: rand_available_addr(), + http_addr: rand_available_addr(), + http_socket_file: None, // XXX test with socket file or tcp? + monitoring_addr: rand_available_addr(), + jsonrpc_import: false, + light_mode: false, + address_search: true, + index_unspendables: false, + cors: None, + precache_scripts: None, + utxos_limit: 100, + electrum_txs_limit: 100, + electrum_banner: "".into(), + + #[cfg(feature = "liquid")] + asset_db_path: None, // XXX + #[cfg(feature = "liquid")] + parent_network: bitcoin::Network::Regtest, + //#[cfg(feature = "electrum-discovery")] + //electrum_public_hosts: Option, + //#[cfg(feature = "electrum-discovery")] + //electrum_announce: bool, + //#[cfg(feature = "electrum-discovery")] + //tor_proxy: Option, + }); + + let signal = Waiter::start(); + let metrics = Metrics::new(rand_available_addr()); + metrics.start(); + + let daemon = Arc::new(Daemon::new( + &config.daemon_dir, + &config.blocks_dir, + config.daemon_rpc_addr, + config.cookie_getter(), + config.network_type, + signal.clone(), + &metrics, + )?); + + let store = Arc::new(Store::open(&config.db_path.join("newindex"), &config)); + + let fetch_from = if !env::var("JSONRPC_IMPORT").is_ok() && !cfg!(feature = "liquid") { + // run the initial indexing from the blk files then switch to using the jsonrpc, + // similarly to how electrs is typically used. + FetchFrom::BlkFiles + } else { + // when JSONRPC_IMPORT is set, use the jsonrpc for the initial indexing too. + // this runs faster on small regtest chains and can be useful for quicker local development iteration. + // this is also used on liquid regtest, which currently fails to parse the BlkFiles due to the magic bytes + FetchFrom::Bitcoind + }; + + let mut indexer = Indexer::open(Arc::clone(&store), fetch_from, &config, &metrics); + indexer.update(&daemon)?; + indexer.fetch_from(FetchFrom::Bitcoind); + + let chain = Arc::new(ChainQuery::new( + Arc::clone(&store), + Arc::clone(&daemon), + &config, + &metrics, + )); + + let mempool = Arc::new(RwLock::new(Mempool::new( + Arc::clone(&chain), + &metrics, + Arc::clone(&config), + ))); + mempool.write().unwrap().update(&daemon)?; + + let query = Arc::new(Query::new( + Arc::clone(&chain), + Arc::clone(&mempool), + Arc::clone(&daemon), + Arc::clone(&config), + #[cfg(feature = "liquid")] + None, // TODO + )); + + Ok(TestRunner { + config, + node, + _electrsdb: electrsdb, + indexer, + query, + daemon, + mempool, + metrics, + }) + } + + pub fn node_client(&self) -> &bitcoincore_rpc::Client { + #[cfg(not(feature = "liquid"))] + return &self.node.client; + #[cfg(feature = "liquid")] + return &self.node.client(); + } + + pub fn sync(&mut self) -> Result<()> { + self.indexer.update(&self.daemon)?; + let mut mempool = self.mempool.write().unwrap(); + mempool.update(&self.daemon)?; + // force an update for the mempool stats, which are normally cached + mempool.update_backlog_stats(); + Ok(()) + } + + pub fn mine(&mut self) -> Result { + let mut generated = generate(self.node_client(), 1)?; + self.sync()?; + Ok(generated.remove(0)) + } + + pub fn send(&mut self, addr: &Address, amount: bitcoin::Amount) -> Result { + // Must use raw call() because send_to_address() expects a bitcoin::Address and not an elements::Address + let txid = self.node_client().call( + "sendtoaddress", + &[addr.to_string().into(), json!(amount.to_btc())], + )?; + self.sync()?; + Ok(txid) + } + + #[cfg(feature = "liquid")] + pub fn send_asset( + &mut self, + addr: &Address, + amount: bitcoin::Amount, + assetid: elements::AssetId, + ) -> Result { + let txid = self.node_client().call( + "sendtoaddress", + &[ + addr.to_string().into(), + json!(amount.to_btc()), + Value::Null, + Value::Null, + Value::Null, + Value::Null, + Value::Null, + Value::Null, + Value::Null, + json!(assetid), + ], + )?; + self.sync()?; + Ok(txid) + } + + /// Generate and return a new address. + /// Returns the unconfidential address in Liquid mode, to make it interchangeable with Bitcoin addresses in tests. + pub fn newaddress(&self) -> Result
{ + #[cfg(not(feature = "liquid"))] + return Ok(raw_new_address(self.node_client())?); + + #[cfg(feature = "liquid")] + return Ok(self.ct_newaddress()?.1); + } + /// Generate a new address, returning both the confidential and non-confidential versions + #[cfg(feature = "liquid")] + pub fn ct_newaddress(&self) -> Result<(Address, Address)> { + let client = self.node_client(); + let c_addr = raw_new_address(client)?; + let mut info = client.call::("getaddressinfo", &[c_addr.to_string().into()])?; + let uc_addr = serde_json::from_value(info["unconfidential"].take())?; + Ok((c_addr, uc_addr)) + } +} + +pub fn init_rest_tester() -> Result<(rest::Handle, net::SocketAddr, TestRunner)> { + let tester = TestRunner::new()?; + let rest_server = rest::start(Arc::clone(&tester.config), Arc::clone(&tester.query)); + log::info!("REST server running on {}", tester.config.http_addr); + Ok((rest_server, tester.config.http_addr, tester)) +} +pub fn init_electrum_tester() -> Result<(ElectrumRPC, net::SocketAddr, TestRunner)> { + let tester = TestRunner::new()?; + let electrum_server = ElectrumRPC::start( + Arc::clone(&tester.config), + Arc::clone(&tester.query), + &tester.metrics, + ); + log::info!( + "Electrum server running on {}", + tester.config.electrum_rpc_addr + ); + Ok((electrum_server, tester.config.electrum_rpc_addr, tester)) +} + +#[cfg(not(feature = "liquid"))] +fn raw_new_address( + client: &bitcoincore_rpc::Client, +) -> bitcoincore_rpc::Result> { + Ok(client.get_new_address(None, None)?.assume_checked()) +} + +// Returns the confidential address +#[cfg(feature = "liquid")] +fn raw_new_address(client: &bitcoincore_rpc::Client) -> bitcoincore_rpc::Result
{ + // Must use raw call() because get_new_address() returns a bitcoin::Address and not an elements::Address + Ok(client.call::
("getnewaddress", &[])?) +} + +fn generate( + client: &bitcoincore_rpc::Client, + num_blocks: u32, +) -> bitcoincore_rpc::Result> { + let addr = raw_new_address(client)?; + client.call( + "generatetoaddress", + &[num_blocks.into(), addr.to_string().into()], + ) +} + +fn init_log() -> StdErrLog { + static ONCE: Once = Once::new(); + let mut log = stderrlog::new(); + log.verbosity(4); + // log.timestamp(stderrlog::Timestamp::Millisecond ); + ONCE.call_once(|| log.init().expect("logging initialization failed")); + log +} + +fn rand_available_addr() -> net::SocketAddr { + // note this has a potential but unlikely race condition, if the port is grabbed before the caller binds it + let socket = net::UdpSocket::bind("127.0.0.1:0").unwrap(); + socket.local_addr().unwrap() +} + +error_chain::error_chain! { + types { + Error, ErrorKind, ResultExt, Result; + } + + errors { + Electrs(e: electrs::errors::Error) { + description("Electrs error") + display("Electrs error: {:?}", e) + } + + BitcoindRpc(e: bitcoind::bitcoincore_rpc::Error) { + description("Bitcoind RPC error") + display("Bitcoind RPC error: {:?}", e) + } + + ElectrumD(e: electrumd::Error) { + description("Electrum wallet RPC error") + display("Electrum wallet RPC error: {:?}", e) + } + + Io(e: std::io::Error) { + description("IO error") + display("IO error: {:?}", e) + } + Ureq(e: ureq::Error) { + description("ureq error") + display("ureq error: {:?}", e) + } + Json(e: serde_json::Error) { + description("JSON error") + display("JSON error: {:?}", e) + } + } +} + +impl From for Error { + fn from(e: electrs::errors::Error) -> Self { + Error::from(ErrorKind::Electrs(e)) + } +} +impl From for Error { + fn from(e: bitcoind::bitcoincore_rpc::Error) -> Self { + Error::from(ErrorKind::BitcoindRpc(e)) + } +} +impl From for Error { + fn from(e: electrumd::Error) -> Self { + Error::from(ErrorKind::ElectrumD(e)) + } +} +impl From for Error { + fn from(e: std::io::Error) -> Self { + Error::from(ErrorKind::Io(e)) + } +} +impl From for Error { + fn from(e: ureq::Error) -> Self { + Error::from(ErrorKind::Ureq(e)) + } +} +impl From for Error { + fn from(e: serde_json::Error) -> Self { + Error::from(ErrorKind::Json(e)) + } +} diff --git a/tests/electrum.rs b/tests/electrum.rs new file mode 100644 index 000000000..d35d91eb3 --- /dev/null +++ b/tests/electrum.rs @@ -0,0 +1,136 @@ +pub mod common; +use common::Result; + +use bitcoind::bitcoincore_rpc::RpcApi; +use electrumd::jsonrpc::serde_json::json; +use electrumd::ElectrumD; + +use electrs::chain::Address; + +#[cfg(not(feature = "liquid"))] +use bitcoin::address; + +/// Test the Electrum RPC server using an headless Electrum wallet +/// This only runs on Bitcoin (non-Liquid) mode. +#[cfg_attr(not(feature = "liquid"), test)] +#[cfg_attr(feature = "liquid", allow(dead_code))] +fn test_electrum() -> Result<()> { + // Spawn an Electrs Electrum RPC server + let (electrum_server, electrum_addr, mut tester) = common::init_electrum_tester().unwrap(); + + // Spawn an headless Electrum wallet RPC daemon, connected to Electrs + let mut electrum_wallet_conf = electrumd::Conf::default(); + let server_arg = format!("{}:t", electrum_addr.to_string()); + electrum_wallet_conf.args = vec!["-v", "--server", &server_arg]; + electrum_wallet_conf.view_stdout = true; + let electrum_wallet = + ElectrumD::with_conf(electrumd::downloaded_exe_path()?, &electrum_wallet_conf)?; + + let notify_wallet = || { + electrum_server.notify(); + std::thread::sleep(std::time::Duration::from_millis(200)); + }; + + let assert_balance = |confirmed: f64, unconfirmed: f64| { + let balance = electrum_wallet.call("getbalance", &json!([])).unwrap(); + log::info!("balance: {}", balance); + + assert_eq!( + balance["confirmed"].as_str(), + Some(confirmed.to_string().as_str()) + ); + if unconfirmed != 0.0 { + assert_eq!( + balance["unconfirmed"].as_str(), + Some(unconfirmed.to_string().as_str()) + ); + } else { + assert!(balance["unconfirmed"].is_null()) + } + }; + + let newaddress = || -> Address { + #[cfg(not(feature = "liquid"))] + type ParseAddrType = Address; + #[cfg(feature = "liquid")] + type ParseAddrType = Address; + + let addr = electrum_wallet + .call("createnewaddress", &json!([])) + .unwrap() + .as_str() + .expect("missing address") + .parse::() + .expect("invalid address"); + + #[cfg(not(feature = "liquid"))] + let addr = addr.assume_checked(); + + addr + }; + + log::info!( + "Electrum wallet version: {:?}", + electrum_wallet.call("version", &json!([]))? + ); + + // Send some funds and verify that the balance checks out + let addr1 = newaddress(); + let addr2 = newaddress(); + + assert_balance(0.0, 0.0); + + let txid1 = tester.send(&addr1, "0.1 BTC".parse().unwrap())?; + notify_wallet(); + assert_balance(0.0, 0.1); + + tester.mine()?; + notify_wallet(); + assert_balance(0.1, 0.0); + + let txid2 = tester.send(&addr2, "0.2 BTC".parse().unwrap())?; + notify_wallet(); + assert_balance(0.1, 0.2); + + tester.mine()?; + notify_wallet(); + assert_balance(0.3, 0.0); + + // Verify that the transaction history checks out + let history = electrum_wallet.call("onchain_history", &json!([]))?; + log::debug!("history = {:#?}", history); + assert_eq!( + history["transactions"][0]["txid"].as_str(), + Some(txid1.to_string().as_str()) + ); + assert_eq!(history["transactions"][0]["height"].as_u64(), Some(102)); + assert_eq!(history["transactions"][0]["bc_value"].as_str(), Some("0.1")); + + assert_eq!( + history["transactions"][1]["txid"].as_str(), + Some(txid2.to_string().as_str()) + ); + assert_eq!(history["transactions"][1]["height"].as_u64(), Some(103)); + assert_eq!(history["transactions"][1]["bc_value"].as_str(), Some("0.2")); + + // Send an outgoing payment + electrum_wallet.call( + "broadcast", + &json!([electrum_wallet.call( + "payto", + &json!({ + "destination": tester.node_client().get_new_address(None, None)?, + "amount": 0.16, + "fee": 0.001, + }), + )?]), + )?; + notify_wallet(); + assert_balance(0.3, -0.161); + + tester.mine()?; + notify_wallet(); + assert_balance(0.139, 0.0); + + Ok(()) +} diff --git a/tests/rest.rs b/tests/rest.rs new file mode 100644 index 000000000..7892fb6ee --- /dev/null +++ b/tests/rest.rs @@ -0,0 +1,320 @@ +use bitcoind::bitcoincore_rpc::RpcApi; +use serde_json::Value; +use std::collections::HashSet; + +use electrs::chain::Txid; + +pub mod common; + +use common::Result; + +#[test] +fn test_rest() -> Result<()> { + let (rest_handle, rest_addr, mut tester) = common::init_rest_tester().unwrap(); + + let get_json = |path: &str| -> Result { + Ok(ureq::get(&format!("http://{}{}", rest_addr, path)) + .call()? + .into_json::()?) + }; + + let get_plain = |path: &str| -> Result { + Ok(ureq::get(&format!("http://{}{}", rest_addr, path)) + .call()? + .into_string()?) + }; + + // Send transaction and confirm it + let addr1 = tester.newaddress()?; + let txid1_confirmed = tester.send(&addr1, "1.19123 BTC".parse().unwrap())?; + tester.mine()?; + + // Send transaction and leave it unconfirmed + let txid2_mempool = tester.send(&addr1, "0.7113 BTC".parse().unwrap())?; + + // Test GET /tx/:txid + let res = get_json(&format!("/tx/{}", txid1_confirmed))?; + log::debug!("tx: {:#?}", res); + let outs = res["vout"].as_array().expect("array of outs"); + assert!(outs.iter().any(|vout| { + vout["scriptpubkey_address"].as_str() == Some(&addr1.to_string()) + && vout["value"].as_u64() == Some(119123000) + })); + + // Test GET /tx/:txid/status + let res = get_json(&format!("/tx/{}/status", txid1_confirmed))?; + assert_eq!(res["confirmed"].as_bool(), Some(true)); + assert_eq!(res["block_height"].as_u64(), Some(102)); + + let res = get_json(&format!("/tx/{}/status", txid2_mempool))?; + assert_eq!(res["confirmed"].as_bool(), Some(false)); + assert_eq!(res["block_height"].as_u64(), None); + + // Test GET /address/:address + let res = get_json(&format!("/address/{}", addr1))?; + assert_eq!(res["chain_stats"]["funded_txo_count"].as_u64(), Some(1)); + #[cfg(not(feature = "liquid"))] + assert_eq!( + res["chain_stats"]["funded_txo_sum"].as_u64(), + Some(119123000) + ); + assert_eq!(res["mempool_stats"]["funded_txo_count"].as_u64(), Some(1)); + #[cfg(not(feature = "liquid"))] + assert_eq!( + res["mempool_stats"]["funded_txo_sum"].as_u64(), + Some(71130000) + ); + + // Test GET /address/:address/txs + let res = get_json(&format!("/address/{}/txs", addr1))?; + let txs = res.as_array().expect("array of transactions"); + let mut txids = txs + .iter() + .map(|tx| tx["txid"].as_str().unwrap().parse().unwrap()) + .collect::>(); + assert!(txids.remove(&txid1_confirmed)); + assert!(txids.remove(&txid2_mempool)); + assert!(txids.is_empty()); + + // Test GET /address-prefix/:prefix + let addr1_prefix = &addr1.to_string()[0..8]; + let res = get_json(&format!("/address-prefix/{}", addr1_prefix))?; + let found = res.as_array().expect("array of matching addresses"); + assert_eq!(found.len(), 1); + assert_eq!(found[0].as_str(), Some(addr1.to_string().as_str())); + + // Test GET /blocks/tip/hash + let bestblockhash = tester.node_client().get_best_block_hash()?; + let res = get_plain("/blocks/tip/hash")?; + assert_eq!(res, bestblockhash.to_string()); + + let bestblockhash = tester.mine()?; + let res = get_plain("/blocks/tip/hash")?; + assert_eq!(res, bestblockhash.to_string()); + + // Test GET /blocks/tip/height + let bestblockheight = tester.node_client().get_block_count()?; + let res = get_plain("/blocks/tip/height")?; + assert_eq!( + res.parse::().expect("tip block height as an int"), + bestblockheight + ); + + // Test GET /block-height/:height + let res = get_plain(&format!("/block-height/{}", bestblockheight))?; + assert_eq!(res, bestblockhash.to_string()); + + // Test GET /blocks + let res = get_json("/blocks")?; + let last_blocks = res.as_array().unwrap(); + assert_eq!(last_blocks.len(), 10); // limited to 10 per page + assert_eq!( + last_blocks[0]["id"].as_str(), + Some(bestblockhash.to_string().as_str()) + ); + + let bestblockhash = tester.mine()?; + let res = get_json("/blocks")?; + let last_blocks = res.as_array().unwrap(); + assert_eq!( + last_blocks[0]["id"].as_str(), + Some(bestblockhash.to_string().as_str()) + ); + + // Test GET /block/:hash + let txid = tester.send(&addr1, "0.98765432 BTC".parse().unwrap())?; + let blockhash = tester.mine()?; + + let res = get_json(&format!("/block/{}", blockhash))?; + assert_eq!(res["id"].as_str(), Some(blockhash.to_string().as_str())); + assert_eq!( + res["height"].as_u64(), + Some(tester.node_client().get_block_count()?) + ); + assert_eq!(res["tx_count"].as_u64(), Some(2)); + + // Test GET /block/:hash/txs + let res = get_json(&format!("/block/{}/txs", blockhash))?; + let block_txs = res.as_array().expect("list of txs"); + assert_eq!(block_txs.len(), 2); + assert_eq!(block_txs[0]["vin"][0]["is_coinbase"].as_bool(), Some(true)); + assert_eq!( + block_txs[1]["txid"].as_str(), + Some(txid.to_string().as_str()) + ); + + // Test GET /block/:hash/txid/:index + let res = get_plain(&format!("/block/{}/txid/1", blockhash))?; + assert_eq!(res, txid.to_string()); + + // Test GET /mempool/txids + let txid = tester.send(&addr1, "3.21 BTC".parse().unwrap())?; + let res = get_json("/mempool/txids")?; + let mempool_txids = res.as_array().expect("list of txids"); + assert_eq!(mempool_txids.len(), 1); + assert_eq!(mempool_txids[0].as_str(), Some(txid.to_string().as_str())); + + tester.send(&addr1, "0.0001 BTC".parse().unwrap())?; + let res = get_json("/mempool/txids")?; + let mempool_txids = res.as_array().expect("list of txids"); + assert_eq!(mempool_txids.len(), 2); + + // Test GET /mempool + assert_eq!(get_json("/mempool")?["count"].as_u64(), Some(2)); + + tester.send(&addr1, "0.00022 BTC".parse().unwrap())?; + assert_eq!(get_json("/mempool")?["count"].as_u64(), Some(3)); + + tester.mine()?; + assert_eq!(get_json("/mempool")?["count"].as_u64(), Some(0)); + + // Elements-only tests + #[cfg(feature = "liquid")] + { + // Test confidential transactions + { + let (c_addr, uc_addr) = tester.ct_newaddress()?; + let txid = tester.send(&c_addr, "3.5 BTC".parse().unwrap())?; + tester.mine()?; + + let tx = get_json(&format!("/tx/{}", txid))?; + log::debug!("blinded tx = {:#?}", tx); + assert_eq!(tx["status"]["confirmed"].as_bool(), Some(true)); + let outs = tx["vout"].as_array().expect("array of outs"); + let vout = outs + .iter() + .find(|vout| vout["scriptpubkey_address"].as_str() == Some(&uc_addr.to_string())) + .expect("our output"); + assert!(vout["value"].is_null()); + assert!(vout["valuecommitment"].is_string()); + assert!(vout["assetcommitment"].is_string()); + } + + // Test blinded asset issuance + { + use bitcoin::hashes::{sha256, Hash}; + let contract_hash = sha256::Hash::hash(&[0x11, 0x22, 0x33, 0x44]).to_string(); + let contract_hash = contract_hash.as_str(); + let issuance = tester.node_client().call::( + "issueasset", + &[1.5.into(), 0.into(), true.into(), contract_hash.into()], + )?; + tester.mine()?; + + let assetid = issuance["asset"].as_str().expect("asset id"); + let issuance_txid = issuance["txid"].as_str().expect("issuance txid"); + + // Test GET /asset/:assetid + let asset = get_json(&format!("/asset/{}", assetid))?; + let stats = &asset["chain_stats"]; + assert_eq!(asset["asset_id"].as_str(), Some(assetid)); + assert_eq!(asset["issuance_txin"]["txid"].as_str(), Some(issuance_txid)); + assert_eq!(asset["contract_hash"].as_str(), Some(contract_hash)); + assert_eq!(asset["status"]["confirmed"].as_bool(), Some(true)); + assert_eq!(stats["issuance_count"].as_u64(), Some(1)); + assert_eq!(stats["has_blinded_issuances"].as_bool(), Some(true)); + assert_eq!(stats["issued_amount"].as_u64(), Some(0)); + + // Test GET /tx/:txid for issuance tx + let issuance_tx = get_json(&format!("/tx/{}", issuance_txid))?; + let issuance_in_index = asset["issuance_txin"]["vin"].as_u64().unwrap(); + let issuance_in = &issuance_tx["vin"][issuance_in_index as usize]; + let issuance_data = &issuance_in["issuance"]; + assert_eq!(issuance_data["asset_id"].as_str(), Some(assetid)); + assert_eq!(issuance_data["is_reissuance"].as_bool(), Some(false)); + assert_eq!(issuance_data["contract_hash"].as_str(), Some(contract_hash)); + assert!(issuance_data["assetamount"].is_null()); + assert!(issuance_data["assetamountcommitment"].is_string()); + } + + // Test unblinded asset issuance + { + let issuance = tester + .node_client() + .call::("issueasset", &[1.5.into(), 0.into(), false.into()])?; + tester.mine()?; + let assetid = issuance["asset"].as_str().expect("asset id"); + let issuance_txid = issuance["txid"].as_str().expect("issuance txid"); + + // Test GET /asset/:assetid + let asset = get_json(&format!("/asset/{}", assetid))?; + let stats = &asset["chain_stats"]; + assert_eq!(stats["has_blinded_issuances"].as_bool(), Some(false)); + assert_eq!(stats["issued_amount"].as_u64(), Some(150000000)); + + // Test GET /tx/:txid for issuance tx + let issuance_tx = get_json(&format!("/tx/{}", issuance_txid))?; + let issuance_in_index = asset["issuance_txin"]["vin"].as_u64().unwrap(); + let issuance_in = &issuance_tx["vin"][issuance_in_index as usize]; + let issuance_data = &issuance_in["issuance"]; + assert_eq!(issuance_data["assetamount"].as_u64(), Some(150000000)); + assert!(issuance_data["assetamountcommitment"].is_null()); + } + + // Test a regular (non-issuance) transaction sending an issued asset + { + let issuance = tester + .node_client() + .call::("issueasset", &[1.5.into(), 0.into(), false.into()])?; + let assetid = issuance["asset"].as_str().expect("asset id"); + tester.mine()?; + + let (c_addr, uc_addr) = tester.ct_newaddress()?; + + // With blinding off + let txid = tester.send_asset( + &uc_addr, + "0.3 BTC".parse().unwrap(), // not actually BTC, but this is what Amount expects + assetid.parse().unwrap(), + )?; + let tx = get_json(&format!("/tx/{}", txid))?; + let outs = tx["vout"].as_array().expect("array of outs"); + let vout = outs + .iter() + .find(|vout| vout["scriptpubkey_address"].as_str() == Some(&uc_addr.to_string())) + .expect("our output"); + assert_eq!(vout["asset"].as_str(), Some(assetid)); + assert_eq!(vout["value"].as_u64(), Some(30000000)); + + // With blinding on + let txid = tester.send_asset( + &c_addr, + "0.3 BTC".parse().unwrap(), + assetid.parse().unwrap(), + )?; + let tx = get_json(&format!("/tx/{}", txid))?; + let outs = tx["vout"].as_array().expect("array of outs"); + let vout = outs + .iter() + .find(|vout| vout["scriptpubkey_address"].as_str() == Some(&uc_addr.to_string())) + .expect("our output"); + assert!(vout["asset"].is_null()); + assert!(vout["value"].is_null()); + assert!(vout["assetcommitment"].is_string()); + assert!(vout["valuecommitment"].is_string()); + } + + // Test GET /block/:hash + { + let bestblockhash = get_plain("/blocks/tip/hash")?; + let block = get_json(&format!("/block/{}", bestblockhash))?; + + // No PoW-related stuff + assert!(block["bits"].is_null()); + assert!(block["nonce"].is_null()); + assert!(block["difficulty"].is_null()); + + // Dynamic Federations (dynafed) fields + assert!(block["ext"]["current"]["signblockscript"].is_string()); + assert!(block["ext"]["current"]["fedpegscript"].is_string()); + assert!(block["ext"]["current"]["fedpeg_program"].is_string()); + assert!(block["ext"]["current"]["signblock_witness_limit"].is_u64()); + assert!(block["ext"]["current"]["extension_space"].is_array()); + assert!(block["ext"]["proposed"].is_object()); + assert!(block["ext"]["signblock_witness"].is_array()); + } + } + + rest_handle.stop(); + Ok(()) +}