diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..3b7e3bcf1 --- /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: Run tests (Bitcoin mode) + run: cargo test + + - name: Run tests (Liquid mode) + run: cargo test --features liquid \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index dfbaeb2bb..272fac934 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,10 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "addr2line" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ "gimli", ] @@ -17,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi 0.3.9", ] @@ -55,21 +57,24 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", +] [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.61" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" +checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" dependencies = [ "addr2line", "cc", @@ -80,6 +85,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base-x" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" + [[package]] name = "base64" version = "0.10.1" @@ -95,6 +106,15 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64-compat" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a8d4d2746f89841e49230dd26917df1876050f95abafafbe34f47cb534b88d7" +dependencies = [ + "byteorder", +] + [[package]] name = "bech32" version = "0.8.1" @@ -112,9 +132,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.59.1" +version = "0.59.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" dependencies = [ "bitflags", "cexpr", @@ -131,27 +151,33 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a427b27dae305157520d86673f2393b3eb08d880609abfcffc6e3c3c820e764" +checksum = "9a41df6ad9642c5c15ae312dd3d074de38fd3eb7cc87ad4ce10f90292a83fe4d" dependencies = [ "bech32", "bitcoin_hashes 0.10.0", - "secp256k1", + "secp256k1 0.20.3", "serde", ] [[package]] -name = "bitcoin_hashes" -version = "0.7.6" +name = "bitcoin" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b375d62f341cef9cd9e77793ec8f1db3fc9ce2e4d57e982c8fe697a2c16af3b6" +checksum = "42b2a9a8e3c7544f5ce2b475f2f56580a3102b37e0ee001558ad4faedcf56cf4" +dependencies = [ + "bech32", + "bitcoin_hashes 0.10.0", + "secp256k1 0.22.1", + "serde", +] [[package]] name = "bitcoin_hashes" -version = "0.9.7" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce18265ec2324ad075345d5814fbeed4f41f0a660055dc78840b74d19b874b1" +checksum = "b375d62f341cef9cd9e77793ec8f1db3fc9ce2e4d57e982c8fe697a2c16af3b6" [[package]] name = "bitcoin_hashes" @@ -163,28 +189,70 @@ dependencies = [ ] [[package]] -name = "bitflags" -version = "1.3.2" +name = "bitcoincore-rpc" +version = "0.14.0" +source = "git+https://github.com/shesek/rust-bitcoincore-rpc?rev=c680bc9d1ad58c57c3751b9d190f54c7508a31c1#c680bc9d1ad58c57c3751b9d190f54c7508a31c1" +dependencies = [ + "bitcoincore-rpc-json", + "jsonrpc 0.12.1", + "log", + "serde", + "serde_json", +] + +[[package]] +name = "bitcoincore-rpc-json" +version = "0.14.0" +source = "git+https://github.com/shesek/rust-bitcoincore-rpc?rev=c680bc9d1ad58c57c3751b9d190f54c7508a31c1#c680bc9d1ad58c57c3751b9d190f54c7508a31c1" +dependencies = [ + "bitcoin 0.28.0", + "serde", + "serde_json", +] + +[[package]] +name = "bitcoind" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "65ddc41af9556a341c909bc71de33e16da52bf5f8dbda6b7a402054c60bdb722" +dependencies = [ + "bitcoin_hashes 0.10.0", + "bitcoincore-rpc", + "flate2", + "home", + "log", + "tar", + "tempfile", + "ureq 1.5.5", +] [[package]] -name = "bitvec" -version = "0.19.5" +name = "bitcoind" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" +checksum = "64945525eb7efb48af5fba5f1d878346af641522320971e35abee4b65ded9efb" dependencies = [ - "funty", - "radium", - "tap", - "wyz", + "bitcoin_hashes 0.10.0", + "bitcoincore-rpc", + "flate2", + "home", + "log", + "tar", + "tempfile", + "ureq 1.5.5", ] +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bumpalo" -version = "3.7.0" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "byteorder" @@ -194,24 +262,24 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cc" -version = "1.0.69" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] [[package]] name = "cexpr" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ "nom", ] @@ -243,9 +311,9 @@ checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" [[package]] name = "clang-sys" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853eda514c284c2287f4bf20ae614f8781f40a81d32ecda6e91449304dfe077c" +checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" dependencies = [ "glob", "libc", @@ -254,9 +322,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", @@ -276,11 +344,53 @@ dependencies = [ "bitflags", ] +[[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", + "log", + "publicsuffix", + "serde", + "serde_json", + "time 0.2.27", + "url", +] + +[[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.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ "cfg-if", "crossbeam-utils", @@ -299,10 +409,11 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" dependencies = [ + "autocfg 1.1.0", "cfg-if", "crossbeam-utils", "lazy_static", @@ -312,9 +423,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ "cfg-if", "lazy_static", @@ -322,24 +433,30 @@ dependencies = [ [[package]] name = "dirs" -version = "3.0.2" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", "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" @@ -354,12 +471,15 @@ dependencies = [ "arrayref", "base64 0.13.0", "bincode", - "bitcoin", + "bitcoin 0.28.0", + "bitcoind 0.20.0", "clap", "crossbeam-channel", "dirs", "electrum-client", + "electrumd", "elements", + "elementsd", "error-chain", "glob", "hex", @@ -384,9 +504,10 @@ dependencies = [ "stderrlog", "sysconf", "tempfile", - "time 0.3.1", + "time 0.3.9", "tiny_http", "tokio", + "ureq 2.4.0", "url", ] @@ -395,22 +516,37 @@ name = "electrum-client" version = "0.8.0" source = "git+https://github.com/Blockstream/rust-electrum-client?rev=d3792352992a539afffbe11501d1aff9fd5b919d#d3792352992a539afffbe11501d1aff9fd5b919d" dependencies = [ - "bitcoin", + "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]] name = "elements" -version = "0.18.0" -source = "git+https://github.com/ElementsProject/rust-elements?rev=d988bd7ed9cf539b8fea0da042efa5a4e1eef86f#d988bd7ed9cf539b8fea0da042efa5a4e1eef86f" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c5ef61d480567b862631efcc22f704eeed7291dbf929ae008a8d5b7f5c4527" dependencies = [ - "bitcoin", + "bitcoin 0.28.0", "bitcoin_hashes 0.10.0", "secp256k1-zkp", "serde", @@ -418,11 +554,24 @@ dependencies = [ "slip21", ] +[[package]] +name = "elementsd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7bb42410e6897948479d56c11acd44187f0f4db8abd4b7d5217d2f60b27475b" +dependencies = [ + "bitcoin_hashes 0.10.0", + "bitcoind 0.23.0", + "flate2", + "tar", + "ureq 1.5.5", +] + [[package]] name = "errno" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ "errno-dragonfly", "libc", @@ -431,11 +580,11 @@ dependencies = [ [[package]] name = "errno-dragonfly" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "gcc", + "cc", "libc", ] @@ -449,6 +598,39 @@ dependencies = [ "version_check", ] +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + +[[package]] +name = "filetime" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi 0.3.9", +] + +[[package]] +name = "flate2" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" +dependencies = [ + "cfg-if", + "crc32fast", + "libc", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -471,35 +653,27 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -[[package]] -name = "funty" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" - [[package]] name = "futures-channel" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" [[package]] name = "futures-macro" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57" +checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ - "autocfg 1.0.1", - "proc-macro-hack", "proc-macro2", "quote", "syn", @@ -507,24 +681,21 @@ dependencies = [ [[package]] name = "futures-task" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" [[package]] name = "futures-util" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ - "autocfg 1.0.1", "futures-core", "futures-macro", "futures-task", "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] @@ -536,20 +707,20 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] name = "gimli" -version = "0.25.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" [[package]] name = "glob" @@ -572,11 +743,20 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "home" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "http" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" +checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" dependencies = [ "bytes", "fnv", @@ -585,9 +765,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ "bytes", "http", @@ -596,21 +776,21 @@ dependencies = [ [[package]] name = "httparse" -version = "1.5.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "6330e8a36bd8c859f3fa6d9382911fbb7147ec39807f63b923933a247240b9ba" [[package]] name = "httpdate" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.11" +version = "0.14.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b61cf2d1aebcf6e6352c97b81dc2244ca29194be1b276f5d8ad5c6330fffb11" +checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" dependencies = [ "bytes", "futures-channel", @@ -655,27 +835,27 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", ] [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] [[package]] name = "itoa" -version = "0.4.7" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "jobserver" @@ -688,13 +868,36 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.53" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4bf49d50e2961077d9c99f4b7997d770a1114f087c3c2e0069b36c13fc2979d" +checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" 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.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8423b78fc94d12ef1a4a9d13c348c9a78766dda0cc18817adf0faf77e670c8" +dependencies = [ + "base64-compat", + "serde", + "serde_derive", + "serde_json", +] + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -719,15 +922,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.99" +version = "0.2.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765" +checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" [[package]] name = "libloading" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ "cfg-if", "winapi 0.3.9", @@ -747,18 +950,19 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg 1.1.0", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" dependencies = [ "cfg-if", ] @@ -777,33 +981,39 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" dependencies = [ "adler", - "autocfg 1.0.1", ] [[package]] name = "mio" -version = "0.7.13" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" +checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" dependencies = [ "libc", "log", "miow", "ntapi", + "wasi 0.11.0+wasi-snapshot-preview1", "winapi 0.3.9", ] @@ -818,21 +1028,19 @@ dependencies = [ [[package]] name = "nom" -version = "6.1.2" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" dependencies = [ - "bitvec", - "funty", "memchr", - "version_check", + "minimal-lexical", ] [[package]] name = "ntapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" dependencies = [ "winapi 0.3.9", ] @@ -843,7 +1051,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "num-traits", ] @@ -853,33 +1061,42 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", ] [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +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" +dependencies = [ + "libc", +] + [[package]] name = "object" -version = "0.26.1" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2766204889d09937d00bfbb7fec56bb2a199e2ade963cab19185d8a6104c7c" +checksum = "40bec70ba014595f99f7aa110b84331ffe1ee9aece7fe6f387cc7e3ecda4d456" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" [[package]] name = "page_size" @@ -893,9 +1110,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", @@ -904,9 +1121,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ "cfg-if", "instant", @@ -930,18 +1147,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" +checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" +checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" dependencies = [ "proc-macro2", "quote", @@ -950,9 +1167,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" [[package]] name = "pin-utils" @@ -962,9 +1179,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "proc-macro-hack" @@ -972,26 +1189,20 @@ version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" - [[package]] name = "proc-macro2" -version = "1.0.28" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" dependencies = [ "unicode-xid", ] [[package]] name = "prometheus" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5986aa8d62380092d2f50f8b1cdba9cb9b6731ffd4b25b51fd126b6c3e05b99c" +checksum = "b7f64969ffd5dd8f39bd57a68ac53c163a095ed9d0fb707146da1b27025a3504" dependencies = [ "cfg-if", "fnv", @@ -1004,24 +1215,37 @@ dependencies = [ [[package]] name = "protobuf" -version = "2.25.0" +version = "2.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020f86b07722c5c4291f7c723eac4676b3892d47d9a7708dc2779696407f039b" +checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96" [[package]] -name = "quote" -version = "1.0.9" +name = "publicsuffix" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f" dependencies = [ - "proc-macro2", + "idna", + "url", ] [[package]] -name = "radium" -version = "0.5.3" +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" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +dependencies = [ + "proc-macro2", +] [[package]] name = "rand" @@ -1052,11 +1276,11 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ - "autocfg 0.1.7", + "autocfg 0.1.8", "libc", "rand_chacha 0.1.1", "rand_core 0.4.2", - "rand_hc 0.1.0", + "rand_hc", "rand_isaac", "rand_jitter", "rand_os", @@ -1067,14 +1291,13 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", "rand_core 0.6.3", - "rand_hc 0.3.1", ] [[package]] @@ -1083,7 +1306,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" dependencies = [ - "autocfg 0.1.7", + "autocfg 0.1.8", "rand_core 0.3.1", ] @@ -1130,15 +1353,6 @@ dependencies = [ "rand_core 0.3.1", ] -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core 0.6.3", -] - [[package]] name = "rand_isaac" version = "0.1.1" @@ -1179,7 +1393,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" dependencies = [ - "autocfg 0.1.7", + "autocfg 0.1.8", "rand_core 0.4.2", ] @@ -1194,11 +1408,11 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "crossbeam-deque", "either", "rayon-core", @@ -1206,14 +1420,13 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", "num_cpus", ] @@ -1228,28 +1441,29 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", "redox_syscall", + "thiserror", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ "regex-syntax", ] @@ -1319,9 +1533,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustc-hash" @@ -1335,6 +1549,15 @@ 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 = "rustls" version = "0.16.0" @@ -1348,11 +1571,24 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.0", + "log", + "ring", + "sct", + "webpki", +] + [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "scopeguard" @@ -1376,58 +1612,91 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a" dependencies = [ - "bitcoin_hashes 0.9.7", + "secp256k1-sys 0.4.2", + "serde", +] + +[[package]] +name = "secp256k1" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26947345339603ae8395f68e2f3d85a6b0a8ddfe6315818e80b8504415099db0" +dependencies = [ + "bitcoin_hashes 0.10.0", "rand 0.6.5", - "secp256k1-sys", + "secp256k1-sys 0.5.0", "serde", ] [[package]] name = "secp256k1-sys" -version = "0.4.1" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +dependencies = [ + "cc", +] + +[[package]] +name = "secp256k1-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827cb7cce42533829c792fc51b82fbf18b125b45a702ef2c8be77fce65463a7b" +checksum = "07b5b9d7322572e1f3aeed208668ce87789b3645dbb73082c5ce99a004103a35" dependencies = [ "cc", ] [[package]] name = "secp256k1-zkp" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e57b977141f57b224fc579c23dac5978b5f594281450fe8b5e2b6aa816d0fde" +checksum = "c724fda6aae465ed9a39320202bc6164e0adb3cdf9bc16d5af4be7eebaba75e5" dependencies = [ - "bitcoin_hashes 0.9.7", "rand 0.6.5", - "secp256k1", + "secp256k1 0.22.1", "secp256k1-zkp-sys", "serde", ] [[package]] name = "secp256k1-zkp-sys" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45a3c4e1291985397df9770f864ed88bd51ee684b13a384f49d2fedb29f86f0" +checksum = "e6f880412a627e79d3ce17355150ea1e0e76570efb7f0f70df51504cbe2582e3" dependencies = [ "cc", - "secp256k1-sys", + "secp256k1-sys 0.5.0", +] + +[[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.127" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.127" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -1436,9 +1705,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.66" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" dependencies = [ "itoa", "ryu", @@ -1446,16 +1715,31 @@ dependencies = [ ] [[package]] -name = "shlex" +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 = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" + +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.9" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "470c5a6397076fae0094aaf06a08e6ba6f37acb77d3b1b91ea92b4d6c8650c39" +checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" dependencies = [ "libc", "signal-hook-registry", @@ -1472,9 +1756,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "slip21" @@ -1487,15 +1771,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "socket2" -version = "0.4.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ "libc", "winapi 0.3.9", @@ -1503,14 +1787,13 @@ dependencies = [ [[package]] name = "socks" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30f86c7635fadf2814201a4f67efefb0007588ae7422ce299f354ab5c97f61ae" +checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" dependencies = [ "byteorder", "libc", - "winapi 0.2.8", - "ws2_32-sys", + "winapi 0.3.9", ] [[package]] @@ -1519,6 +1802,15 @@ 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" @@ -1532,6 +1824,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", +] + +[[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", +] + +[[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" @@ -1540,9 +1881,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.74" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" dependencies = [ "proc-macro2", "quote", @@ -1562,20 +1903,25 @@ dependencies = [ ] [[package]] -name = "tap" -version = "1.0.1" +name = "tar" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" +dependencies = [ + "filetime", + "libc", + "xattr", +] [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if", + "fastrand", "libc", - "rand 0.8.4", "redox_syscall", "remove_dir_all", "winapi 0.3.9", @@ -1583,9 +1929,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] @@ -1601,18 +1947,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.26" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.26" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ "proc-macro2", "quote", @@ -1640,32 +1986,78 @@ dependencies = [ [[package]] name = "time" -version = "0.3.1" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros 0.1.1", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a776787d9c5d455bec3db044586ccdd8a9c74d5da5dc319fb80f3db08808fe6" +checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" dependencies = [ "itoa", "libc", + "num_threads", + "time-macros 0.2.4", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" + +[[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", ] [[package]] name = "tiny_http" -version = "0.8.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce51b50006056f590c9b7c3808c3bd70f0d1101666629713866c227d6e58d39" +checksum = "e0d6ef4e10d23c1efb862eecad25c5054429a71958b4eeef85eb5e7170b477ca" dependencies = [ "ascii", - "chrono", "chunked_transfer", "log", + "time 0.3.9", "url", ] [[package]] name = "tinyvec" -version = "1.3.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" dependencies = [ "tinyvec_macros", ] @@ -1678,24 +2070,24 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.10.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cf844b23c6131f624accf65ce0e4e9956a8bb329400ea5bcc26ae3a5c20b0b" +checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" dependencies = [ - "autocfg 1.0.1", "libc", "mio", "num_cpus", "pin-project-lite", + "socket2", "tokio-macros", "winapi 0.3.9", ] [[package]] name = "tokio-macros" -version = "1.3.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", @@ -1710,9 +2102,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.26" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ "cfg-if", "pin-project-lite", @@ -1721,9 +2113,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.19" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8" +checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" dependencies = [ "lazy_static", ] @@ -1736,9 +2128,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "unicode-bidi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" [[package]] name = "unicode-normalization" @@ -1751,9 +2143,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" @@ -1767,6 +2159,40 @@ 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.0", + "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.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9399fa2f927a3d327187cbd201480cee55bee6ac5d3c77dd27f0c6814cff16d5" +dependencies = [ + "base64 0.13.0", + "chunked_transfer", + "log", + "once_cell", + "serde", + "serde_json", + "url", +] + [[package]] name = "url" version = "2.2.2" @@ -1787,9 +2213,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "want" @@ -1807,11 +2233,17 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm-bindgen" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1819,9 +2251,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" dependencies = [ "bumpalo", "lazy_static", @@ -1834,9 +2266,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1844,9 +2276,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" dependencies = [ "proc-macro2", "quote", @@ -1857,15 +2289,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "web-sys" -version = "0.3.53" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224b2f6b67919060055ef1a67807367c2066ed520c3862cc013d26cf893a783c" +checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" dependencies = [ "js-sys", "wasm-bindgen", @@ -1890,6 +2322,15 @@ 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 = "winapi" version = "0.2.8" @@ -1934,17 +2375,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "xattr" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "libc", ] - -[[package]] -name = "wyz" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" diff --git a/Cargo.toml b/Cargo.toml index 9ab5cbf4b..9ee07cc9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,11 +22,11 @@ arraydeque = "0.4" arrayref = "0.3.6" base64 = "0.13.0" bincode = "1.3.1" -bitcoin = { version = "0.27", features = [ "use-serde" ] } +bitcoin = { version = "0.28", features = [ "use-serde" ] } clap = "2.33.3" crossbeam-channel = "0.5.0" -dirs = "3.0.1" -elements = { version = "0.18", features = [ "serde-feature" ], optional = true } +dirs = "4.0.0" +elements = { version = "0.19.1", features = [ "serde-feature" ], optional = true } error-chain = "0.12.4" glob = "0.3" hex = "0.4.2" @@ -37,7 +37,7 @@ log = "0.4.11" socket2 = { version = "0.4", features = ["all"] } num_cpus = "1.12.0" page_size = "0.4.2" -prometheus = "0.12" +prometheus = "0.13" rayon = "1.5.0" rocksdb = { version = "0.17.0", optional = true } rocksdb-oldcpu = { version = "0.12.4", optional = true, package = "rocksdb" } @@ -49,7 +49,7 @@ signal-hook = "0.3" stderrlog = "0.5.0" sysconf = ">=0.3.4" time = { version = "0.3", features = ["formatting"] } -tiny_http = "0.8" +tiny_http = "0.11" url = "2.2.0" hyper = "0.14" hyperlocal = "0.8" @@ -61,6 +61,10 @@ electrum-client = { version = "0.8", optional = true } [dev-dependencies] +bitcoind = { version = "0.20.0", features = [ "22_0" ] } +elementsd = { version = "0.4.0", features = [ "0_21_0" ] } +electrumd = { version = "0.1.0", features = [ "4_1_5" ] } +ureq = { version = "2.4", default-features = false, features = [ "json" ] } tempfile = "3.0" [profile.release] @@ -72,7 +76,12 @@ codegen-units = 1 git = "https://github.com/Blockstream/rust-electrum-client" rev = "d3792352992a539afffbe11501d1aff9fd5b919d" # add-peer branch -# needed for https://github.com/ElementsProject/rust-elements/pull/98 until a new release is made -[patch.crates-io.elements] -git = "https://github.com/ElementsProject/rust-elements" -rev = "d988bd7ed9cf539b8fea0da042efa5a4e1eef86f" +# needed for https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/218 +[patch.crates-io.bitcoincore-rpc] +git = "https://github.com/shesek/rust-bitcoincore-rpc" +rev = "c680bc9d1ad58c57c3751b9d190f54c7508a31c1" + +# not yet published on crates.io +[patch.crates-io.electrumd] +git = "https://github.com/shesek/electrumd" +rev = "6eac0b7b1f2447472016e2c1473a6284f7f8648e" \ No newline at end of file diff --git a/src/chain.rs b/src/chain.rs index a7feb3ffd..887947cad 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::{ - blockdata::script, consensus::deserialize, util::address, Block, BlockHash, BlockHeader, - OutPoint, Script, Transaction, TxIn, TxOut, Txid, + blockdata::script, consensus::deserialize, util::address, Address, Block, BlockHash, + BlockHeader, OutPoint, Script, Transaction, TxIn, TxOut, Txid, }; #[cfg(feature = "liquid")] 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/elements/mod.rs b/src/elements/mod.rs index 1e4a62425..a73e4d0ea 100644 --- a/src/elements/mod.rs +++ b/src/elements/mod.rs @@ -73,4 +73,4 @@ impl From<&TxIn> for IssuanceValue { }, } } -} +} \ No newline at end of file diff --git a/src/new_index/fetch.rs b/src/new_index/fetch.rs index 356407880..20d0bfde0 100644 --- a/src/new_index/fetch.rs +++ b/src/new_index/fetch.rs @@ -88,7 +88,7 @@ fn bitcoind_fetcher( .zip(entries) .map(|(block, entry)| BlockEntry { entry: entry.clone(), // TODO: remove this clone() - size: block.get_size() as u32, + size: block.size() as u32, block, }) .collect(); diff --git a/src/new_index/mempool.rs b/src/new_index/mempool.rs index 9586c5168..0f9c824d0 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 35e49f8de..8ba504fdb 100644 --- a/src/new_index/schema.rs +++ b/src/new_index/schema.rs @@ -341,6 +341,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/src/rest.rs b/src/rest.rs index 515120efe..108215634 100644 --- a/src/rest.rs +++ b/src/rest.rs @@ -156,8 +156,8 @@ impl TransactionValue { locktime: tx.lock_time, vin: vins, vout: vouts, - size: tx.get_size() as u32, - weight: tx.get_weight() as u32, + size: tx.size() as u32, + weight: tx.weight() as u32, fee, status: Some(TransactionStatus::from(blockid)), } @@ -438,9 +438,9 @@ impl From for UtxoValue { surjection_proof: utxo .witness .surjection_proof - .map_or(vec![], |p| p.serialize()), + .map_or(vec![], |p| (*p).serialize()), #[cfg(feature = "liquid")] - range_proof: utxo.witness.rangeproof.map_or(vec![], |p| p.serialize()), + range_proof: utxo.witness.rangeproof.map_or(vec![], |p| (*p).serialize()), } } } diff --git a/src/util/block.rs b/src/util/block.rs index 76b593fdb..1f6b98508 100644 --- a/src/util/block.rs +++ b/src/util/block.rs @@ -294,7 +294,7 @@ impl From<&BlockEntry> for BlockMeta { fn from(b: &BlockEntry) -> BlockMeta { BlockMeta { tx_count: b.block.txdata.len() as u32, - weight: b.block.get_weight() as u32, + weight: b.block.weight() as u32, size: b.size, } } diff --git a/src/util/fees.rs b/src/util/fees.rs index 1e28ac784..828be6cd1 100644 --- a/src/util/fees.rs +++ b/src/util/fees.rs @@ -12,7 +12,7 @@ pub struct TxFeeInfo { impl TxFeeInfo { pub fn new(tx: &Transaction, prevouts: &HashMap, network: Network) -> Self { let fee = get_tx_fee(tx, prevouts, network); - let vsize = tx.get_weight() / 4; + let vsize = tx.weight() / 4; TxFeeInfo { fee, diff --git a/src/util/script.rs b/src/util/script.rs index 6991d9cea..61be03e65 100644 --- a/src/util/script.rs +++ b/src/util/script.rs @@ -56,7 +56,14 @@ pub fn get_innerscripts(txin: &TxIn, prevout: &TxOut) -> InnerScripts { let witness = &txin.witness; #[cfg(feature = "liquid")] let witness = &witness.script_witness; - witness.iter().last().cloned().map(Script::from) + + // rust-bitcoin returns witness items as a [u8] slice, while rust-elements returns a Vec + #[cfg(not(feature = "liquid"))] + let wit_to_vec = Vec::from; + #[cfg(feature = "liquid")] + let wit_to_vec = Clone::clone; + + witness.iter().last().map(wit_to_vec).map(Script::from) } else { None }; diff --git a/tests/common.rs b/tests/common.rs new file mode 100644 index 000000000..34609e491 --- /dev/null +++ b/tests/common.rs @@ -0,0 +1,376 @@ +use std::sync::{Arc, Once, RwLock}; +use std::{env, net}; + +use stderrlog::StdErrLog; +use tempfile::TempDir; + +use serde_json::{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::{self, Address, BlockHash, Network, Txid}, + config::{self, 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 daemon_subdir = params + .datadir + .join(config::get_network_subdir(network_type).unwrap()); + + 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: chain::BNetwork::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 { + let txid = self.node_client().call( + "sendtoaddress", + &[addr.to_string().into(), json!(amount.as_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.as_btc()), + Value::Null, + Value::Null, + Value::Null, + Value::Null, + Value::Null, + Value::Null, + Value::Null, + json!(assetid), + ], + )?; + self.sync()?; + Ok(txid) + } + + pub fn newaddress(&self) -> Result
{ + #[cfg(not(feature = "liquid"))] + return Ok(self.node_client().get_new_address(None, None)?); + + // Return the unconfidential address on Liquid, so that the Bitcoin tests using + // newaddress() can work on Liquid too. The confidential address can be obtained + // by calling ct_newaddress() + #[cfg(feature = "liquid")] + return Ok(self.ct_newaddress()?.1); + } + + #[cfg(feature = "liquid")] + pub fn ct_newaddress(&self) -> Result<(Address, Address)> { + let client = self.node_client(); + let c_addr = client.call::
("getnewaddress", &[])?; + 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)) +} + +fn generate( + client: &bitcoincore_rpc::Client, + num_blocks: u32, +) -> bitcoincore_rpc::Result> { + let addr = client.call::
("getnewaddress", &[])?; + 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..932b7b881 --- /dev/null +++ b/tests/electrum.rs @@ -0,0 +1,122 @@ +mod common; +use common::Result; + +use bitcoind::bitcoincore_rpc::RpcApi; +use electrumd::jsonrpc::serde_json::json; +use electrumd::ElectrumD; + +use electrs::chain::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)] +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 { + electrum_wallet + .call("createnewaddress", &json!([])) + .unwrap() + .as_str() + .expect("missing address") + .parse() + .expect("invalid address") + }; + + 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..aec494adb --- /dev/null +++ b/tests/rest.rs @@ -0,0 +1,320 @@ +use bitcoin::hashes::{sha256, Hash}; +use bitcoind::bitcoincore_rpc::{self, RpcApi}; +use serde_json::Value; +use std::collections::HashSet; + +use electrs::chain::{Address, Txid}; + +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 + { + 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(()) +}