diff --git a/.github/workflows/README.md b/.github/workflows/README.md index df332f741..8ea19f23c 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -15,10 +15,11 @@ Run from `rust.yml` unless stated otherwise. Total 11 jobs. 3. `Nightly - minimal` 4. `Nightly - recent` 5. `MSRV - minimal` -6. `Lint` -7. `Docs` -8. `Docsrs` -9. `Bench` -10. `Format` -10. `Int-tests` -11. `Embedded` +6. `MSRV - recent` +7. `Lint` +8. `Docs` +9. `Docsrs` +10. `Bench` +11. `Format` +12. `Int-tests` +13. `Embedded` diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1a35da5f5..d364f31b2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -167,7 +167,7 @@ jobs: - name: "Run test script" run: ./maintainer-tools/ci/run_task.sh bench - Format: # 1 jobs, run cargo fmt directly. + Format: # 1 job, run cargo fmt directly. name: Format - nightly toolchain runs-on: ubuntu-latest strategy: @@ -182,20 +182,39 @@ jobs: - name: "Check formatting" run: cargo +nightly fmt --all -- --check - Int-tests: - name: Integration tests + Integration: # 1 job for each bitcoind version we support. + name: Integration tests - stable toolchain runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + feature: + [ + "26_0", + "25_2", + "25_1", + "25_0", + "24_2", + "24_1", + "24_0_1", + "23_2", + "23_1", + "23_0", + "22_1", + "22_0", + "0_21_2", + "0_20_2", + "0_19_1", + "0_18_1", + "0_17_1", + ] steps: - - name: Checkout Crate - uses: actions/checkout@v2 - - name: Checkout Toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: Running integration tests - run: ./contrib/integration_test.sh + - name: "Checkout repo" + uses: actions/checkout@v4 + - name: "Select toolchain" + uses: dtolnay/rust-toolchain@stable + - name: "Run integration tests" + run: cd bitcoind-tests && cargo test --features=${{ matrix.feature }} Embedded: runs-on: ubuntu-latest diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock index 525498bec..4969b5a85 100644 --- a/Cargo-minimal.lock +++ b/Cargo-minimal.lock @@ -11,12 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "anyhow" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" - [[package]] name = "arrayvec" version = "0.7.4" @@ -29,16 +23,10 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" dependencies = [ - "bitcoin-internals 0.3.0", - "bitcoin_hashes 0.14.0", + "bitcoin-internals", + "bitcoin_hashes", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.7" @@ -58,24 +46,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7170e7750a20974246f17ece04311b4205a6155f1db564c5b224af817663c3ea" dependencies = [ "base58ck", - "base64 0.21.7", + "base64", "bech32", - "bitcoin-internals 0.3.0", + "bitcoin-internals", "bitcoin-io", "bitcoin-units", - "bitcoin_hashes 0.14.0", - "hex-conservative 0.2.1", + "bitcoin_hashes", + "hex-conservative", "hex_lit", "secp256k1", "serde", ] -[[package]] -name = "bitcoin-internals" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" - [[package]] name = "bitcoin-internals" version = "0.3.0" @@ -97,20 +79,10 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d437fd727271c866d6fd5e71eb2c886437d4c97f80d89246be3189b1da4e58b" dependencies = [ - "bitcoin-internals 0.3.0", + "bitcoin-internals", "serde", ] -[[package]] -name = "bitcoin_hashes" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" -dependencies = [ - "bitcoin-internals 0.2.0", - "hex-conservative 0.1.1", -] - [[package]] name = "bitcoin_hashes" version = "0.14.0" @@ -118,68 +90,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" dependencies = [ "bitcoin-io", - "hex-conservative 0.2.1", + "hex-conservative", "serde", ] -[[package]] -name = "bitcoincore-rpc" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedd23ae0fd321affb4bbbc36126c6f49a32818dc6b979395d24da8c9d4e80ee" -dependencies = [ - "bitcoincore-rpc-json", - "jsonrpc", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "bitcoincore-rpc-json" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8909583c5fab98508e80ef73e5592a651c954993dc6b7739963257d19f0e71a" -dependencies = [ - "bitcoin", - "serde", - "serde_json", -] - -[[package]] -name = "bitcoind" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee5cf6a9903ff9cc808494c1232b0e9f6eef6600913d0d69fe1cb5c428f25b9" -dependencies = [ - "anyhow", - "bitcoincore-rpc", - "log", - "tempfile", - "which", -] - -[[package]] -name = "bitcoind-tests" -version = "0.1.0" -dependencies = [ - "bitcoind", - "miniscript", - "rand", - "secp256k1", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "cc" -version = "1.0.79" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" [[package]] name = "cfg-if" @@ -196,21 +115,6 @@ dependencies = [ "regex", ] -[[package]] -name = "either" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - [[package]] name = "getrandom" version = "0.2.14" @@ -222,12 +126,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "hex-conservative" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2" - [[package]] name = "hex-conservative" version = "0.2.1" @@ -254,33 +152,6 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "jsonrpc" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3662a38d341d77efecb73caf01420cfa5aa63c0253fd7bc05289ef9f6616e1bf" -dependencies = [ - "base64 0.13.1", - "minreq", - "serde", - "serde_json", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -293,12 +164,6 @@ version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" -[[package]] -name = "log" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" - [[package]] name = "memchr" version = "2.5.0" @@ -325,23 +190,6 @@ dependencies = [ "serde_test", ] -[[package]] -name = "minreq" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41979ac2a5aa373c6e294b4a67fbe5e428e91a4cd0524376681f2bc6d872399b" -dependencies = [ - "log", - "serde", - "serde_json", -] - -[[package]] -name = "once_cell" -version = "1.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -396,15 +244,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" version = "1.7.3" @@ -422,15 +261,6 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "rustc_version" version = "0.4.0" @@ -440,19 +270,13 @@ dependencies = [ "semver", ] -[[package]] -name = "ryu" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - [[package]] name = "secp256k1" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ - "bitcoin_hashes 0.13.0", + "bitcoin_hashes", "rand", "secp256k1-sys", "serde", @@ -493,17 +317,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_json" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" -dependencies = [ - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_test" version = "1.0.176" @@ -524,20 +337,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - [[package]] name = "unicode-ident" version = "1.0.12" @@ -549,36 +348,3 @@ name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[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.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo-recent.lock b/Cargo-recent.lock index e5dfaca2f..4969b5a85 100644 --- a/Cargo-recent.lock +++ b/Cargo-recent.lock @@ -11,12 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "anyhow" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" - [[package]] name = "arrayvec" version = "0.7.4" @@ -33,12 +27,6 @@ dependencies = [ "bitcoin_hashes", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.7" @@ -58,7 +46,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7170e7750a20974246f17ece04311b4205a6155f1db564c5b224af817663c3ea" dependencies = [ "base58ck", - "base64 0.21.7", + "base64", "bech32", "bitcoin-internals", "bitcoin-io", @@ -106,64 +94,11 @@ dependencies = [ "serde", ] -[[package]] -name = "bitcoincore-rpc" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedd23ae0fd321affb4bbbc36126c6f49a32818dc6b979395d24da8c9d4e80ee" -dependencies = [ - "bitcoincore-rpc-json", - "jsonrpc", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "bitcoincore-rpc-json" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8909583c5fab98508e80ef73e5592a651c954993dc6b7739963257d19f0e71a" -dependencies = [ - "bitcoin", - "serde", - "serde_json", -] - -[[package]] -name = "bitcoind" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee5cf6a9903ff9cc808494c1232b0e9f6eef6600913d0d69fe1cb5c428f25b9" -dependencies = [ - "anyhow", - "bitcoincore-rpc", - "log", - "tempfile", - "which", -] - -[[package]] -name = "bitcoind-tests" -version = "0.1.0" -dependencies = [ - "bitcoind", - "miniscript", - "rand", - "secp256k1", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "cc" -version = "1.0.79" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" [[package]] name = "cfg-if" @@ -180,21 +115,6 @@ dependencies = [ "regex", ] -[[package]] -name = "either" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - [[package]] name = "getrandom" version = "0.2.14" @@ -232,33 +152,6 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "jsonrpc" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3662a38d341d77efecb73caf01420cfa5aa63c0253fd7bc05289ef9f6616e1bf" -dependencies = [ - "base64 0.13.1", - "minreq", - "serde", - "serde_json", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -271,12 +164,6 @@ version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" -[[package]] -name = "log" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" - [[package]] name = "memchr" version = "2.5.0" @@ -303,23 +190,6 @@ dependencies = [ "serde_test", ] -[[package]] -name = "minreq" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41979ac2a5aa373c6e294b4a67fbe5e428e91a4cd0524376681f2bc6d872399b" -dependencies = [ - "log", - "serde", - "serde_json", -] - -[[package]] -name = "once_cell" -version = "1.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -374,15 +244,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" version = "1.7.3" @@ -400,15 +261,6 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "rustc_version" version = "0.4.0" @@ -418,12 +270,6 @@ dependencies = [ "semver", ] -[[package]] -name = "ryu" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - [[package]] name = "secp256k1" version = "0.29.0" @@ -471,17 +317,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_json" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" -dependencies = [ - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_test" version = "1.0.176" @@ -502,20 +337,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - [[package]] name = "unicode-ident" version = "1.0.12" @@ -527,36 +348,3 @@ name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[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.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 59d0cbbc3..764ef1adb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,5 +67,5 @@ name = "big" required-features = ["std", "base64", "compiler"] [workspace] -members = ["bitcoind-tests", "fuzz"] -exclude = ["embedded"] +members = ["fuzz"] +exclude = ["embedded", "bitcoind-tests"] diff --git a/bitcoind-tests/Cargo.toml b/bitcoind-tests/Cargo.toml index a9071a05b..25ed2e787 100644 --- a/bitcoind-tests/Cargo.toml +++ b/bitcoind-tests/Cargo.toml @@ -9,6 +9,26 @@ publish = false [dependencies] miniscript = {path = "../"} -bitcoind = { version = "0.36.0" } +bitcoind = { package = "bitcoind-json-rpc-regtest", version = "0.3.0" } actual-rand = { package = "rand", version = "0.8.4"} secp256k1 = {version = "0.29.0", features = ["rand-std"]} + +[features] +# Enable the same feature in `bitcoind`. +"26_0" = ["bitcoind/26_0"] +"25_2" = ["bitcoind/25_2"] +"25_1" = ["bitcoind/25_1"] +"25_0" = ["bitcoind/25_0"] +"24_2" = ["bitcoind/24_2"] +"24_1" = ["bitcoind/24_1"] +"24_0_1" = ["bitcoind/24_0_1"] +"23_2" = ["bitcoind/23_2"] +"23_1" = ["bitcoind/23_1"] +"23_0" = ["bitcoind/23_0"] +"22_1" = ["bitcoind/22_1"] +"22_0" = ["bitcoind/22_0"] +"0_21_2" = ["bitcoind/0_21_2"] +"0_20_2" = ["bitcoind/0_20_2"] +"0_19_1" = ["bitcoind/0_19_1"] +"0_18_1" = ["bitcoind/0_18_1"] +"0_17_1" = ["bitcoind/0_17_1"] diff --git a/bitcoind-tests/tests/setup/mod.rs b/bitcoind-tests/tests/setup/mod.rs index 294b564ca..90d45eeaa 100644 --- a/bitcoind-tests/tests/setup/mod.rs +++ b/bitcoind-tests/tests/setup/mod.rs @@ -1,13 +1,11 @@ extern crate miniscript; -use bitcoind::bitcoincore_rpc::RpcApi; -use bitcoind::BitcoinD; -use miniscript::bitcoin; +use bitcoind::client::bitcoin; pub mod test_util; // Launch an instance of bitcoind with -pub fn setup() -> BitcoinD { +pub fn setup() -> bitcoind::BitcoinD { // Create env var BITCOIND_EXE_PATH to point to the ../bitcoind/bin/bitcoind binary let key = "BITCOIND_EXE"; if std::env::var(key).is_err() { @@ -29,13 +27,15 @@ pub fn setup() -> BitcoinD { let bitcoind = bitcoind::BitcoinD::new(exe_path).unwrap(); let cl = &bitcoind.client; // generate to an address by the wallet. And wait for funds to mature - let addr = cl.get_new_address(None, None).unwrap().assume_checked(); + let addr = cl.new_address().unwrap(); let blks = cl.generate_to_address(101, &addr).unwrap(); - assert_eq!(blks.len(), 101); + assert_eq!(blks.0.len(), 101); - assert_eq!( - cl.get_balance(Some(1) /*min conf*/, None).unwrap(), - bitcoin::Amount::from_sat(100_000_000 * 50) - ); + let balance = cl + .get_balance() + .expect("failed to get balance") + .balance() + .unwrap(); + assert_eq!(balance, bitcoin::Amount::from_sat(100_000_000 * 50)); bitcoind } diff --git a/bitcoind-tests/tests/test_cpp.rs b/bitcoind-tests/tests/test_cpp.rs index 0e06fd810..2836212e2 100644 --- a/bitcoind-tests/tests/test_cpp.rs +++ b/bitcoind-tests/tests/test_cpp.rs @@ -14,7 +14,7 @@ use bitcoin::psbt::Psbt; use bitcoin::{ psbt, secp256k1, transaction, Amount, OutPoint, Sequence, Transaction, TxIn, TxOut, Txid, }; -use bitcoind::bitcoincore_rpc::{json, Client, RpcApi}; +use bitcoind::{AddressType, Client}; use miniscript::bitcoin::absolute; use miniscript::psbt::PsbtExt; use miniscript::{bitcoin, DefiniteDescriptorKey, Descriptor}; @@ -52,11 +52,13 @@ fn btc<F: Into<f64>>(btc: F) -> Amount { Amount::from_btc(btc.into()).unwrap() } // Ideally, we should find by scriptPubkey, but this // works for temp test case fn get_vout(cl: &Client, txid: Txid, value: Amount) -> (OutPoint, TxOut) { - let tx = cl - .get_transaction(&txid, None) - .unwrap() - .transaction() - .unwrap(); + let model = cl + .get_transaction(txid) + .expect("rpc call failed") + .into_model() + .expect("conversion to model type failed"); + let tx = model.tx; + for (i, txout) in tx.output.into_iter().enumerate() { if txout.value == value { return (OutPoint::new(txid, i as u32), txout); @@ -72,32 +74,25 @@ pub fn test_from_cpp_ms(cl: &Client, testdata: &TestData) { let pks = &testdata.pubdata.pks; // Generate some blocks let blocks = cl - .generate_to_address(500, &cl.get_new_address(None, None).unwrap().assume_checked()) + .generate_to_address(500, &cl.new_address().unwrap()) .unwrap(); - assert_eq!(blocks.len(), 500); + assert_eq!(blocks.0.len(), 500); // Next send some btc to each address corresponding to the miniscript let mut txids = vec![]; for wsh in desc_vec.iter() { let txid = cl - .send_to_address( - &wsh.address(bitcoin::Network::Regtest).unwrap(), - btc(1), - None, - None, - None, - None, - None, - None, - ) - .unwrap(); + .send_to_address(&wsh.address(bitcoin::Network::Regtest).unwrap(), btc(1)) + .expect("rpc call failed") + .txid() + .expect("conversion to model failed"); txids.push(txid); } // Wait for the funds to mature. let blocks = cl - .generate_to_address(50, &cl.get_new_address(None, None).unwrap().assume_checked()) + .generate_to_address(50, &cl.new_address().unwrap()) .unwrap(); - assert_eq!(blocks.len(), 50); + assert_eq!(blocks.0.len(), 50); // Create a PSBT for each transaction. // Spend one input and spend one output for simplicity. let mut psbts = vec![]; @@ -130,10 +125,7 @@ pub fn test_from_cpp_ms(cl: &Client, testdata: &TestData) { // Get a new script pubkey from the node so that // the node wallet tracks the receiving transaction // and we can check it by gettransaction RPC. - let addr = cl - .get_new_address(None, Some(json::AddressType::Bech32)) - .unwrap() - .assume_checked(); + let addr = cl.new_address_with_type(AddressType::Bech32).unwrap(); psbt.unsigned_tx.output.push(TxOut { value: Amount::from_sat(99_999_000), script_pubkey: addr.script_pubkey(), @@ -215,19 +207,21 @@ pub fn test_from_cpp_ms(cl: &Client, testdata: &TestData) { // Check whether the node accepts the transactions let txid = cl .send_raw_transaction(&tx) - .unwrap_or_else(|_| panic!("{} send tx failed for ms {}", i, ms)); + .unwrap_or_else(|_| panic!("{} send tx failed for ms {}", i, ms)) + .txid() + .expect("conversion to model failed"); spend_txids.push(txid); } } // Finally mine the blocks and await confirmations let _blocks = cl - .generate_to_address(10, &cl.get_new_address(None, None).unwrap().assume_checked()) + .generate_to_address(10, &cl.new_address().unwrap()) .unwrap(); // Get the required transactions from the node mined in the blocks. for txid in spend_txids { // Check whether the transaction is mined in blocks // Assert that the confirmations are > 0. - let num_conf = cl.get_transaction(&txid, None).unwrap().info.confirmations; + let num_conf = cl.get_transaction(txid).unwrap().confirmations; assert!(num_conf > 0); } } diff --git a/bitcoind-tests/tests/test_desc.rs b/bitcoind-tests/tests/test_desc.rs index a96c0d067..99b93584b 100644 --- a/bitcoind-tests/tests/test_desc.rs +++ b/bitcoind-tests/tests/test_desc.rs @@ -17,7 +17,7 @@ use bitcoin::{ absolute, psbt, secp256k1, sighash, transaction, Amount, OutPoint, Sequence, Transaction, TxIn, TxOut, Txid, }; -use bitcoind::bitcoincore_rpc::{json, Client, RpcApi}; +use bitcoind::{AddressType, Client}; use miniscript::bitcoin::{self, ecdsa, taproot, ScriptBuf}; use miniscript::psbt::{PsbtExt, PsbtInputExt}; use miniscript::{Descriptor, Miniscript, ScriptContext, ToPublicKey}; @@ -30,11 +30,13 @@ fn btc<F: Into<f64>>(btc: F) -> Amount { Amount::from_btc(btc.into()).unwrap() } // Find the Outpoint by spk fn get_vout(cl: &Client, txid: Txid, value: Amount, spk: ScriptBuf) -> (OutPoint, TxOut) { - let tx = cl - .get_transaction(&txid, None) - .unwrap() - .transaction() - .unwrap(); + let model = cl + .get_transaction(txid) + .expect("rpc call failed") + .into_model() + .expect("conversion to model type failed"); + let tx = model.tx; + for (i, txout) in tx.output.into_iter().enumerate() { if txout.value == value && spk == txout.script_pubkey { return (OutPoint::new(txid, i as u32), txout); @@ -77,9 +79,9 @@ pub fn test_desc_satisfy( let x_only_pks = &testdata.pubdata.x_only_pks; // Generate some blocks let blocks = cl - .generate_to_address(1, &cl.get_new_address(None, None).unwrap().assume_checked()) + .generate_to_address(1, &cl.new_address().unwrap()) .unwrap(); - assert_eq!(blocks.len(), 1); + assert_eq!(blocks.0.len(), 1); let definite_desc = test_util::parse_test_desc(descriptor, &testdata.pubdata) .map_err(|_| DescError::DescParseError)? @@ -92,13 +94,15 @@ pub fn test_desc_satisfy( // Next send some btc to each address corresponding to the miniscript let txid = cl - .send_to_address(&desc_address, btc(1), None, None, None, None, None, None) - .unwrap(); + .send_to_address(&desc_address, btc(1)) + .expect("rpc call failed") + .txid() + .expect("conversion to model failed"); // Wait for the funds to mature. let blocks = cl - .generate_to_address(2, &cl.get_new_address(None, None).unwrap().assume_checked()) + .generate_to_address(2, &cl.new_address().unwrap()) .unwrap(); - assert_eq!(blocks.len(), 2); + assert_eq!(blocks.0.len(), 2); // Create a PSBT for each transaction. // Spend one input and spend one output for simplicity. let mut psbt = Psbt { @@ -129,10 +133,7 @@ pub fn test_desc_satisfy( // Get a new script pubkey from the node so that // the node wallet tracks the receiving transaction // and we can check it by gettransaction RPC. - let addr = cl - .get_new_address(None, Some(json::AddressType::Bech32)) - .unwrap() - .assume_checked(); + let addr = cl.new_address_with_type(AddressType::Bech32).unwrap(); // Had to decrease 'value', so that fees can be increased // (Was getting insufficient fees error, for deep script trees) psbt.unsigned_tx @@ -287,16 +288,18 @@ pub fn test_desc_satisfy( // Check whether the node accepts the transactions let txid = cl .send_raw_transaction(&tx) - .unwrap_or_else(|_| panic!("send tx failed for desc {}", definite_desc)); + .unwrap_or_else(|_| panic!("send tx failed for desc {}", definite_desc)) + .txid() + .expect("conversion to model failed"); // Finally mine the blocks and await confirmations let _blocks = cl - .generate_to_address(1, &cl.get_new_address(None, None).unwrap().assume_checked()) + .generate_to_address(1, &cl.new_address().unwrap()) .unwrap(); // Get the required transactions from the node mined in the blocks. // Check whether the transaction is mined in blocks // Assert that the confirmations are > 0. - let num_conf = cl.get_transaction(&txid, None).unwrap().info.confirmations; + let num_conf = cl.get_transaction(txid).unwrap().confirmations; assert!(num_conf > 0); Ok(tx.input[0].witness.clone()) } diff --git a/contrib/crates.sh b/contrib/crates.sh index 6d1159582..5de41b524 100755 --- a/contrib/crates.sh +++ b/contrib/crates.sh @@ -4,5 +4,5 @@ # disable verify unused vars, despite the fact that they are used when sourced # shellcheck disable=SC2034 -# Crates in this workspace to test (excl. fuzz an integration-tests). -CRATES=(".") # Non-workspaces don't have crates. +# Crates in this workspace to test. +CRATES=("." "fuzz") diff --git a/src/lib.rs b/src/lib.rs index d83d71b41..3abb5c7db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -77,14 +77,8 @@ // Experimental features we need. #![cfg_attr(bench, feature(test))] // Coding conventions +#![warn(missing_docs)] #![deny(unsafe_code)] -#![deny(non_upper_case_globals)] -#![deny(non_camel_case_types)] -#![deny(non_snake_case)] -#![deny(unused_mut)] -#![deny(dead_code)] -#![deny(unused_imports)] -#![deny(missing_docs)] // Clippy lints that we have disabled #![allow(clippy::iter_kv_map)] // https://github.com/rust-lang/rust-clippy/issues/11752 #![allow(clippy::manual_range_contains)] // I hate this lint -asp