diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index a4a651e5..ddaecbde 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -45,12 +45,12 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout tagged commit - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3.0.1 with: ref: ${{ github.event.release.target_commitish }} token: ${{ secrets.BOTTY_GITHUB_TOKEN }} - - uses: Swatinem/rust-cache@v1.3.0 + - uses: Swatinem/rust-cache@v1.4.0 - name: Install compiler for armhf arch if: matrix.target == 'armv7-unknown-linux-gnueabihf' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46246c84..acec3453 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,18 +4,18 @@ on: pull_request: # Need to run on pull-requests, otherwise PRs from forks don't run push: branches: - - 'staging' # Bors uses this branch - - 'trying' # Bors uses this branch - - 'master' # Always build head of master for the badge in the README + - "staging" # Bors uses this branch + - "trying" # Bors uses this branch + - "master" # Always build head of master for the badge in the README jobs: static_analysis: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3.0.1 - - uses: Swatinem/rust-cache@v1.3.0 + - uses: Swatinem/rust-cache@v1.4.0 - name: Check formatting uses: dprint/check@v2.0 @@ -40,11 +40,10 @@ jobs: os: windows-latest runs-on: ${{ matrix.os }} steps: - - name: Checkout sources - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3.0.1 - - uses: Swatinem/rust-cache@v1.3.0 + - uses: Swatinem/rust-cache@v1.4.0 - name: Install compiler for armhf arch if: matrix.target == 'armv7-unknown-linux-gnueabihf' @@ -71,13 +70,13 @@ jobs: test: strategy: matrix: - os: [ ubuntu-latest, macos-latest ] + os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout sources - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3.0.1 - - uses: Swatinem/rust-cache@v1.3.0 + - uses: Swatinem/rust-cache@v1.4.0 - name: Build tests run: cargo build --tests --workspace --all-features @@ -92,7 +91,8 @@ jobs: docker_tests: strategy: matrix: - test_name: [ + test_name: + [ happy_path, happy_path_restart_bob_after_xmr_locked, happy_path_restart_bob_before_xmr_locked, @@ -105,15 +105,14 @@ jobs: alice_refunds_after_restart_bob_refunded, ensure_same_swap_id, concurrent_bobs_before_xmr_lock_proof_sent, - alice_manually_redeems_after_enc_sig_learned - ] + alice_manually_redeems_after_enc_sig_learned, + ] runs-on: ubuntu-latest steps: - - name: Checkout sources - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3.0.1 - - uses: Swatinem/rust-cache@v1.3.0 + - uses: Swatinem/rust-cache@v1.4.0 - name: Run test ${{ matrix.test_name }} run: cargo test --package swap --all-features --test ${{ matrix.test_name }} -- --nocapture diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index ee95935f..46976cb4 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -11,7 +11,7 @@ jobs: if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3.0.1 - name: Extract version from branch name id: extract-version diff --git a/.github/workflows/draft-new-release.yml b/.github/workflows/draft-new-release.yml index bab5c85a..792fdbee 100644 --- a/.github/workflows/draft-new-release.yml +++ b/.github/workflows/draft-new-release.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: version: - description: 'The new version in X.Y.Z format.' + description: "The new version in X.Y.Z format." required: true jobs: @@ -12,7 +12,7 @@ jobs: name: "Draft a new release" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3.0.1 with: token: ${{ secrets.BOTTY_GITHUB_TOKEN }} @@ -20,7 +20,7 @@ jobs: run: git checkout -b release/${{ github.event.inputs.version }} - name: Update changelog - uses: thomaseizinger/keep-a-changelog-new-release@1.2.1 + uses: thomaseizinger/keep-a-changelog-new-release@1.3.0 with: version: ${{ github.event.inputs.version }} changelogPath: CHANGELOG.md diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index a8207201..ea072bae 100644 --- a/.github/workflows/preview-release.yml +++ b/.github/workflows/preview-release.yml @@ -10,7 +10,7 @@ jobs: name: Create preview release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3.0.1 - name: Delete 'preview' release uses: larryjoelane/delete-release-action@v1.0.24 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c80f2fc..51ecbc44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Adjust quote based on Bitcoin balance. If the max_buy_btc in the ASB config is higher than the available balance to trade it will return the max available balance discounting the locking fees for monero, in the case the balance is lower than the min_buy_btc config it will return 0 to the CLI. If the ASB returns a quote of 0 the CLI will not allow you continue with a trade. +- Reduce required confirmations for Bitcoin transactions from 2 to 1 +- Update from monero v17.2.0 to monero v17.3.0 +- Both the ASB and CLI now support the [Identify](https://github.com/libp2p/specs/blob/master/identify/README.md) protocol. This makes its version and network (testnet/mainnet) avaliable to others ## [0.10.2] - 2021-12-25 diff --git a/Cargo.lock b/Cargo.lock index 97cb88ce..c84b04eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,11 +49,20 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98" dependencies = [ - "getrandom 0.2.2", + "getrandom 0.2.6", "once_cell", "version_check", ] +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -104,9 +113,9 @@ checksum = "9d6e24d2cce90c53b948c46271bfb053e4bdc2db9b5d3f65e20f8cf28a1b7fc3" [[package]] name = "async-compression" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443ccbb270374a2b1055fc72da40e1f237809cd6bb0e97e66d264cd138473a6" +checksum = "f2bf394cfbbe876f0ac67b13b6ca819f9c9f2fb9ec67223cceb1555fbab1c31a" dependencies = [ "bzip2", "futures-core", @@ -187,7 +196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" dependencies = [ "futures-core", - "getrandom 0.2.2", + "getrandom 0.2.6", "instant", "pin-project-lite 0.2.8", "rand 0.8.3", @@ -376,12 +385,12 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake2" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4" +checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174" dependencies = [ "crypto-mac 0.8.0", - "digest", + "digest 0.9.0", "opaque-debug", ] @@ -395,6 +404,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + [[package]] name = "block-padding" version = "0.2.1" @@ -485,21 +503,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chacha20" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee7ad89dc1128635074c268ee661f90c3f7e83d9fd12910608c36b47d6c3412" +checksum = "f08493fa7707effc63254c66c6ea908675912493cd67952eda23c09fae2610b1" dependencies = [ "cfg-if 1.0.0", "cipher", - "cpufeatures 0.1.4", + "cpufeatures 0.2.1", "zeroize", ] [[package]] name = "chacha20poly1305" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1580317203210c517b6d44794abfbe600698276db18127e37ad3e69bf5e848e5" +checksum = "b6547abe025f4027edacd9edaa357aded014eecec42a5070d9b885c3c334aba2" dependencies = [ "aead", "chacha20", @@ -573,8 +591,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b103d85ca6e209388771bfb7aa6b68a7aeec4afbf6f0a0264bfbf50360e5212e" dependencies = [ "crossterm", - "strum", - "strum_macros", + "strum 0.23.0", + "strum_macros 0.23.0", "unicode-width", ] @@ -764,6 +782,16 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-common" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "crypto-mac" version = "0.8.0" @@ -810,7 +838,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "639891fde0dbea823fc3d798a0fdf9d2f9440a42d64a78ab3488b0ca025117b3" dependencies = [ "byteorder", - "digest", + "digest 0.9.0", "rand_core 0.5.1", "subtle", "zeroize", @@ -823,7 +851,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "574d8b2cd0bae5434fd50d53280f8299d95557a978686555880aaf5b8f4f81e9" dependencies = [ "byteorder", - "digest", + "digest 0.9.0", "rand_core 0.6.2", "serde", "subtle-ng", @@ -915,6 +943,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", +] + [[package]] name = "directories-next" version = "2.0.0" @@ -944,9 +982,9 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "dtoa" -version = "0.4.8" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" +checksum = "5caaa75cbd2b960ff1e5392d2cfb1f44717fffe12fc1f32b7b5d1267f99732a6" [[package]] name = "ecdsa_fun" @@ -979,7 +1017,7 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", - "sha2", + "sha2 0.9.8", "zeroize", ] @@ -1029,7 +1067,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" dependencies = [ - "heck", + "heck 0.3.2", "proc-macro2", "quote", "syn", @@ -1090,9 +1128,9 @@ dependencies = [ [[package]] name = "fixedbitset" -version = "0.2.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" +checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" [[package]] name = "flate2" @@ -1141,9 +1179,9 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "futures" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" +checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" dependencies = [ "futures-channel", "futures-core", @@ -1156,9 +1194,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" dependencies = [ "futures-core", "futures-sink", @@ -1166,15 +1204,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" [[package]] name = "futures-executor" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" +checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" dependencies = [ "futures-core", "futures-task", @@ -1195,18 +1233,16 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" +checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" [[package]] name = "futures-macro" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" +checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ - "autocfg 1.0.1", - "proc-macro-hack", "proc-macro2", "quote", "syn", @@ -1214,26 +1250,26 @@ dependencies = [ [[package]] name = "futures-rustls" -version = "0.21.1" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1387e07917c711fb4ee4f48ea0adb04a3c9739e53ef85bf43ae1edc2937a8b" +checksum = "e01fe9932a224b72b45336d96040aa86386d674a31d0af27d800ea7bc8ca97fe" dependencies = [ "futures-io", - "rustls 0.19.0", - "webpki 0.21.4", + "rustls 0.20.2", + "webpki 0.22.0", ] [[package]] name = "futures-sink" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" [[package]] name = "futures-task" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" [[package]] name = "futures-timer" @@ -1243,11 +1279,10 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ - "autocfg 1.0.1", "futures-channel", "futures-core", "futures-io", @@ -1257,8 +1292,6 @@ dependencies = [ "memchr", "pin-project-lite 0.2.8", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] @@ -1303,9 +1336,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.2" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if 1.0.0", "libc", @@ -1399,6 +1432,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.18" @@ -1427,7 +1466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" dependencies = [ "crypto-mac 0.8.0", - "digest", + "digest 0.9.0", ] [[package]] @@ -1437,7 +1476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ "crypto-mac 0.10.0", - "digest", + "digest 0.9.0", ] [[package]] @@ -1447,18 +1486,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ "crypto-mac 0.11.1", - "digest", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest", - "generic-array", - "hmac 0.8.1", + "digest 0.9.0", ] [[package]] @@ -1495,9 +1523,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" [[package]] name = "httpdate" @@ -1507,9 +1535,9 @@ checksum = "05842d0d43232b23ccb7060ecb0f0626922c21f30012e97b767b30afd4a5d4b9" [[package]] name = "hyper" -version = "0.14.16" +version = "0.14.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" +checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" dependencies = [ "bytes", "futures-channel", @@ -1520,7 +1548,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 0.4.7", + "itoa 1.0.1", "pin-project-lite 0.2.8", "socket2 0.4.0", "tokio", @@ -1561,25 +1589,14 @@ dependencies = [ [[package]] name = "if-addrs" -version = "0.6.5" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28538916eb3f3976311f5dfbe67b5362d0add1293d0a9cad17debf86f8e3aa48" +checksum = "cbc0fa01ffc752e9dbc72818cdb072cd028b86be5e09dd04c5a643704fe101a9" dependencies = [ - "if-addrs-sys", "libc", "winapi 0.3.9", ] -[[package]] -name = "if-addrs-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de74b9dd780476e837e5eb5ab7c88b49ed304126e412030a0adba99c8efe79ea" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "image" version = "0.23.14" @@ -1606,9 +1623,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.9" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", ] @@ -1755,9 +1772,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.119" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" +checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" [[package]] name = "libgit2-sys" @@ -1773,15 +1790,20 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f592f1b06f12a5686a5de7be9f289a161c96d5f89f12b04b7d14cf3d61d7381" dependencies = [ "atomic", "bytes", "futures", + "futures-timer", + "getrandom 0.2.6", + "instant", "lazy_static", "libp2p-core", "libp2p-dns", + "libp2p-identify", "libp2p-metrics", "libp2p-mplex", "libp2p-noise", @@ -1796,14 +1818,15 @@ dependencies = [ "multiaddr", "parking_lot 0.11.2", "pin-project 1.0.5", + "rand 0.7.3", "smallvec", - "wasm-timer", ] [[package]] name = "libp2p-core" -version = "0.30.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c4178afd65bf7c56744b4e0a6cfa6e9b694fe666efba596e03a46f79454d8d" dependencies = [ "asn1_der", "bs58", @@ -1812,8 +1835,8 @@ dependencies = [ "fnv", "futures", "futures-timer", + "instant", "lazy_static", - "libsecp256k1", "log", "multiaddr", "multihash", @@ -1822,10 +1845,10 @@ dependencies = [ "pin-project 1.0.5", "prost", "prost-build", - "rand 0.7.3", + "rand 0.8.3", "ring", "rw-stream-sink", - "sha2", + "sha2 0.10.2", "smallvec", "thiserror", "unsigned-varint", @@ -1835,8 +1858,9 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.30.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39d4a2e7efe62c738833b6be6c0f158cf7ffccba462320f4b3bebe43e1050e7b" dependencies = [ "futures", "libp2p-core", @@ -1845,12 +1869,31 @@ dependencies = [ "trust-dns-resolver", ] +[[package]] +name = "libp2p-identify" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae5d84b4e57cb66abb9dd28ea36f69620816e004a7479c0ad76f45002820f99b" +dependencies = [ + "futures", + "futures-timer", + "libp2p-core", + "libp2p-swarm", + "log", + "lru", + "prost", + "prost-build", + "smallvec", +] + [[package]] name = "libp2p-metrics" -version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0791098ddec13b0c2f9ed37a29175f7c712ce8804ebaba7cbd8bddbc83120190" dependencies = [ "libp2p-core", + "libp2p-identify", "libp2p-ping", "libp2p-swarm", "open-metrics-client", @@ -1858,8 +1901,9 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.30.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49d470ee73a74340e429fa278469ed274a648738e3fb8de2e8d113482441732f" dependencies = [ "asynchronous-codec", "bytes", @@ -1875,8 +1919,9 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3676dc2df10a7f4f6a80fbeaf2ce4168a0ca6567273e3105b21fa4c877be9017" dependencies = [ "bytes", "curve25519-dalek", @@ -1887,7 +1932,7 @@ dependencies = [ "prost", "prost-build", "rand 0.8.3", - "sha2", + "sha2 0.10.2", "snow", "static_assertions", "x25519-dalek", @@ -1896,76 +1941,83 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.31.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d384b30135f122a59bf0d186647ad307da0878a9563232cb382d9dbded6a393e" dependencies = [ "futures", + "futures-timer", + "instant", "libp2p-core", "libp2p-swarm", "log", "rand 0.7.3", "void", - "wasm-timer", ] [[package]] name = "libp2p-rendezvous" -version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec166a822f4167929c8e1673c05106f7c86a42b8e9e917b569e1d86f06b9d8b5" dependencies = [ "asynchronous-codec", "bimap", "futures", + "futures-timer", + "instant", "libp2p-core", "libp2p-swarm", "log", "prost", "prost-build", "rand 0.8.3", - "sha2", + "sha2 0.10.2", "thiserror", "unsigned-varint", "void", - "wasm-timer", ] [[package]] name = "libp2p-request-response" -version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36194499f5b03d66d56badbed430d93bf1bfd9cec80311e03280de130fbe3d5e" dependencies = [ "async-trait", "bytes", "futures", + "instant", "libp2p-core", "libp2p-swarm", "log", - "lru", "rand 0.7.3", "smallvec", "unsigned-varint", - "wasm-timer", ] [[package]] name = "libp2p-swarm" -version = "0.31.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8ae0811c7a05b6edc6684eb5cc69b055cbb715ad780e6b97872d90308503c1" dependencies = [ "either", "futures", + "futures-timer", + "instant", "libp2p-core", "log", "rand 0.7.3", "smallvec", "void", - "wasm-timer", ] [[package]] name = "libp2p-swarm-derive" -version = "0.25.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b4d0acd47739fe0b570728d8d11bbb535050d84c0cf05d6477a4891fceae10" dependencies = [ "quote", "syn", @@ -1973,8 +2025,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.30.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52042e8796c5b58d0415bceb1bcb1bcca28b222339978e52b1a0305800bb5199" dependencies = [ "futures", "futures-timer", @@ -1989,8 +2042,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.31.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d788da0ab952632d6ead2486baf38a98db92907d4bc5d0f324af0d0fab803d" dependencies = [ "either", "futures", @@ -2001,13 +2055,14 @@ dependencies = [ "rw-stream-sink", "soketto", "url", - "webpki-roots 0.21.0", + "webpki-roots 0.22.2", ] [[package]] name = "libp2p-yamux" -version = "0.34.0" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053d13ce0670d29f9c5a974cf371e6cc4d2d864da1c72bf6870ac5d5e45e2036" dependencies = [ "futures", "libp2p-core", @@ -2016,54 +2071,6 @@ dependencies = [ "yamux", ] -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.7.3", - "serde", - "sha2", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" -dependencies = [ - "crunchy", - "digest", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" -dependencies = [ - "libsecp256k1-core", -] - [[package]] name = "libsqlite3-sys" version = "0.22.2" @@ -2113,9 +2120,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.7.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c748cfe47cb8da225c37595b3108bea1c198c84aaae8ea0ba76d01dda9fc803" +checksum = "32613e41de4c47ab04970c348ca7ae7382cf116625755af070b008a15516a889" dependencies = [ "hashbrown", ] @@ -2152,9 +2159,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" @@ -2318,10 +2325,10 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "752a61cd890ff691b4411423d23816d5866dd5621e4d1c5687a53b94b5a979d8" dependencies = [ - "digest", + "digest 0.9.0", "generic-array", "multihash-derive", - "sha2", + "sha2 0.9.8", "unsigned-varint", ] @@ -2347,8 +2354,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.10.4" -source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" dependencies = [ "bytes", "futures", @@ -2517,12 +2525,12 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "open-metrics-client" -version = "0.12.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7337d80c23c2d8b1349563981bc4fb531220733743ba8115454a67b181173f0d" +checksum = "f85842b073145726190373213c63f852020fb884c841a3a1f390637267a2fb8c" dependencies = [ "dtoa", - "itoa 0.4.7", + "itoa 1.0.1", "open-metrics-client-derive-text-encode", "owning_ref", ] @@ -2627,9 +2635,9 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" dependencies = [ "fixedbitset", "indexmap", @@ -2777,18 +2785,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-hack" -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.27" @@ -2820,9 +2816,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" dependencies = [ "bytes", "prost-derive", @@ -2830,27 +2826,29 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" +checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" dependencies = [ "bytes", - "heck", + "heck 0.3.2", "itertools", + "lazy_static", "log", "multimap", "petgraph", "prost", "prost-types", + "regex", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" dependencies = [ "anyhow", "itertools", @@ -2861,9 +2859,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" +checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" dependencies = [ "bytes", "prost", @@ -3028,7 +3026,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ - "getrandom 0.2.2", + "getrandom 0.2.6", ] [[package]] @@ -3144,16 +3142,18 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "getrandom 0.2.2", + "getrandom 0.2.6", "redox_syscall", ] [[package]] name = "regex" -version = "1.4.5" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ + "aho-corasick", + "memchr", "regex-syntax", ] @@ -3169,9 +3169,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.23" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "remove_dir_all" @@ -3184,9 +3184,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.9" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525" +checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" dependencies = [ "base64 0.13.0", "bytes", @@ -3219,7 +3219,7 @@ dependencies = [ "wasm-bindgen-futures", "web-sys", "webpki-roots 0.22.2", - "winreg 0.7.0", + "winreg 0.10.1", ] [[package]] @@ -3249,9 +3249,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.22.0" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37baa70cf8662d2ba1c1868c5983dda16ef32b105cce41fb5c47e72936a90b3" +checksum = "22dc69eadbf0ee2110b8d20418c0c6edbaefec2811c4963dc17b6344e11fe0f8" dependencies = [ "arrayvec 0.7.2", "num-traits", @@ -3260,9 +3260,9 @@ dependencies = [ [[package]] name = "rust_decimal_macros" -version = "1.22.0" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "184abaf7b434800e1a5a8aad3ebc8cd7498df33af72d65371d797a264713a59b" +checksum = "a4c70be9367d4bc095d10b48d41b819d09ed4dafc528765a144d32ed1d530654" dependencies = [ "quote", "rust_decimal", @@ -3341,9 +3341,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" dependencies = [ "base64 0.13.0", ] @@ -3444,7 +3444,7 @@ name = "secp256kfun" version = "0.6.2-alpha.0" source = "git+https://github.com/LLFourn/secp256kfun#84134daf34845434d7f38cdae7ffc31730a3b1e9" dependencies = [ - "digest", + "digest 0.9.0", "rand_core 0.6.2", "secp256k1", "secp256kfun_parity_backend", @@ -3504,9 +3504,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] @@ -3533,9 +3533,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -3544,9 +3544,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.74" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" dependencies = [ "indexmap", "itoa 1.0.1", @@ -3556,21 +3556,21 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 0.4.7", + "itoa 1.0.1", "ryu", "serde", ] [[package]] name = "serde_with" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec1e6ec4d8950e5b1e894eac0d360742f3b1407a6078a604a731c4b3f49cefbc" +checksum = "946fa04a8ac43ff78a1f4b811990afb9ddbdf5890b46d6dda0ba1998230138b7" dependencies = [ "rustversion", "serde", @@ -3595,10 +3595,10 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if 1.0.0", "cpuid-bool", - "digest", + "digest 0.9.0", "opaque-debug", ] @@ -3608,21 +3608,32 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if 1.0.0", "cpufeatures 0.2.1", - "digest", + "digest 0.9.0", "opaque-debug", ] +[[package]] +name = "sha2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures 0.2.1", + "digest 0.10.3", +] + [[package]] name = "sha3" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.9.0", + "digest 0.9.0", "keccak", "opaque-debug", ] @@ -3642,7 +3653,7 @@ version = "0.3.2-alpha.0" source = "git+https://github.com/LLFourn/secp256kfun#84134daf34845434d7f38cdae7ffc31730a3b1e9" dependencies = [ "curve25519-dalek-ng", - "digest", + "digest 0.9.0", "generic-array", "rand_core 0.6.2", "secp256kfun", @@ -3726,7 +3737,7 @@ dependencies = [ "rand_core 0.6.2", "ring", "rustc_version", - "sha2", + "sha2 0.9.8", "subtle", "x25519-dalek", ] @@ -3849,7 +3860,7 @@ dependencies = [ "percent-encoding", "rustls 0.19.0", "serde", - "sha2", + "sha2 0.9.8", "smallvec", "sqlformat", "sqlx-rt", @@ -3870,14 +3881,14 @@ checksum = "584866c833511b1a152e87a7ee20dee2739746f60c858b3c5209150bc4b466f5" dependencies = [ "dotenv", "either", - "heck", + "heck 0.3.2", "hex", "once_cell", "proc-macro2", "quote", "serde", "serde_json", - "sha2", + "sha2 0.9.8", "sqlx-core", "sqlx-rt", "syn", @@ -3931,9 +3942,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "structopt" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c" +checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" dependencies = [ "clap", "lazy_static", @@ -3946,7 +3957,7 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ - "heck", + "heck 0.3.2", "proc-macro-error", "proc-macro2", "quote", @@ -3958,8 +3969,14 @@ name = "strum" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" + +[[package]] +name = "strum" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96acfc1b70604b8b2f1ffa4c57e59176c7dbb05d556c71ecd2f5498a1dee7f8" dependencies = [ - "strum_macros", + "strum_macros 0.24.0", ] [[package]] @@ -3968,7 +3985,20 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00ad150e9d51e33e8142984f577662c1324d49f3be45ed37bac8645fdcbe0fe5" dependencies = [ - "heck", + "heck 0.3.2", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "strum_macros" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6878079b17446e4d3eba6192bb0a2950d5b14f0ed8424b852310e5a94345d0ef" +dependencies = [ + "heck 0.4.0", "proc-macro2", "quote", "rustversion", @@ -4033,21 +4063,21 @@ dependencies = [ "serde_cbor", "serde_json", "serde_with", - "sha2", + "sha2 0.9.8", "sigma_fun", "spectral", "sqlx", "structopt", - "strum", + "strum 0.24.0", "tempfile", "testcontainers 0.12.0", "thiserror", - "time 0.3.7", + "time 0.3.9", "tokio", "tokio-socks", "tokio-tar", "tokio-tungstenite", - "tokio-util 0.7.0", + "tokio-util 0.7.1", "toml", "torut", "tracing", @@ -4121,7 +4151,7 @@ dependencies = [ "rand 0.7.3", "serde", "serde_json", - "sha2", + "sha2 0.9.8", ] [[package]] @@ -4136,7 +4166,7 @@ dependencies = [ "rand 0.8.3", "serde", "serde_json", - "sha2", + "sha2 0.9.8", ] [[package]] @@ -4189,10 +4219,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" +checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" dependencies = [ + "itoa 1.0.1", "libc", "num_threads", ] @@ -4345,23 +4376,23 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64910e1b9c1901aaf5375561e35b9c057d95ff41a44ede043a03e09279eabaf1" +checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" dependencies = [ "bytes", "futures-core", "futures-sink", - "log", "pin-project-lite 0.2.8", "tokio", + "tracing", ] [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] @@ -4379,7 +4410,7 @@ dependencies = [ "hex", "hmac 0.11.0", "rand 0.7.3", - "sha2", + "sha2 0.9.8", "sha3", "tokio", ] @@ -4392,9 +4423,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.29" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ "cfg-if 1.0.0", "pin-project-lite 0.2.8", @@ -4415,9 +4446,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" dependencies = [ "proc-macro2", "quote", @@ -4426,11 +4457,12 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.21" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +checksum = "6dfce9f3241b150f36e8e54bb561a742d5daa1a47b5dd9a5ce369fd4a4db2210" dependencies = [ "lazy_static", + "valuable", ] [[package]] @@ -4562,9 +4594,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "ucd-trie" @@ -4638,9 +4670,9 @@ dependencies = [ [[package]] name = "unsigned-varint" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f8d425fafb8cd76bc3f22aace4af471d3156301d7508f2107e98fbeae10bc7f" +checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" dependencies = [ "asynchronous-codec", "bytes", @@ -4675,14 +4707,20 @@ checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" [[package]] name = "uuid" -version = "0.8.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0" dependencies = [ - "getrandom 0.2.2", + "getrandom 0.2.6", "serde", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.11" @@ -4697,18 +4735,18 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "vergen" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd0c9f8387e118573859ae0e6c6fbdfa41bd1f4fbea451b0b8c5a81a3b8bc9e0" +checksum = "4db743914c971db162f35bf46601c5a63ec4452e61461937b4c1ab817a60c12e" dependencies = [ "anyhow", "cfg-if 1.0.0", - "chrono", "enum-iterator", "getset", "git2", "rustversion", "thiserror", + "time 0.3.9", ] [[package]] @@ -4820,21 +4858,6 @@ version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" -[[package]] -name = "wasm-timer" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" -dependencies = [ - "futures", - "js-sys", - "parking_lot 0.11.2", - "pin-utils", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "web-sys" version = "0.3.48" @@ -5006,9 +5029,9 @@ dependencies = [ [[package]] name = "winreg" -version = "0.7.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi 0.3.9", ] @@ -5045,14 +5068,14 @@ dependencies = [ [[package]] name = "yamux" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107" +checksum = "0c0608f53c1dc0bad505d03a34bbd49fbf2ad7b51eb036123e896365532745a1" dependencies = [ "futures", "log", "nohash-hasher", - "parking_lot 0.11.2", + "parking_lot 0.12.0", "rand 0.8.3", "static_assertions", ] diff --git a/dprint.json b/dprint.json index c73d9690..18c300b2 100644 --- a/dprint.json +++ b/dprint.json @@ -2,13 +2,12 @@ "$schema": "https://dprint.dev/schemas/v0.json", "projectType": "openSource", "incremental": true, - "markdown": { - }, + "markdown": {}, "rustfmt": { - "edition": 2018, + "edition": 2021, "condense_wildcard_suffixes": true, "format_macro_matchers": true, - "imports_granularity" : "Module", + "imports_granularity": "Module", "use_field_init_shorthand": true, "format_code_in_doc_comments": true, "normalize_comments": true, @@ -16,10 +15,10 @@ "overflow_delimited_expr": true }, "includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"], - "excludes": [ "target/" ], + "excludes": ["target/"], "plugins": [ - "https://plugins.dprint.dev/markdown-0.6.1.wasm", + "https://plugins.dprint.dev/markdown-0.13.1.wasm", "https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm", - "https://plugins.dprint.dev/rustfmt-0.4.0.exe-plugin@c6bb223ef6e5e87580177f6461a0ab0554ac9ea6b54f78ea7ae8bf63b14f5bc2" + "https://plugins.dprint.dev/rustfmt-0.6.1.exe-plugin@99b89a0599fd3a63e597e03436862157901f3facae2f0c2fbd0b9f656cdbc2a5" ] } diff --git a/swap/Cargo.toml b/swap/Cargo.toml index c631260a..34c0e775 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -31,7 +31,7 @@ ed25519-dalek = "1" futures = { version = "0.3", default-features = false } hex = "0.4" itertools = "0.10" -libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping", "rendezvous" ] } +libp2p = { version = "0.42.2", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping", "rendezvous", "identify" ] } monero = { version = "0.12", features = [ "serde_support" ] } monero-rpc = { path = "../monero-rpc" } pem = "1.0" @@ -50,7 +50,7 @@ sha2 = "0.9" sigma_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features = false, features = [ "ed25519", "serde" ] } sqlx = { version = "0.5", features = [ "sqlite", "runtime-tokio-rustls", "offline" ] } structopt = "0.3" -strum = { version = "0.23", features = [ "derive" ] } +strum = { version = "0.24", features = [ "derive" ] } thiserror = "1" time = "0.3" tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } @@ -64,7 +64,7 @@ tracing-appender = "0.1" tracing-futures = { version = "0.2", features = [ "std-future", "futures-03" ] } tracing-subscriber = { version = "0.2", default-features = false, features = [ "fmt", "ansi", "env-filter", "chrono", "tracing-log", "json" ] } url = { version = "2", features = [ "serde" ] } -uuid = { version = "0.8", features = [ "serde", "v4" ] } +uuid = { version = "1.0", features = [ "serde", "v4" ] } void = "1" [target.'cfg(not(windows))'.dependencies] @@ -86,5 +86,5 @@ tempfile = "3" testcontainers = "0.12" [build-dependencies] -vergen = { version = "6", default-features = false, features = [ "git", "build" ] } +vergen = { version = "7", default-features = false, features = [ "git", "build" ] } anyhow = "1" diff --git a/swap/src/asb/command.rs b/swap/src/asb/command.rs index 7780fc56..9355568e 100644 --- a/swap/src/asb/command.rs +++ b/swap/src/asb/command.rs @@ -276,7 +276,7 @@ pub enum RawCommand { WithdrawBtc { #[structopt( long = "amount", - help = "Optionally specify the amount of Bitcoin to be withdrawn. If not specified the wallet will be drained." + help = "Optionally specify the amount of Bitcoin to be withdrawn. If not specified the wallet will be drained. Amount must be specified in quotes with denomination, e.g `--amount '0.1 BTC'`" )] amount: Option, #[structopt(long = "address", help = "The address to receive the Bitcoin.")] diff --git a/swap/src/asb/network.rs b/swap/src/asb/network.rs index d24660b9..41b62c31 100644 --- a/swap/src/asb/network.rs +++ b/swap/src/asb/network.rs @@ -13,11 +13,13 @@ use libp2p::core::connection::ConnectionId; use libp2p::core::muxing::StreamMuxerBox; use libp2p::core::transport::Boxed; use libp2p::dns::TokioDnsConfig; +use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent}; use libp2p::ping::{Ping, PingConfig, PingEvent}; use libp2p::request_response::{RequestId, ResponseChannel}; +use libp2p::swarm::dial_opts::PeerCondition; use libp2p::swarm::{ - DialPeerCondition, IntoProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, - PollParameters, ProtocolsHandler, + IntoProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, PollParameters, + ProtocolsHandler, }; use libp2p::tcp::TokioTcpConfig; use libp2p::websocket::WsConfig; @@ -106,11 +108,12 @@ pub mod behaviour { where LR: LatestRate + Send + 'static, { - pub rendezvous: libp2p::swarm::toggle::Toggle, + pub rendezvous: libp2p::swarm::behaviour::toggle::Toggle, pub quote: quote::Behaviour, pub swap_setup: alice::Behaviour, pub transfer_proof: transfer_proof::Behaviour, pub encrypted_signature: encrypted_signature::Behaviour, + pub identify: Identify, /// Ping behaviour that ensures that the underlying network connection /// is still alive. If the ping fails a connection close event @@ -128,10 +131,16 @@ pub mod behaviour { latest_rate: LR, resume_only: bool, env_config: env::Config, + identify_params: (identity::Keypair, XmrBtcNamespace), rendezvous_params: Option<(identity::Keypair, PeerId, Multiaddr, XmrBtcNamespace)>, ) -> Self { + let agentVersion = format!("asb/{} ({})", env!("CARGO_PKG_VERSION"), identify_params.1); + let protocolVersion = "/comit/xmr/btc/1.0.0".to_string(); + let identifyConfig = IdentifyConfig::new(protocolVersion, identify_params.0.public()) + .with_agent_version(agentVersion); + Self { - rendezvous: libp2p::swarm::toggle::Toggle::from(rendezvous_params.map( + rendezvous: libp2p::swarm::behaviour::toggle::Toggle::from(rendezvous_params.map( |(identity, rendezvous_peer_id, rendezvous_address, namespace)| { rendezous::Behaviour::new( identity, @@ -153,6 +162,7 @@ pub mod behaviour { transfer_proof: transfer_proof::alice(), encrypted_signature: encrypted_signature::alice(), ping: Ping::new(PingConfig::new().with_keep_alive(true)), + identify: Identify::new(identifyConfig), } } } @@ -163,6 +173,12 @@ pub mod behaviour { } } + impl From for OutEvent { + fn from(_: IdentifyEvent) -> Self { + OutEvent::Other + } + } + impl From for OutEvent { fn from(event: libp2p::rendezvous::client::Event) -> Self { OutEvent::Rendezvous(event) @@ -172,6 +188,7 @@ pub mod behaviour { pub mod rendezous { use super::*; + use libp2p::swarm::dial_opts::DialOpts; use libp2p::swarm::DialError; use std::pin::Pin; @@ -277,12 +294,14 @@ pub mod rendezous { fn inject_dial_failure( &mut self, - peer_id: &PeerId, + peer_id: Option, _handler: Self::ProtocolsHandler, - _error: DialError, + _error: &DialError, ) { - if peer_id == &self.rendezvous_peer_id { - self.connection_status = ConnectionStatus::Disconnected; + if let Some(id) = peer_id { + if id == self.rendezvous_peer_id { + self.connection_status = ConnectionStatus::Disconnected; + } } } @@ -297,9 +316,11 @@ pub mod rendezous { ConnectionStatus::Disconnected => { self.connection_status = ConnectionStatus::Dialling; - return Poll::Ready(NetworkBehaviourAction::DialPeer { - peer_id: self.rendezvous_peer_id, - condition: DialPeerCondition::Disconnected, + return Poll::Ready(NetworkBehaviourAction::Dial { + opts: DialOpts::peer_id(self.rendezvous_peer_id) + .condition(PeerCondition::Disconnected) + .build(), + handler: Self::ProtocolsHandler::new(Duration::from_secs(30)), }); } @@ -320,9 +341,10 @@ pub mod rendezous { self.registration_status = RegistrationStatus::RegisterOnNextConnection; - return Poll::Ready(NetworkBehaviourAction::DialPeer { - peer_id: self.rendezvous_peer_id, - condition: DialPeerCondition::Disconnected, + return Poll::Ready(NetworkBehaviourAction::Dial { + opts: DialOpts::peer_id(self.rendezvous_peer_id) + .condition(PeerCondition::Disconnected) + .build(), handler: Self::ProtocolsHandler::new(Duration::from_secs(30)), }); } diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs index 23300f20..a0e9b5e3 100644 --- a/swap/src/bin/asb.rs +++ b/swap/src/bin/asb.rs @@ -136,6 +136,8 @@ async fn main() -> Result<()> { }; let kraken_rate = KrakenRate::new(config.maker.ask_spread, kraken_price_updates); + let namespace = XmrBtcNamespace::from_is_testnet(testnet); + let mut swarm = swarm::asb( &seed, config.maker.min_buy_btc, @@ -143,16 +145,8 @@ async fn main() -> Result<()> { kraken_rate.clone(), resume_only, env_config, - config.network.rendezvous_point.map(|rendezvous_point| { - ( - rendezvous_point, - if testnet { - XmrBtcNamespace::Testnet - } else { - XmrBtcNamespace::Mainnet - }, - ) - }), + namespace, + config.network.rendezvous_point, )?; for listen in config.network.listen.clone() { diff --git a/swap/src/bin/swap.rs b/swap/src/bin/swap.rs index 92010783..a1188759 100644 --- a/swap/src/bin/swap.rs +++ b/swap/src/bin/swap.rs @@ -63,6 +63,7 @@ async fn main() -> Result<()> { monero_receive_address, monero_daemon_address, tor_socks5_port, + namespace, } => { let swap_id = Uuid::new_v4(); @@ -87,7 +88,12 @@ async fn main() -> Result<()> { .context("Seller address must contain peer ID")?; db.insert_address(seller_peer_id, seller.clone()).await?; - let behaviour = cli::Behaviour::new(seller_peer_id, env_config, bitcoin_wallet.clone()); + let behaviour = cli::Behaviour::new( + seller_peer_id, + env_config, + bitcoin_wallet.clone(), + (seed.derive_libp2p_identity(), namespace), + ); let mut swarm = swarm::cli(seed.derive_libp2p_identity(), tor_socks5_port, behaviour).await?; swarm.behaviour_mut().add_address(seller_peer_id, seller); @@ -243,6 +249,7 @@ async fn main() -> Result<()> { bitcoin_target_block, monero_daemon_address, tor_socks5_port, + namespace, } => { cli::tracing::init(debug, json, data_dir.join("logs"), Some(swap_id))?; let db = open_db(data_dir.join("sqlite")).await?; @@ -264,7 +271,12 @@ async fn main() -> Result<()> { let seller_peer_id = db.get_peer_id(swap_id).await?; let seller_addresses = db.get_addresses(seller_peer_id).await?; - let behaviour = cli::Behaviour::new(seller_peer_id, env_config, bitcoin_wallet.clone()); + let behaviour = cli::Behaviour::new( + seller_peer_id, + env_config, + bitcoin_wallet.clone(), + (seed.derive_libp2p_identity(), namespace), + ); let mut swarm = swarm::cli(seed.derive_libp2p_identity(), tor_socks5_port, behaviour).await?; let our_peer_id = swarm.local_peer_id(); diff --git a/swap/src/cli/behaviour.rs b/swap/src/cli/behaviour.rs index 716b7951..2ca8448f 100644 --- a/swap/src/cli/behaviour.rs +++ b/swap/src/cli/behaviour.rs @@ -1,13 +1,15 @@ use crate::network::quote::BidQuote; +use crate::network::rendezvous::XmrBtcNamespace; use crate::network::swap_setup::bob; use crate::network::{encrypted_signature, quote, redial, transfer_proof}; use crate::protocol::bob::State2; use crate::{bitcoin, env}; use anyhow::{anyhow, Error, Result}; use libp2p::core::Multiaddr; +use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent}; use libp2p::ping::{Ping, PingConfig, PingEvent}; use libp2p::request_response::{RequestId, ResponseChannel}; -use libp2p::{NetworkBehaviour, PeerId}; +use libp2p::{identity, NetworkBehaviour, PeerId}; use std::sync::Arc; use std::time::Duration; @@ -64,6 +66,7 @@ pub struct Behaviour { pub transfer_proof: transfer_proof::Behaviour, pub encrypted_signature: encrypted_signature::Behaviour, pub redial: redial::Behaviour, + pub identify: Identify, /// Ping behaviour that ensures that the underlying network connection is /// still alive. If the ping fails a connection close event will be @@ -76,7 +79,13 @@ impl Behaviour { alice: PeerId, env_config: env::Config, bitcoin_wallet: Arc, + identify_params: (identity::Keypair, XmrBtcNamespace), ) -> Self { + let agentVersion = format!("cli/{} ({})", env!("CARGO_PKG_VERSION"), identify_params.1); + let protocolVersion = "/comit/xmr/btc/1.0.0".to_string(); + let identifyConfig = IdentifyConfig::new(protocolVersion, identify_params.0.public()) + .with_agent_version(agentVersion); + Self { quote: quote::cli(), swap_setup: bob::Behaviour::new(env_config, bitcoin_wallet), @@ -84,6 +93,7 @@ impl Behaviour { encrypted_signature: encrypted_signature::bob(), redial: redial::Behaviour::new(alice, Duration::from_secs(2)), ping: Ping::new(PingConfig::new().with_keep_alive(true)), + identify: Identify::new(identifyConfig), } } @@ -100,3 +110,9 @@ impl From for OutEvent { OutEvent::Other } } + +impl From for OutEvent { + fn from(_: IdentifyEvent) -> Self { + OutEvent::Other + } +} diff --git a/swap/src/cli/command.rs b/swap/src/cli/command.rs index ae793e1d..631cc00e 100644 --- a/swap/src/cli/command.rs +++ b/swap/src/cli/command.rs @@ -99,6 +99,7 @@ where monero_receive_address, monero_daemon_address, tor_socks5_port, + namespace: XmrBtcNamespace::from_is_testnet(is_testnet), }, } } @@ -179,6 +180,7 @@ where bitcoin_target_block, monero_daemon_address, tor_socks5_port, + namespace: XmrBtcNamespace::from_is_testnet(is_testnet), }, } } @@ -230,8 +232,8 @@ where data_dir: data::data_dir_from(data, is_testnet)?, cmd: Command::ListSellers { rendezvous_point, - namespace: rendezvous_namespace_from(is_testnet), tor_socks5_port, + namespace: XmrBtcNamespace::from_is_testnet(is_testnet), }, }, RawCommand::ExportBitcoinWallet { bitcoin } => { @@ -273,6 +275,7 @@ pub enum Command { monero_receive_address: monero::Address, monero_daemon_address: String, tor_socks5_port: u16, + namespace: XmrBtcNamespace, }, History, Config, @@ -292,6 +295,7 @@ pub enum Command { bitcoin_target_block: usize, monero_daemon_address: String, tor_socks5_port: u16, + namespace: XmrBtcNamespace, }, Cancel { swap_id: Uuid, @@ -562,14 +566,6 @@ mod data { } } -fn rendezvous_namespace_from(is_testnet: bool) -> XmrBtcNamespace { - if is_testnet { - XmrBtcNamespace::Testnet - } else { - XmrBtcNamespace::Mainnet - } -} - fn env_config_from(testnet: bool) -> env::Config { if testnet { env::Testnet::get_config() @@ -1212,6 +1208,7 @@ mod tests { .unwrap(), monero_daemon_address: DEFAULT_MONERO_DAEMON_ADDRESS_STAGENET.to_string(), tor_socks5_port: DEFAULT_SOCKS5_PORT, + namespace: XmrBtcNamespace::Testnet, }, } } @@ -1231,6 +1228,7 @@ mod tests { .unwrap(), monero_daemon_address: DEFAULT_MONERO_DAEMON_ADDRESS.to_string(), tor_socks5_port: DEFAULT_SOCKS5_PORT, + namespace: XmrBtcNamespace::Mainnet, }, } } @@ -1248,6 +1246,7 @@ mod tests { bitcoin_target_block: DEFAULT_BITCOIN_CONFIRMATION_TARGET_TESTNET, monero_daemon_address: DEFAULT_MONERO_DAEMON_ADDRESS_STAGENET.to_string(), tor_socks5_port: DEFAULT_SOCKS5_PORT, + namespace: XmrBtcNamespace::Testnet, }, } } @@ -1264,6 +1263,7 @@ mod tests { bitcoin_target_block: DEFAULT_BITCOIN_CONFIRMATION_TARGET, monero_daemon_address: DEFAULT_MONERO_DAEMON_ADDRESS.to_string(), tor_socks5_port: DEFAULT_SOCKS5_PORT, + namespace: XmrBtcNamespace::Mainnet, }, } } diff --git a/swap/src/cli/event_loop.rs b/swap/src/cli/event_loop.rs index 3d376449..2a9c16d3 100644 --- a/swap/src/cli/event_loop.rs +++ b/swap/src/cli/event_loop.rs @@ -9,6 +9,7 @@ use anyhow::{Context, Result}; use futures::future::{BoxFuture, OptionFuture}; use futures::{FutureExt, StreamExt}; use libp2p::request_response::{RequestId, ResponseChannel}; +use libp2p::swarm::dial_opts::DialOpts; use libp2p::swarm::SwarmEvent; use libp2p::{PeerId, Swarm}; use std::collections::HashMap; @@ -81,7 +82,7 @@ impl EventLoop { } pub async fn run(mut self) { - match self.swarm.dial(&self.alice_peer_id) { + match self.swarm.dial(DialOpts::from(self.alice_peer_id)) { Ok(()) => {} Err(e) => { tracing::error!("Failed to initiate dial to Alice: {}", e); @@ -167,12 +168,13 @@ impl EventLoop { tracing::info!("Successfully closed connection to Alice"); return; } - SwarmEvent::UnreachableAddr { peer_id, address, attempts_remaining, error } if peer_id == self.alice_peer_id && attempts_remaining == 0 => { - tracing::warn!(%address, "Failed to dial Alice: {}", error); + SwarmEvent::OutgoingConnectionError { peer_id, error } if matches!(peer_id, Some(alice_peer_id) if alice_peer_id == self.alice_peer_id) => { + tracing::warn!( "Failed to dial Alice: {}", error); if let Some(duration) = self.swarm.behaviour_mut().redial.until_next_redial() { tracing::info!("Next redial attempt in {}s", duration.as_secs()); } + } _ => {} } diff --git a/swap/src/cli/list_sellers.rs b/swap/src/cli/list_sellers.rs index 90816e2f..642459c9 100644 --- a/swap/src/cli/list_sellers.rs +++ b/swap/src/cli/list_sellers.rs @@ -6,6 +6,7 @@ use futures::StreamExt; use libp2p::multiaddr::Protocol; use libp2p::ping::{Ping, PingConfig, PingEvent}; use libp2p::request_response::{RequestResponseEvent, RequestResponseMessage}; +use libp2p::swarm::dial_opts::DialOpts; use libp2p::swarm::SwarmEvent; use libp2p::{identity, rendezvous, Multiaddr, PeerId, Swarm}; use serde::Serialize; @@ -43,7 +44,7 @@ pub async fn list_sellers( .quote .add_address(&rendezvous_node_peer_id, rendezvous_node_addr.clone()); swarm - .dial(&rendezvous_node_peer_id) + .dial(DialOpts::from(rendezvous_node_peer_id)) .context("Failed to dial rendezvous node")?; let event_loop = EventLoop::new( @@ -164,30 +165,42 @@ impl EventLoop { self.reachable_asb_address.insert(peer_id, address.clone()); } } - SwarmEvent::UnreachableAddr { peer_id, error, address, .. } => { - if address == self.rendezvous_addr { + SwarmEvent::OutgoingConnectionError { peer_id, error } => { + if let Some(peer_id_from_error) = peer_id { + + if &peer_id_from_error == &self.rendezvous_peer_id { tracing::error!( "Failed to connect to rendezvous point at {}: {}", - address, + &self.rendezvous_addr, error ); // if the rendezvous node is unreachable we just stop return Vec::new(); + } else { + tracing::error!( + "You connected to the wrong Peer: {} Error: {}", + &peer_id_from_error, + error + ); + // if for some reason the peer is not the same it will return empty too. + // this is just for the CLI to not get stuck + return Vec::new(); + } } else { tracing::debug!( "Failed to connect to peer at {}: {}", - address, + &self.rendezvous_addr, error ); - self.unreachable_asb_address.insert(peer_id, address.clone()); + self.unreachable_asb_address.insert(self.rendezvous_peer_id, self.rendezvous_addr.clone()); - match self.asb_quote_status.entry(peer_id) { + match self.asb_quote_status.entry(self.rendezvous_peer_id) { Entry::Occupied(mut entry) => { entry.insert(QuoteStatus::Received(Status::Unreachable)); }, _ => { - tracing::debug!(%peer_id, %error, "Connection error with unexpected peer") + tracing::debug!(%self.rendezvous_peer_id, %error, "Connection error with unexpected peer") } } } diff --git a/swap/src/env.rs b/swap/src/env.rs index 8ed861b4..73c6d665 100644 --- a/swap/src/env.rs +++ b/swap/src/env.rs @@ -48,7 +48,7 @@ impl GetConfig for Mainnet { Config { bitcoin_lock_mempool_timeout: 3.std_minutes(), bitcoin_lock_confirmed_timeout: 2.std_hours(), - bitcoin_finality_confirmations: 2, + bitcoin_finality_confirmations: 1, bitcoin_avg_block_time: 10.std_minutes(), bitcoin_cancel_timelock: CancelTimelock::new(72), bitcoin_punish_timelock: PunishTimelock::new(72), @@ -65,7 +65,7 @@ impl GetConfig for Testnet { Config { bitcoin_lock_mempool_timeout: 3.std_minutes(), bitcoin_lock_confirmed_timeout: 1.std_hours(), - bitcoin_finality_confirmations: 2, + bitcoin_finality_confirmations: 1, bitcoin_avg_block_time: 10.std_minutes(), bitcoin_cancel_timelock: CancelTimelock::new(12), bitcoin_punish_timelock: PunishTimelock::new(6), diff --git a/swap/src/monero/wallet_rpc.rs b/swap/src/monero/wallet_rpc.rs index 18d66064..f3fbec90 100644 --- a/swap/src/monero/wallet_rpc.rs +++ b/swap/src/monero/wallet_rpc.rs @@ -18,17 +18,17 @@ use tokio_util::io::StreamReader; compile_error!("unsupported operating system"); #[cfg(target_os = "macos")] -const DOWNLOAD_URL: &str = "http://downloads.getmonero.org/cli/monero-mac-x64-v0.17.2.0.tar.bz2"; +const DOWNLOAD_URL: &str = "http://downloads.getmonero.org/cli/monero-mac-x64-v0.17.3.0.tar.bz2"; #[cfg(all(target_os = "linux", target_arch = "x86_64"))] -const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-linux-x64-v0.17.2.0.tar.bz2"; +const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-linux-x64-v0.17.3.0.tar.bz2"; #[cfg(all(target_os = "linux", target_arch = "arm"))] const DOWNLOAD_URL: &str = - "https://downloads.getmonero.org/cli/monero-linux-armv7-v0.17.2.0.tar.bz2"; + "https://downloads.getmonero.org/cli/monero-linux-armv7-v0.17.3.0.tar.bz2"; #[cfg(target_os = "windows")] -const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-win-x64-v0.17.2.0.zip"; +const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-win-x64-v0.17.3.0.zip"; #[cfg(any(target_os = "macos", target_os = "linux"))] const PACKED_FILE: &str = "monero-wallet-rpc"; diff --git a/swap/src/network/redial.rs b/swap/src/network/redial.rs index f8e9a251..e65ffc1f 100644 --- a/swap/src/network/redial.rs +++ b/swap/src/network/redial.rs @@ -4,8 +4,9 @@ use backoff::ExponentialBackoff; use futures::future::FutureExt; use libp2p::core::connection::ConnectionId; use libp2p::core::Multiaddr; +use libp2p::swarm::dial_opts::{DialOpts, PeerCondition}; use libp2p::swarm::protocols_handler::DummyProtocolsHandler; -use libp2p::swarm::{DialPeerCondition, NetworkBehaviour, NetworkBehaviourAction, PollParameters}; +use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourAction, PollParameters}; use libp2p::PeerId; use std::pin::Pin; use std::task::{Context, Poll}; @@ -112,9 +113,10 @@ impl NetworkBehaviour for Behaviour { self.sleep = Some(Box::pin(tokio::time::sleep(next_dial_in))); - Poll::Ready(NetworkBehaviourAction::DialPeer { - peer_id: self.peer, - condition: DialPeerCondition::Disconnected, + Poll::Ready(NetworkBehaviourAction::Dial { + opts: DialOpts::peer_id(self.peer) + .condition(PeerCondition::Disconnected) + .build(), handler: Self::ProtocolsHandler::default(), }) } diff --git a/swap/src/network/rendezvous.rs b/swap/src/network/rendezvous.rs index 5f8727c5..86a698a2 100644 --- a/swap/src/network/rendezvous.rs +++ b/swap/src/network/rendezvous.rs @@ -27,3 +27,13 @@ impl From for Namespace { } } } + +impl XmrBtcNamespace { + pub fn from_is_testnet(testnet: bool) -> XmrBtcNamespace { + if testnet { + XmrBtcNamespace::Testnet + } else { + XmrBtcNamespace::Mainnet + } + } +} diff --git a/swap/src/network/swarm.rs b/swap/src/network/swarm.rs index 8d4c7703..21bbfc4d 100644 --- a/swap/src/network/swarm.rs +++ b/swap/src/network/swarm.rs @@ -16,14 +16,15 @@ pub fn asb( latest_rate: LR, resume_only: bool, env_config: env::Config, - rendezvous_params: Option<(Multiaddr, XmrBtcNamespace)>, + namespace: XmrBtcNamespace, + rendezvous_point: Option, ) -> Result>> where LR: LatestRate + Send + 'static + Debug + Clone, { let identity = seed.derive_libp2p_identity(); - let rendezvous_params = if let Some((address, namespace)) = rendezvous_params { + let rendezvous_params = if let Some(address) = rendezvous_point { let peer_id = address .extract_peer_id() .context("Rendezvous node address must contain peer ID")?; @@ -39,6 +40,7 @@ where latest_rate, resume_only, env_config, + (identity.clone(), namespace), rendezvous_params, ); diff --git a/swap/src/network/test.rs b/swap/src/network/test.rs index 03602a81..da5bac77 100644 --- a/swap/src/network/test.rs +++ b/swap/src/network/test.rs @@ -129,8 +129,9 @@ where ::OutEvent: Debug, { let addr_to_dial = other.external_addresses().next().unwrap().addr.clone(); + let local_peer_id = *other.local_peer_id(); - self.dial_addr(addr_to_dial.clone()).unwrap(); + self.dial(addr_to_dial).unwrap(); let mut dialer_done = false; let mut listener_done = false; @@ -144,8 +145,8 @@ where SwarmEvent::ConnectionEstablished { .. } => { dialer_done = true; } - SwarmEvent::UnknownPeerUnreachableAddr { address, error } if address == addr_to_dial => { - panic!("Failed to dial address {}: {}", addr_to_dial, error) + SwarmEvent::OutgoingConnectionError { peer_id, error } if matches!(peer_id, Some(alice_peer_id) if alice_peer_id == local_peer_id) => { + panic!("Failed to dial address {}: {}", peer_id.unwrap(), error) } other => { tracing::debug!("Ignoring {:?}", other); diff --git a/swap/src/network/tor_transport.rs b/swap/src/network/tor_transport.rs index 2bee690a..4f441e17 100644 --- a/swap/src/network/tor_transport.rs +++ b/swap/src/network/tor_transport.rs @@ -60,6 +60,28 @@ impl Transport for TorDialOnlyTransport { fn address_translation(&self, _: &Multiaddr, _: &Multiaddr) -> Option { None } + fn dial_as_listener(self, addr: Multiaddr) -> Result> { + let address = TorCompatibleAddress::from_multiaddr(Cow::Borrowed(&addr))?; + + if address.is_certainly_not_reachable_via_tor_daemon() { + return Err(TransportError::MultiaddrNotSupported(addr)); + } + + let dial_future = async move { + tracing::debug!(address = %addr, "Establishing connection through Tor proxy"); + + let stream = + Socks5Stream::connect((Ipv4Addr::LOCALHOST, self.socks_port), address.to_string()) + .await + .map_err(|e| io::Error::new(io::ErrorKind::ConnectionRefused, e))?; + + tracing::debug!("Connection through Tor established"); + + Ok(TcpStream(stream.into_inner())) + }; + + Ok(dial_future.boxed()) + } } /// Represents an address that is _compatible_ with Tor, i.e. can be resolved by diff --git a/swap/src/protocol/bob/state.rs b/swap/src/protocol/bob/state.rs index baedbdba..90e5f9f8 100644 --- a/swap/src/protocol/bob/state.rs +++ b/swap/src/protocol/bob/state.rs @@ -659,8 +659,7 @@ impl State6 { pub async fn publish_refund_btc(&self, bitcoin_wallet: &bitcoin::Wallet) -> Result<()> { let signed_tx_refund = self.signed_refund_transaction()?; - let (_, subscription) = bitcoin_wallet.broadcast(signed_tx_refund, "refund").await?; - subscription.wait_until_final().await?; + bitcoin_wallet.broadcast(signed_tx_refund, "refund").await?; Ok(()) } diff --git a/swap/src/protocol/bob/swap.rs b/swap/src/protocol/bob/swap.rs index f8367ca9..c82bf10e 100644 --- a/swap/src/protocol/bob/swap.rs +++ b/swap/src/protocol/bob/swap.rs @@ -278,9 +278,12 @@ async fn next_state( state.publish_refund_btc(bitcoin_wallet).await?; BobState::BtcRefunded(state) } - ExpiredTimelocks::Punish => BobState::BtcPunished { - tx_lock_id: state.tx_lock_id(), - }, + ExpiredTimelocks::Punish => { + tracing::info!("You have been punished for not refunding in time"); + BobState::BtcPunished { + tx_lock_id: state.tx_lock_id(), + } + } } } BobState::BtcRefunded(state4) => BobState::BtcRefunded(state4), diff --git a/swap/tests/harness/mod.rs b/swap/tests/harness/mod.rs index b23201e0..e7971e66 100644 --- a/swap/tests/harness/mod.rs +++ b/swap/tests/harness/mod.rs @@ -19,6 +19,7 @@ use swap::bitcoin::{CancelTimelock, PunishTimelock, TxCancel, TxPunish, TxRedeem use swap::database::SqliteDatabase; use swap::env::{Config, GetConfig}; use swap::fs::ensure_directory_exists; +use swap::network::rendezvous::XmrBtcNamespace; use swap::network::swarm; use swap::protocol::alice::{AliceState, Swap}; use swap::protocol::bob::BobState; @@ -243,6 +244,7 @@ async fn start_alice( latest_rate, resume_only, env_config, + XmrBtcNamespace::Testnet, None, ) .unwrap(); @@ -469,18 +471,15 @@ impl BobParams { ) -> Result<(cli::EventLoop, cli::EventLoopHandle)> { let tor_socks5_port = get_port() .expect("We don't care about Tor in the tests so we get a free port to disable it."); + let identity = self.seed.derive_libp2p_identity(); let behaviour = cli::Behaviour::new( self.alice_peer_id, self.env_config, self.bitcoin_wallet.clone(), + (identity.clone(), XmrBtcNamespace::Testnet), ); - let mut swarm = swarm::cli( - self.seed.derive_libp2p_identity(), - tor_socks5_port, - behaviour, - ) - .await?; + let mut swarm = swarm::cli(identity.clone(), tor_socks5_port, behaviour).await?; swarm .behaviour_mut() .add_address(self.alice_peer_id, self.alice_address.clone());