From 0ad78e4f30562b87942fc3357e1caf4669dcdd14 Mon Sep 17 00:00:00 2001 From: binarybaron <86064887+binarybaron@users.noreply.github.com> Date: Fri, 26 Jul 2024 00:20:17 +0200 Subject: [PATCH 01/52] revert: Update CHANGELOG.md --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb8e53e6..721f9fc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.13.4] - 2024-07-25 - - ASB: The `history` command can now be used while the asb is running. - ASB: Retry locking of Monero if it fails on first attempt From 8284bea778fb4003d339d6fc4ca93f6d8299e635 Mon Sep 17 00:00:00 2001 From: UnstoppableSwap Botty Date: Thu, 25 Jul 2024 22:31:14 +0000 Subject: [PATCH 02/52] Prepare release 0.13.4 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 721f9fc2..7127c424 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.13.4] - 2024-07-25 + - ASB: The `history` command can now be used while the asb is running. - ASB: Retry locking of Monero if it fails on first attempt @@ -373,7 +375,8 @@ It is possible to migrate critical data from the old db to the sqlite but there - Fixed an issue where Alice would not verify if Bob's Bitcoin lock transaction is semantically correct, i.e. pays the agreed upon amount to an output owned by both of them. Fixing this required a **breaking change** on the network layer and hence old versions are not compatible with this version. -[unreleased]: https://github.com/comit-network/xmr-btc-swap/compare/0.13.4...HEAD +[unreleased]: https://github.com/UnstoppableSwap/xmr-btc-swap/compare/0.13.4...HEAD +[0.13.4]: https://github.com/UnstoppableSwap/xmr-btc-swap/compare/0.13.4...0.13.4 [0.13.4]: https://github.com/comit-network/xmr-btc-swap/compare/0.13.3...0.13.4 [0.13.3]: https://github.com/comit-network/xmr-btc-swap/compare/0.13.2...0.13.3 [0.13.2]: https://github.com/comit-network/xmr-btc-swap/compare/0.13.1...0.13.2 From 49cae19059f09b5eadb72b4f73fef7c82c9913e0 Mon Sep 17 00:00:00 2001 From: binarybaron Date: Fri, 26 Jul 2024 11:40:16 +0200 Subject: [PATCH 03/52] fix: Reintroduce docker build action --- .github/workflows/build-release-binaries.yml | 53 +++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index 662e3a5e..4f466ada 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -4,6 +4,9 @@ on: release: types: [created] +env: + DOCKER_IMAGE_NAME: unstoppableswap/asb + jobs: build_binaries: name: Build @@ -82,7 +85,7 @@ jobs: run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help - id: create-archive-name - shell: python # Use python to have a prettier name for the archive on Windows. + shell: python run: | import platform os_info = platform.uname() @@ -122,3 +125,51 @@ jobs: asset_path: ./${{ steps.create-archive-name.outputs.archive }} asset_name: ${{ steps.create-archive-name.outputs.archive }} asset_content_type: application/gzip + + build_and_push_docker: + name: Build and Push Docker Image + runs-on: ubuntu-latest + needs: build_binaries + steps: + - name: Checkout code + uses: actions/checkout@v4.1.7 + with: + ref: ${{ github.event.release.target_commitish }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set Docker tags + id: docker_tags + run: | + if [[ ${{ github.event.release.tag_name }} == "preview" ]]; then + echo "::set-output name=preview::true" + else + echo "::set-output name=preview::false" + fi + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }} + ${{ env.DOCKER_IMAGE_NAME }}:latest + if: steps.docker_tags.outputs.preview == 'false' + + - name: Build and push Docker image without latest tag (preview release) + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }} + if: steps.docker_tags.outputs.preview == 'true' From 77a43ba28cca49d269f22ba7dce13c19c5b435a7 Mon Sep 17 00:00:00 2001 From: binarybaron Date: Fri, 26 Jul 2024 11:45:48 +0200 Subject: [PATCH 04/52] fix: Reintroduce Dockerfile --- Dockerfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..2dbf5397 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM rust:1.59-slim AS builder + +WORKDIR /build + +RUN apt-get update +RUN apt-get install -y git clang cmake libsnappy-dev + +COPY . . + +RUN cargo build --release --bin=asb + +FROM debian:bullseye-slim + +WORKDIR /data + +COPY --from=builder /build/target/release/asb /bin/asb + +ENTRYPOINT ["asb"] From b52e07ace9e6d7853fbc20bc965141db7d7756fb Mon Sep 17 00:00:00 2001 From: binarybaron Date: Fri, 26 Jul 2024 11:46:19 +0200 Subject: [PATCH 05/52] Revert "fix: Reintroduce docker build action" This reverts commit 49cae19059f09b5eadb72b4f73fef7c82c9913e0. --- .github/workflows/build-release-binaries.yml | 53 +------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index 4f466ada..662e3a5e 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -4,9 +4,6 @@ on: release: types: [created] -env: - DOCKER_IMAGE_NAME: unstoppableswap/asb - jobs: build_binaries: name: Build @@ -85,7 +82,7 @@ jobs: run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help - id: create-archive-name - shell: python + shell: python # Use python to have a prettier name for the archive on Windows. run: | import platform os_info = platform.uname() @@ -125,51 +122,3 @@ jobs: asset_path: ./${{ steps.create-archive-name.outputs.archive }} asset_name: ${{ steps.create-archive-name.outputs.archive }} asset_content_type: application/gzip - - build_and_push_docker: - name: Build and Push Docker Image - runs-on: ubuntu-latest - needs: build_binaries - steps: - - name: Checkout code - uses: actions/checkout@v4.1.7 - with: - ref: ${{ github.event.release.target_commitish }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set Docker tags - id: docker_tags - run: | - if [[ ${{ github.event.release.tag_name }} == "preview" ]]; then - echo "::set-output name=preview::true" - else - echo "::set-output name=preview::false" - fi - - - name: Build and push Docker image - uses: docker/build-push-action@v4 - with: - context: . - file: ./Dockerfile - push: true - tags: | - ${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }} - ${{ env.DOCKER_IMAGE_NAME }}:latest - if: steps.docker_tags.outputs.preview == 'false' - - - name: Build and push Docker image without latest tag (preview release) - uses: docker/build-push-action@v4 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }} - if: steps.docker_tags.outputs.preview == 'true' From f29bf20e8d694ae29a7202efe2cc0f014a6f7248 Mon Sep 17 00:00:00 2001 From: binarybaron Date: Fri, 26 Jul 2024 11:46:27 +0200 Subject: [PATCH 06/52] Revert "fix: Reintroduce Dockerfile" This reverts commit 77a43ba28cca49d269f22ba7dce13c19c5b435a7. --- Dockerfile | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 2dbf5397..00000000 --- a/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM rust:1.59-slim AS builder - -WORKDIR /build - -RUN apt-get update -RUN apt-get install -y git clang cmake libsnappy-dev - -COPY . . - -RUN cargo build --release --bin=asb - -FROM debian:bullseye-slim - -WORKDIR /data - -COPY --from=builder /build/target/release/asb /bin/asb - -ENTRYPOINT ["asb"] From 45e14c5a1e1b13807db182abfbe2885e5f8cf9f7 Mon Sep 17 00:00:00 2001 From: binarybaron Date: Fri, 26 Jul 2024 11:51:33 +0200 Subject: [PATCH 07/52] Revert: 8284bea778fb4003d339d6fc4ca93f6d8299e635 --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7127c424..bb8e53e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -375,8 +375,7 @@ It is possible to migrate critical data from the old db to the sqlite but there - Fixed an issue where Alice would not verify if Bob's Bitcoin lock transaction is semantically correct, i.e. pays the agreed upon amount to an output owned by both of them. Fixing this required a **breaking change** on the network layer and hence old versions are not compatible with this version. -[unreleased]: https://github.com/UnstoppableSwap/xmr-btc-swap/compare/0.13.4...HEAD -[0.13.4]: https://github.com/UnstoppableSwap/xmr-btc-swap/compare/0.13.4...0.13.4 +[unreleased]: https://github.com/comit-network/xmr-btc-swap/compare/0.13.4...HEAD [0.13.4]: https://github.com/comit-network/xmr-btc-swap/compare/0.13.3...0.13.4 [0.13.3]: https://github.com/comit-network/xmr-btc-swap/compare/0.13.2...0.13.3 [0.13.2]: https://github.com/comit-network/xmr-btc-swap/compare/0.13.1...0.13.2 From f3640aceb2d5e412e650a098957e366836f82351 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:23:43 +0000 Subject: [PATCH 08/52] build(deps): bump toml from 0.8.15 to 0.8.16 Bumps [toml](https://github.com/toml-rs/toml) from 0.8.15 to 0.8.16. - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.15...toml-v0.8.16) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6ef8e322..73be37fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -743,7 +743,7 @@ dependencies = [ "nom", "pathdiff", "serde", - "toml 0.8.15", + "toml 0.8.16", ] [[package]] @@ -4046,9 +4046,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -4579,7 +4579,7 @@ dependencies = [ "tokio-tar", "tokio-tungstenite", "tokio-util", - "toml 0.8.15", + "toml 0.8.16", "torut", "tracing", "tracing-appender", @@ -4919,9 +4919,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac2caab0bf757388c6c0ae23b3293fdb463fee59434529014f85e3263b995c28" +checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c" dependencies = [ "serde", "serde_spanned", @@ -4931,18 +4931,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.16" +version = "0.22.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788" +checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16" dependencies = [ "indexmap 2.1.0", "serde", From 011aa0cb9cd62a0c06ee80b5e7570a71924c969d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:25:26 +0000 Subject: [PATCH 09/52] build(deps): bump thomaseizinger/keep-a-changelog-new-release Bumps [thomaseizinger/keep-a-changelog-new-release](https://github.com/thomaseizinger/keep-a-changelog-new-release) from 3.0.0 to 3.1.0. - [Release notes](https://github.com/thomaseizinger/keep-a-changelog-new-release/releases) - [Changelog](https://github.com/thomaseizinger/keep-a-changelog-new-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/thomaseizinger/keep-a-changelog-new-release/compare/3.0.0...3.1.0) --- updated-dependencies: - dependency-name: thomaseizinger/keep-a-changelog-new-release dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/draft-new-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/draft-new-release.yml b/.github/workflows/draft-new-release.yml index 74ff34ba..9b9c849d 100644 --- a/.github/workflows/draft-new-release.yml +++ b/.github/workflows/draft-new-release.yml @@ -20,7 +20,7 @@ jobs: run: git checkout -b release/${{ github.event.inputs.version }} - name: Update changelog - uses: thomaseizinger/keep-a-changelog-new-release@3.0.0 + uses: thomaseizinger/keep-a-changelog-new-release@3.1.0 with: version: ${{ github.event.inputs.version }} changelogPath: CHANGELOG.md From 254874276c99bbb7ef6f2c7c5cf75c8fb1d63cc5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:00:29 +0000 Subject: [PATCH 10/52] build(deps): bump serde_json from 1.0.118 to 1.0.121 Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.118 to 1.0.121. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.118...v1.0.121) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 73be37fc..48d0552a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4035,11 +4035,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.118" +version = "1.0.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" +checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] From 9700d192b2623f35fbb5549d056ee76db5a5546a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:02:43 +0000 Subject: [PATCH 11/52] build(deps): bump tokio-socks from 0.5.1 to 0.5.2 Bumps [tokio-socks](https://github.com/sticnarf/tokio-socks) from 0.5.1 to 0.5.2. - [Release notes](https://github.com/sticnarf/tokio-socks/releases) - [Changelog](https://github.com/sticnarf/tokio-socks/blob/master/CHANGELOG.md) - [Commits](https://github.com/sticnarf/tokio-socks/compare/v0.5.1...v0.5.2) --- updated-dependencies: - dependency-name: tokio-socks dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 73be37fc..b6804d26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4841,9 +4841,9 @@ dependencies = [ [[package]] name = "tokio-socks" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0" +checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f" dependencies = [ "either", "futures-util", From 6e09c73cf369c2a9ae5620e9c88fcb80e11ef031 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 11:39:26 +0000 Subject: [PATCH 12/52] build(deps): bump toml from 0.8.16 to 0.8.17 Bumps [toml](https://github.com/toml-rs/toml) from 0.8.16 to 0.8.17. - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.16...toml-v0.8.17) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bb01de1b..78413bfc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -743,7 +743,7 @@ dependencies = [ "nom", "pathdiff", "serde", - "toml 0.8.16", + "toml 0.8.17", ] [[package]] @@ -4580,7 +4580,7 @@ dependencies = [ "tokio-tar", "tokio-tungstenite", "tokio-util", - "toml 0.8.16", + "toml 0.8.17", "torut", "tracing", "tracing-appender", @@ -4920,9 +4920,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c" +checksum = "7a44eede9b727419af8095cb2d72fab15487a541f54647ad4414b34096ee4631" dependencies = [ "serde", "serde_spanned", @@ -4932,18 +4932,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.17" +version = "0.22.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16" +checksum = "1490595c74d930da779e944f5ba2ecdf538af67df1a9848cbd156af43c1b7cf0" dependencies = [ "indexmap 2.1.0", "serde", @@ -5767,9 +5767,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.6.5" +version = "0.6.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" +checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c" dependencies = [ "memchr", ] From 587212abc7e4c5d81bea31b9e236b3ef33f58e4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 11:38:09 +0000 Subject: [PATCH 13/52] build(deps): bump mockito from 1.4.0 to 1.5.0 Bumps [mockito](https://github.com/lipanski/mockito) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/lipanski/mockito/releases) - [Commits](https://github.com/lipanski/mockito/compare/1.4.0...1.5.0) --- updated-dependencies: - dependency-name: mockito dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 14 ++++++++++---- swap/Cargo.toml | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 78413bfc..d75c78d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1774,6 +1774,7 @@ dependencies = [ "http 1.0.0", "http-body 1.0.0", "httparse", + "httpdate", "itoa", "pin-project-lite 0.2.13", "smallvec", @@ -2593,14 +2594,19 @@ dependencies = [ [[package]] name = "mockito" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f6e023aa5bdf392aa06c78e4a4e6d498baab5138d0c993503350ebbc37bf1e" +checksum = "09b34bd91b9e5c5b06338d392463e1318d683cf82ec3d3af4014609be6e2108d" dependencies = [ "assert-json-diff", + "bytes", "colored", - "futures-core", - "hyper 0.14.28", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.4.1", + "hyper-util", "log", "rand 0.8.3", "regex", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index a75c29a7..f7837c6a 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -81,7 +81,7 @@ bitcoin-harness = { git = "https://github.com/delta1/bitcoin-harness-rs.git", re get-port = "3" hyper = "1.4" jsonrpsee = { version = "0.16.2", features = [ "ws-client" ] } -mockito = "1.4" +mockito = "1.5" monero-harness = { path = "../monero-harness" } port_check = "0.2" proptest = "1" From af6bc47ed344055cc9e5e6a6a9ab15d8eb20528b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 11:39:35 +0000 Subject: [PATCH 14/52] build(deps): bump toml from 0.8.17 to 0.8.19 Bumps [toml](https://github.com/toml-rs/toml) from 0.8.17 to 0.8.19. - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.17...toml-v0.8.19) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 78413bfc..fcb20f9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -743,7 +743,7 @@ dependencies = [ "nom", "pathdiff", "serde", - "toml 0.8.17", + "toml 0.8.19", ] [[package]] @@ -4580,7 +4580,7 @@ dependencies = [ "tokio-tar", "tokio-tungstenite", "tokio-util", - "toml 0.8.17", + "toml 0.8.19", "torut", "tracing", "tracing-appender", @@ -4920,9 +4920,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a44eede9b727419af8095cb2d72fab15487a541f54647ad4414b34096ee4631" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", @@ -4941,9 +4941,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.18" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1490595c74d930da779e944f5ba2ecdf538af67df1a9848cbd156af43c1b7cf0" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap 2.1.0", "serde", @@ -5767,9 +5767,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.6.16" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] From cc854be8f4f2568905703b12a728320987ee9f5f Mon Sep 17 00:00:00 2001 From: binarybaron <86064887+binarybaron@users.noreply.github.com> Date: Thu, 1 Aug 2024 18:35:03 +0200 Subject: [PATCH 15/52] feat: Enhance history command with more swap details (#1725) --- swap/src/api.rs | 4 ++ swap/src/api/request.rs | 98 ++++++++++++++++++++++++++++++-- swap/src/asb/command.rs | 24 ++++++-- swap/src/bin/asb.rs | 86 +++++++++++++++++++++++++--- swap/src/cli/command.rs | 30 ++++++++-- swap/src/monero.rs | 15 +++-- swap/src/protocol/alice/state.rs | 4 +- swap/src/protocol/alice/swap.rs | 2 +- swap/src/protocol/bob/state.rs | 2 +- swap/tests/rpc.rs | 19 ++++++- 10 files changed, 248 insertions(+), 36 deletions(-) diff --git a/swap/src/api.rs b/swap/src/api.rs index 5640c833..a87db7c5 100644 --- a/swap/src/api.rs +++ b/swap/src/api.rs @@ -167,6 +167,7 @@ pub struct Context { pub swap_lock: Arc, pub config: Config, pub tasks: Arc, + pub is_daemon: bool, } #[allow(clippy::too_many_arguments)] @@ -180,6 +181,7 @@ impl Context { debug: bool, json: bool, server_address: Option, + is_daemon: bool, ) -> Result { let data_dir = data::data_dir_from(data, is_testnet)?; let env_config = env_config_from(is_testnet); @@ -241,6 +243,7 @@ impl Context { }, swap_lock: Arc::new(SwapLock::new()), tasks: Arc::new(PendingTaskList::default()), + is_daemon, }; Ok(context) @@ -265,6 +268,7 @@ impl Context { monero_rpc_process: None, swap_lock: Arc::new(SwapLock::new()), tasks: Arc::new(PendingTaskList::default()), + is_daemon: true, } } diff --git a/swap/src/api/request.rs b/swap/src/api/request.rs index b1e9c68c..d47e9a0d 100644 --- a/swap/src/api/request.rs +++ b/swap/src/api/request.rs @@ -8,9 +8,12 @@ use crate::protocol::bob::{BobState, Swap}; use crate::protocol::{bob, State}; use crate::{bitcoin, cli, monero, rpc}; use anyhow::{bail, Context as AnyContext, Result}; +use comfy_table::Table; use libp2p::core::Multiaddr; use qrcode::render::unicode; use qrcode::QrCode; +use rust_decimal::prelude::FromPrimitive; +use rust_decimal::Decimal; use serde_json::json; use std::cmp::min; use std::convert::TryInto; @@ -638,14 +641,97 @@ impl Request { }) } Method::History => { - let swaps = context.db.all().await?; - let mut vec: Vec<(Uuid, String)> = Vec::new(); - for (swap_id, state) in swaps { - let state: BobState = state.try_into()?; - vec.push((swap_id, state.to_string())); + let mut table = Table::new(); + table.set_header(vec![ + "Swap ID", + "Start Date", + "State", + "BTC Amount", + "XMR Amount", + "Exchange Rate", + "Trading Partner Peer ID", + ]); + + let all_swaps = context.db.all().await?; + let mut json_results = Vec::new(); + + for (swap_id, state) in all_swaps { + let result: Result<_> = async { + let latest_state: BobState = state.try_into()?; + let all_states = context.db.get_states(swap_id).await?; + let state3 = all_states + .iter() + .find_map(|s| { + if let State::Bob(BobState::BtcLocked { state3, .. }) = s { + Some(state3) + } else { + None + } + }) + .context("Failed to get \"BtcLocked\" state")?; + + let swap_start_date = context.db.get_swap_start_date(swap_id).await?; + let peer_id = context.db.get_peer_id(swap_id).await?; + let btc_amount = state3.tx_lock.lock_amount(); + let xmr_amount = state3.xmr; + let exchange_rate = Decimal::from_f64(btc_amount.to_btc()) + .ok_or_else(|| { + anyhow::anyhow!("Failed to convert BTC amount to Decimal") + })? + .checked_div(xmr_amount.as_xmr()) + .ok_or_else(|| anyhow::anyhow!("Division by zero or overflow"))?; + let exchange_rate = format!("{} XMR/BTC", exchange_rate.round_dp(8)); + + let swap_data = json!({ + "swapId": swap_id.to_string(), + "startDate": swap_start_date.to_string(), + "state": latest_state.to_string(), + "btcAmount": btc_amount.to_string(), + "xmrAmount": xmr_amount.to_string(), + "exchangeRate": exchange_rate, + "tradingPartnerPeerId": peer_id.to_string() + }); + + if context.config.json { + tracing::info!( + swap_id = %swap_id, + swap_start_date = %swap_start_date, + latest_state = %latest_state, + btc_amount = %btc_amount, + xmr_amount = %xmr_amount, + exchange_rate = %exchange_rate, + trading_partner_peer_id = %peer_id, + "Found swap in database" + ); + } else { + table.add_row(vec![ + swap_id.to_string(), + swap_start_date.to_string(), + latest_state.to_string(), + btc_amount.to_string(), + xmr_amount.to_string(), + exchange_rate, + peer_id.to_string(), + ]); + } + + Ok(swap_data) + } + .await; + + match result { + Ok(swap_data) => json_results.push(swap_data), + Err(e) => { + tracing::error!(swap_id = %swap_id, error = %e, "Failed to get swap details") + } + } } - Ok(json!({ "swaps": vec })) + if !context.config.json && !context.is_daemon { + println!("{}", table); + } + + Ok(json!({"swaps": json_results})) } Method::GetRawStates => { let raw_history = context.db.raw_all().await?; diff --git a/swap/src/asb/command.rs b/swap/src/asb/command.rs index f22e1500..260b5e9d 100644 --- a/swap/src/asb/command.rs +++ b/swap/src/asb/command.rs @@ -33,13 +33,13 @@ where env_config: env_config(testnet), cmd: Command::Start { resume_only }, }, - RawCommand::History => Arguments { + RawCommand::History { only_unfinished } => Arguments { testnet, json, disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), - cmd: Command::History, + cmd: Command::History { only_unfinished }, }, RawCommand::WithdrawBtc { amount, address } => Arguments { testnet, @@ -195,7 +195,9 @@ pub enum Command { Start { resume_only: bool, }, - History, + History { + only_unfinished: bool, + }, Config, WithdrawBtc { amount: Option, @@ -269,7 +271,13 @@ pub enum RawCommand { resume_only: bool, }, #[structopt(about = "Prints swap-id and the state of each swap ever made.")] - History, + History { + #[structopt( + long = "only-unfinished", + help = "If set, only unfinished swaps will be printed." + )] + only_unfinished: bool, + }, #[structopt(about = "Prints the current config")] Config, #[structopt(about = "Allows withdrawing BTC from the internal Bitcoin wallet.")] @@ -387,7 +395,9 @@ mod tests { disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, - cmd: Command::History, + cmd: Command::History { + only_unfinished: false, + }, }; let args = parse_args(raw_ars).unwrap(); assert_eq!(expected_args, args); @@ -570,7 +580,9 @@ mod tests { disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, - cmd: Command::History, + cmd: Command::History { + only_unfinished: false, + }, }; let args = parse_args(raw_ars).unwrap(); assert_eq!(expected_args, args); diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs index 0f2f13b5..66630b88 100644 --- a/swap/src/bin/asb.rs +++ b/swap/src/bin/asb.rs @@ -18,6 +18,8 @@ use libp2p::core::multiaddr::Protocol; use libp2p::core::Multiaddr; use libp2p::swarm::AddressScore; use libp2p::Swarm; +use rust_decimal::prelude::FromPrimitive; +use rust_decimal::Decimal; use std::convert::TryInto; use std::env; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; @@ -33,7 +35,9 @@ use swap::common::check_latest_version; use swap::database::{open_db, AccessMode}; use swap::network::rendezvous::XmrBtcNamespace; use swap::network::swarm; +use swap::protocol::alice::swap::is_complete; use swap::protocol::alice::{run, AliceState}; +use swap::protocol::State; use swap::seed::Seed; use swap::tor::AuthenticatedClient; use swap::{asb, bitcoin, kraken, monero, tor}; @@ -224,19 +228,87 @@ async fn main() -> Result<()> { event_loop.run().await; } - Command::History => { + Command::History { only_unfinished } => { let db = open_db(config.data.dir.join("sqlite"), AccessMode::ReadOnly).await?; + let mut table: Table = Table::new(); - let mut table = Table::new(); + table.set_header(vec![ + "Swap ID", + "Start Date", + "State", + "BTC Amount", + "XMR Amount", + "Exchange Rate", + "Trading Partner Peer ID", + "Completed", + ]); - table.set_header(vec!["SWAP ID", "STATE"]); + let all_swaps = db.all().await?; + for (swap_id, state) in all_swaps { + if let Err(e) = async { + let latest_state: AliceState = state.try_into()?; + let is_completed = is_complete(&latest_state); - for (swap_id, state) in db.all().await? { - let state: AliceState = state.try_into()?; - table.add_row(vec![swap_id.to_string(), state.to_string()]); + if only_unfinished && is_completed { + return Ok::<_, anyhow::Error>(()); + } + + let all_states = db.get_states(swap_id).await?; + let state3 = all_states + .iter() + .find_map(|s| match s { + State::Alice(AliceState::BtcLockTransactionSeen { state3 }) => { + Some(state3) + } + _ => None, + }) + .context("Failed to get \"BtcLockTransactionSeen\" state")?; + + let swap_start_date = db.get_swap_start_date(swap_id).await?; + let peer_id = db.get_peer_id(swap_id).await?; + + let exchange_rate = Decimal::from_f64(state3.btc.to_btc()) + .ok_or_else(|| anyhow::anyhow!("Failed to convert BTC amount to Decimal"))? + .checked_div(state3.xmr.as_xmr()) + .ok_or_else(|| anyhow::anyhow!("Division by zero or overflow"))?; + let exchange_rate = format!("{} XMR/BTC", exchange_rate.round_dp(8)); + + if json { + tracing::info!( + swap_id = %swap_id, + swap_start_date = %swap_start_date, + latest_state = %latest_state, + btc_amount = %state3.btc, + xmr_amount = %state3.xmr, + exchange_rate = %exchange_rate, + trading_partner_peer_id = %peer_id, + completed = is_completed, + "Found swap in database" + ); + } else { + table.add_row(vec![ + swap_id.to_string(), + swap_start_date.to_string(), + latest_state.to_string(), + state3.btc.to_string(), + state3.xmr.to_string(), + exchange_rate, + peer_id.to_string(), + is_completed.to_string(), + ]); + } + + Ok::<_, anyhow::Error>(()) + } + .await + { + tracing::error!(swap_id = %swap_id, error = %e, "Failed to get swap details"); + } } - println!("{}", table); + if !json { + println!("{}", table); + } } Command::Config => { let config_json = serde_json::to_string_pretty(&config)?; diff --git a/swap/src/cli/command.rs b/swap/src/cli/command.rs index 4881d94e..6c460f82 100644 --- a/swap/src/cli/command.rs +++ b/swap/src/cli/command.rs @@ -78,6 +78,7 @@ where debug, json, None, + false, ) .await?; @@ -100,14 +101,16 @@ where let request = Request::new(Method::History); let context = - Context::build(None, None, None, data, is_testnet, debug, json, None).await?; + Context::build(None, None, None, data, is_testnet, debug, json, None, false) + .await?; (context, request) } CliCommand::Config => { let request = Request::new(Method::Config); let context = - Context::build(None, None, None, data, is_testnet, debug, json, None).await?; + Context::build(None, None, None, data, is_testnet, debug, json, None, false) + .await?; (context, request) } CliCommand::Balance { bitcoin } => { @@ -124,6 +127,7 @@ where debug, json, None, + false, ) .await?; (context, request) @@ -145,6 +149,7 @@ where debug, json, server_address, + true, ) .await?; (context, request) @@ -166,6 +171,7 @@ where debug, json, None, + false, ) .await?; (context, request) @@ -187,6 +193,7 @@ where debug, json, None, + false, ) .await?; (context, request) @@ -207,6 +214,7 @@ where debug, json, None, + false, ) .await?; (context, request) @@ -217,8 +225,18 @@ where } => { let request = Request::new(Method::ListSellers { rendezvous_point }); - let context = - Context::build(None, None, Some(tor), data, is_testnet, debug, json, None).await?; + let context = Context::build( + None, + None, + Some(tor), + data, + is_testnet, + debug, + json, + None, + false, + ) + .await?; (context, request) } @@ -234,6 +252,7 @@ where debug, json, None, + false, ) .await?; (context, request) @@ -244,7 +263,8 @@ where let request = Request::new(Method::MoneroRecovery { swap_id }); let context = - Context::build(None, None, None, data, is_testnet, debug, json, None).await?; + Context::build(None, None, None, data, is_testnet, debug, json, None, false) + .await?; (context, request) } diff --git a/swap/src/monero.rs b/swap/src/monero.rs index 8205e75f..e5dd9e80 100644 --- a/swap/src/monero.rs +++ b/swap/src/monero.rs @@ -142,6 +142,14 @@ impl Amount { Decimal::from(self.as_piconero()) } + pub fn as_xmr(&self) -> Decimal { + let mut decimal = Decimal::from(self.0); + decimal + .set_scale(12) + .expect("12 is smaller than max precision of 28"); + decimal + } + fn from_decimal(amount: Decimal) -> Result { let piconeros_dec = amount.mul(Decimal::from_u64(PICONERO_OFFSET).expect("constant to fit into u64")); @@ -184,11 +192,8 @@ impl From for u64 { impl fmt::Display for Amount { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut decimal = Decimal::from(self.0); - decimal - .set_scale(12) - .expect("12 is smaller than max precision of 28"); - write!(f, "{} XMR", decimal) + let xmr_value = self.as_xmr(); + write!(f, "{} XMR", xmr_value) } } diff --git a/swap/src/protocol/alice/state.rs b/swap/src/protocol/alice/state.rs index f0acab23..7627a529 100644 --- a/swap/src/protocol/alice/state.rs +++ b/swap/src/protocol/alice/state.rs @@ -384,8 +384,8 @@ pub struct State3 { S_b_bitcoin: bitcoin::PublicKey, pub v: monero::PrivateViewKey, #[serde(with = "::bitcoin::util::amount::serde::as_sat")] - btc: bitcoin::Amount, - xmr: monero::Amount, + pub btc: bitcoin::Amount, + pub xmr: monero::Amount, pub cancel_timelock: CancelTimelock, pub punish_timelock: PunishTimelock, refund_address: bitcoin::Address, diff --git a/swap/src/protocol/alice/swap.rs b/swap/src/protocol/alice/swap.rs index 3848a2e1..14f718d3 100644 --- a/swap/src/protocol/alice/swap.rs +++ b/swap/src/protocol/alice/swap.rs @@ -440,7 +440,7 @@ where }) } -pub(crate) fn is_complete(state: &AliceState) -> bool { +pub fn is_complete(state: &AliceState) -> bool { matches!( state, AliceState::XmrRefunded diff --git a/swap/src/protocol/bob/state.rs b/swap/src/protocol/bob/state.rs index 8fe5ca32..04e7778e 100644 --- a/swap/src/protocol/bob/state.rs +++ b/swap/src/protocol/bob/state.rs @@ -369,7 +369,7 @@ pub struct State3 { S_a_monero: monero::PublicKey, S_a_bitcoin: bitcoin::PublicKey, v: monero::PrivateViewKey, - xmr: monero::Amount, + pub xmr: monero::Amount, pub cancel_timelock: CancelTimelock, punish_timelock: PunishTimelock, refund_address: bitcoin::Address, diff --git a/swap/tests/rpc.rs b/swap/tests/rpc.rs index 5dc640d4..553ccf46 100644 --- a/swap/tests/rpc.rs +++ b/swap/tests/rpc.rs @@ -103,13 +103,26 @@ mod test { let (client, _, _) = setup_daemon(harness_ctx).await; - let response: HashMap> = client + let response: HashMap> = client .request("get_history", ObjectParams::new()) .await .unwrap(); - let swaps: Vec<(Uuid, String)> = vec![(bob_swap_id, "btc is locked".to_string())]; - assert_eq!(response, HashMap::from([("swaps".to_string(), swaps)])); + let swaps = response.get("swaps").unwrap(); + assert_eq!(swaps.len(), 1); + + assert_has_keys_serde( + swaps[0].as_object().unwrap(), + &[ + "swapId", + "startDate", + "state", + "btcAmount", + "xmrAmount", + "exchangeRate", + "tradingPartnerPeerId", + ], + ); let response: HashMap>> = client .request("get_raw_states", ObjectParams::new()) From 9aaa7d358f565384eda5592914ecea9122a79d46 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:39:10 +0000 Subject: [PATCH 16/52] build(deps): bump serde_json from 1.0.121 to 1.0.122 Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.121 to 1.0.122. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.121...v1.0.122) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f374293..c95f4443 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4041,9 +4041,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.121" +version = "1.0.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609" +checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" dependencies = [ "itoa", "memchr", From 6a76e9efbe2c06febd2da3263b6e789308b46cd8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:18:44 +0000 Subject: [PATCH 17/52] build(deps): bump tempfile from 3.10.1 to 3.11.0 Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.10.1 to 3.11.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.10.1...v3.11.0) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c95f4443..233be0d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4641,12 +4641,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" dependencies = [ "cfg-if 1.0.0", "fastrand", + "once_cell", "rustix", "windows-sys 0.52.0", ] From 952fb71a6a22598c5f00ca3fe02bfb1ccb0ac65f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:15:11 +0000 Subject: [PATCH 18/52] build(deps): bump tempfile from 3.11.0 to 3.12.0 Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.11.0 to 3.12.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/commits) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 70 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 233be0d3..2addb45b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4641,15 +4641,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if 1.0.0", "fastrand", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5625,7 +5625,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -5645,17 +5654,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -5666,9 +5676,9 @@ checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -5684,9 +5694,9 @@ checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -5702,9 +5712,15 @@ checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -5720,9 +5736,9 @@ checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -5738,9 +5754,9 @@ checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -5750,9 +5766,9 @@ checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -5768,9 +5784,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" From f799da5203e9c27a91581aa444d02a42e62cbd87 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 11:50:16 +0000 Subject: [PATCH 19/52] build(deps): bump serde from 1.0.204 to 1.0.205 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.204 to 1.0.205. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.204...v1.0.205) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 233be0d3..9d4b3d1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4001,9 +4001,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.204" +version = "1.0.205" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" dependencies = [ "serde_derive", ] @@ -4030,9 +4030,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.205" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" dependencies = [ "proc-macro2", "quote", From c8cbd27b795947c4950d75f71ebd5f264de2d05a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 11:07:36 +0000 Subject: [PATCH 20/52] build(deps): bump serde_json from 1.0.122 to 1.0.124 Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.122 to 1.0.124. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.122...v1.0.124) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 35962604..a4c51e62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4041,9 +4041,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.122" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" +checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" dependencies = [ "itoa", "memchr", From 33901a2ea9c3067b54025731eb7cbae6285fec69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 11:07:58 +0000 Subject: [PATCH 21/52] build(deps): bump serde from 1.0.205 to 1.0.206 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.205 to 1.0.206. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.205...v1.0.206) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 35962604..f5f1b250 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4001,9 +4001,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.205" +version = "1.0.206" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" +checksum = "5b3e4cd94123dd520a128bcd11e34d9e9e423e7e3e50425cb1b4b1e3549d0284" dependencies = [ "serde_derive", ] @@ -4030,9 +4030,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.205" +version = "1.0.206" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" +checksum = "fabfb6138d2383ea8208cf98ccf69cdfb1aff4088460681d84189aa259762f97" dependencies = [ "proc-macro2", "quote", From 4eff6fe503e6a39fdee543703e974d1ffc5109ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:04:29 +0000 Subject: [PATCH 22/52] build(deps): bump serde from 1.0.206 to 1.0.208 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.206 to 1.0.208. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.206...v1.0.208) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99040c5c..44e21ae8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4001,9 +4001,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.206" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b3e4cd94123dd520a128bcd11e34d9e9e423e7e3e50425cb1b4b1e3549d0284" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] @@ -4030,9 +4030,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.206" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabfb6138d2383ea8208cf98ccf69cdfb1aff4088460681d84189aa259762f97" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", From 3cebddf5936426680257bf88ad5834cb4e95e1fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 11:31:40 +0000 Subject: [PATCH 23/52] build(deps): bump reqwest from 0.12.5 to 0.12.7 Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.12.5 to 0.12.7. - [Release notes](https://github.com/seanmonstar/reqwest/releases) - [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md) - [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.5...v0.12.7) --- updated-dependencies: - dependency-name: reqwest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44e21ae8..f6ef4952 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1906,7 +1906,7 @@ dependencies = [ "socket2 0.3.19", "widestring", "winapi", - "winreg 0.6.2", + "winreg", ] [[package]] @@ -3491,9 +3491,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes", @@ -3532,7 +3532,7 @@ dependencies = [ "wasm-streams", "web-sys", "webpki-roots 0.26.1", - "winreg 0.52.0", + "windows-registry", ] [[package]] @@ -4626,6 +4626,9 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "synstructure" @@ -5597,6 +5600,36 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.32.0" @@ -5806,16 +5839,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if 1.0.0", - "windows-sys 0.48.0", -] - [[package]] name = "x25519-dalek" version = "1.1.0" From 7871cf256b62d7d6fcb056c6b12d3470934f02fa Mon Sep 17 00:00:00 2001 From: Einliterflasche <81313171+Einliterflasche@users.noreply.github.com> Date: Wed, 21 Aug 2024 16:33:04 +0200 Subject: [PATCH 24/52] feat(asb + cli): Redact logs + unify tracing infrastructure (#1733) --- .cargo/config.toml | 4 + CHANGELOG.md | 3 + Cargo.lock | 39 ++++-- monero-harness/Cargo.toml | 2 +- swap/Cargo.toml | 2 + swap/src/api.rs | 14 +- swap/src/api/request.rs | 28 ++++ swap/src/asb.rs | 1 - swap/src/asb/command.rs | 69 +++++----- swap/src/asb/tracing.rs | 30 ----- swap/src/bin/asb.rs | 47 +++++-- swap/src/cli.rs | 1 - swap/src/cli/command.rs | 35 +++++ swap/src/cli/tracing.rs | 112 ---------------- swap/src/common.rs | 56 -------- swap/src/common/mod.rs | 221 ++++++++++++++++++++++++++++++++ swap/src/common/tracing_util.rs | 64 +++++++++ swap/src/database/sqlite.rs | 5 +- swap/src/rpc/methods.rs | 28 +++- swap/src/seed.rs | 4 +- 20 files changed, 505 insertions(+), 260 deletions(-) delete mode 100644 swap/src/asb/tracing.rs delete mode 100644 swap/src/cli/tracing.rs delete mode 100644 swap/src/common.rs create mode 100644 swap/src/common/mod.rs create mode 100644 swap/src/common/tracing_util.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index 0c1c209f..b707df9d 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,6 @@ [target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc" + +# windows defaults to smaller stack sizes which isn't enough +[target.'cfg(windows)'] +rustflags = ["-C", "link-args=/STACK:8388608"] diff --git a/CHANGELOG.md b/CHANGELOG.md index bb8e53e6..c22e533e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- ASB + CLI: You can now use the `logs` command to retrieve logs stored in the past, redacting addresses and id's using `logs --redact`. +- ASB: The `--disable-timestamp` flag has been removed + ## [0.13.4] - 2024-07-25 - ASB: The `history` command can now be used while the asb is running. diff --git a/Cargo.lock b/Cargo.lock index f6ef4952..f0997737 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -78,6 +78,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -1500,7 +1509,7 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ - "aho-corasick", + "aho-corasick 0.7.18", "bstr", "fnv", "log", @@ -2508,7 +2517,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata", + "regex-automata 0.1.9", ] [[package]] @@ -2517,7 +2526,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.9", ] [[package]] @@ -2653,7 +2662,7 @@ dependencies = [ "testcontainers", "tokio", "tracing", - "tracing-subscriber 0.2.25", + "tracing-subscriber 0.3.18", ] [[package]] @@ -3449,13 +3458,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.3" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.3", "memchr", - "regex-syntax 0.6.29", + "regex-automata 0.4.7", + "regex-syntax 0.8.2", ] [[package]] @@ -3468,6 +3478,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick 1.1.3", + "memchr", + "regex-syntax 0.8.2", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -4557,12 +4578,14 @@ dependencies = [ "monero", "monero-harness", "monero-rpc", + "once_cell", "pem", "port_check", "proptest", "qrcode", "rand 0.8.3", "rand_chacha 0.3.1", + "regex", "reqwest", "rust_decimal", "rust_decimal_macros", diff --git a/monero-harness/Cargo.toml b/monero-harness/Cargo.toml index 1151f47a..e15c751d 100644 --- a/monero-harness/Cargo.toml +++ b/monero-harness/Cargo.toml @@ -13,4 +13,4 @@ rand = "0.7" testcontainers = "0.15" tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "macros" ] } tracing = "0.1" -tracing-subscriber = { version = "0.2", default-features = false, features = [ "fmt", "ansi", "env-filter", "tracing-log" ] } +tracing-subscriber = { version = "0.3", default-features = false, features = [ "fmt", "ansi", "env-filter", "tracing-log" ] } diff --git a/swap/Cargo.toml b/swap/Cargo.toml index f7837c6a..8354ec0a 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -37,11 +37,13 @@ jsonrpsee-core = "0.16.2" 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" } +once_cell = "1.19" pem = "3.0" proptest = "1" qrcode = "0.14" rand = "0.8" rand_chacha = "0.3" +regex = "1.10" reqwest = { version = "0.12", features = [ "http2", "rustls-tls", "stream", "socks" ], default-features = false } rust_decimal = { version = "1", features = [ "serde-float" ] } rust_decimal_macros = "1" diff --git a/swap/src/api.rs b/swap/src/api.rs index a87db7c5..ea87aae3 100644 --- a/swap/src/api.rs +++ b/swap/src/api.rs @@ -1,12 +1,13 @@ pub mod request; use crate::cli::command::{Bitcoin, Monero, Tor}; +use crate::common::tracing_util::Format; use crate::database::{open_db, AccessMode}; use crate::env::{Config as EnvConfig, GetConfig, Mainnet, Testnet}; use crate::fs::system_data_dir; use crate::network::rendezvous::XmrBtcNamespace; use crate::protocol::Database; use crate::seed::Seed; -use crate::{bitcoin, cli, monero}; +use crate::{bitcoin, common, monero}; use anyhow::{bail, Context as AnyContext, Error, Result}; use futures::future::try_join_all; use std::fmt; @@ -16,6 +17,8 @@ use std::path::PathBuf; use std::sync::{Arc, Once}; use tokio::sync::{broadcast, broadcast::Sender, Mutex, RwLock}; use tokio::task::JoinHandle; +use tracing::level_filters::LevelFilter; +use tracing::Level; use url::Url; static START: Once = Once::new(); @@ -186,8 +189,15 @@ impl Context { let data_dir = data::data_dir_from(data, is_testnet)?; let env_config = env_config_from(is_testnet); + let format = if json { Format::Json } else { Format::Raw }; + let level_filter = if debug { + LevelFilter::from_level(Level::DEBUG) + } else { + LevelFilter::from_level(Level::INFO) + }; + START.call_once(|| { - let _ = cli::tracing::init(debug, json, data_dir.join("logs")); + let _ = common::tracing_util::init(level_filter, format, data_dir.join("logs")); }); let seed = Seed::from_file_or_generate(data_dir.as_path()) diff --git a/swap/src/api/request.rs b/swap/src/api/request.rs index d47e9a0d..33e261d3 100644 --- a/swap/src/api/request.rs +++ b/swap/src/api/request.rs @@ -1,6 +1,7 @@ use crate::api::Context; use crate::bitcoin::{Amount, ExpiredTimelocks, TxLock}; use crate::cli::{list_sellers, EventLoop, SellerStatus}; +use crate::common::get_logs; use crate::libp2p_ext::MultiAddrExt; use crate::network::quote::{BidQuote, ZeroQuoteReceived}; use crate::network::swarm; @@ -19,6 +20,7 @@ use std::cmp::min; use std::convert::TryInto; use std::future::Future; use std::net::SocketAddr; +use std::path::PathBuf; use std::sync::Arc; use std::time::Duration; use tracing::{debug_span, field, Instrument, Span}; @@ -48,6 +50,11 @@ pub enum Method { swap_id: Uuid, }, History, + Logs { + logs_dir: Option, + redact: bool, + swap_id: Option, + }, Config, WithdrawBtc { amount: Option, @@ -125,6 +132,13 @@ impl Method { log_reference_id = field::Empty ) } + Method::Logs { .. } => { + debug_span!( + "method", + method_name = "Logs", + log_reference_id = field::Empty + ) + } Method::ListSellers { .. } => { debug_span!( "method", @@ -733,6 +747,20 @@ impl Request { Ok(json!({"swaps": json_results})) } + Method::Logs { + logs_dir, + redact, + swap_id, + } => { + let dir = logs_dir.unwrap_or(context.config.data_dir.join("logs")); + let logs = get_logs(dir, swap_id, redact).await?; + + for msg in &logs { + println!("{msg}"); + } + + Ok(json!({ "logs": logs })) + } Method::GetRawStates => { let raw_history = context.db.raw_all().await?; diff --git a/swap/src/asb.rs b/swap/src/asb.rs index b5ed8ac1..404a3b61 100644 --- a/swap/src/asb.rs +++ b/swap/src/asb.rs @@ -4,7 +4,6 @@ mod event_loop; mod network; mod rate; mod recovery; -pub mod tracing; pub use event_loop::{EventLoop, EventLoopHandle, FixedRate, KrakenRate, LatestRate}; pub use network::behaviour::{Behaviour, OutEvent}; diff --git a/swap/src/asb/command.rs b/swap/src/asb/command.rs index 260b5e9d..67565065 100644 --- a/swap/src/asb/command.rs +++ b/swap/src/asb/command.rs @@ -19,7 +19,6 @@ where let args = RawArguments::from_clap(&matches); let json = args.json; - let disable_timestamp = args.disable_timestamp; let testnet = args.testnet; let config = args.config; let command: RawCommand = args.cmd; @@ -28,7 +27,6 @@ where RawCommand::Start { resume_only } => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::Start { resume_only }, @@ -36,15 +34,28 @@ where RawCommand::History { only_unfinished } => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::History { only_unfinished }, }, + RawCommand::Logs { + logs_dir: dir_path, + swap_id, + redact, + } => Arguments { + testnet, + json, + config_path: config_path(config, testnet)?, + env_config: env_config(testnet), + cmd: Command::Logs { + logs_dir: dir_path, + swap_id, + redact, + }, + }, RawCommand::WithdrawBtc { amount, address } => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::WithdrawBtc { @@ -55,7 +66,6 @@ where RawCommand::Balance => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::Balance, @@ -63,7 +73,6 @@ where RawCommand::Config => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::Config, @@ -71,7 +80,6 @@ where RawCommand::ExportBitcoinWallet => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::ExportBitcoinWallet, @@ -82,7 +90,6 @@ where }) => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::Redeem { @@ -96,7 +103,6 @@ where }) => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::Cancel { swap_id }, @@ -106,7 +112,6 @@ where }) => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::Refund { swap_id }, @@ -116,7 +121,6 @@ where }) => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::Punish { swap_id }, @@ -124,7 +128,6 @@ where RawCommand::ManualRecovery(ManualRecovery::SafelyAbort { swap_id }) => Arguments { testnet, json, - disable_timestamp, config_path: config_path(config, testnet)?, env_config: env_config(testnet), cmd: Command::SafelyAbort { swap_id }, @@ -184,7 +187,6 @@ pub struct BitcoinAddressNetworkMismatch { pub struct Arguments { pub testnet: bool, pub json: bool, - pub disable_timestamp: bool, pub config_path: PathBuf, pub env_config: env::Config, pub cmd: Command, @@ -199,6 +201,11 @@ pub enum Command { only_unfinished: bool, }, Config, + Logs { + logs_dir: Option, + swap_id: Option, + redact: bool, + }, WithdrawBtc { amount: Option, address: Address, @@ -270,6 +277,25 @@ pub enum RawCommand { )] resume_only: bool, }, + #[structopt(about = "Prints all logging messages issued in the past.")] + Logs { + #[structopt( + short = "d", + help = "Print the logs from this directory instead of the default one." + )] + logs_dir: Option, + #[structopt( + help = "Redact swap-ids, Bitcoin and Monero addresses.", + long = "redact" + )] + redact: bool, + #[structopt( + long = "swap-id", + help = "Filter for logs concerning this swap.", + long_help = "This checks whether each logging message contains the swap id. Some messages might be skipped when they don't contain the swap id even though they're relevant." + )] + swap_id: Option, + }, #[structopt(about = "Prints swap-id and the state of each swap ever made.")] History { #[structopt( @@ -374,7 +400,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::Start { resume_only: false }, @@ -392,7 +417,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::History { @@ -412,7 +436,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::Balance, @@ -434,7 +457,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::WithdrawBtc { @@ -461,7 +483,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::Cancel { @@ -487,7 +508,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::Refund { @@ -513,7 +533,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::Punish { @@ -539,7 +558,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: false, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::SafelyAbort { @@ -559,7 +577,6 @@ mod tests { let expected_args = Arguments { testnet: true, json: false, - disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, cmd: Command::Start { resume_only: false }, @@ -577,7 +594,6 @@ mod tests { let expected_args = Arguments { testnet: true, json: false, - disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, cmd: Command::History { @@ -597,7 +613,6 @@ mod tests { let expected_args = Arguments { testnet: true, json: false, - disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, cmd: Command::Balance, @@ -621,7 +636,6 @@ mod tests { let expected_args = Arguments { testnet: true, json: false, - disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, cmd: Command::WithdrawBtc { @@ -648,7 +662,6 @@ mod tests { let expected_args = Arguments { testnet: true, json: false, - disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, cmd: Command::Cancel { @@ -675,7 +688,6 @@ mod tests { let expected_args = Arguments { testnet: true, json: false, - disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, cmd: Command::Refund { @@ -702,7 +714,6 @@ mod tests { let expected_args = Arguments { testnet: true, json: false, - disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, cmd: Command::Punish { @@ -729,7 +740,6 @@ mod tests { let expected_args = Arguments { testnet: true, json: false, - disable_timestamp: false, config_path: default_testnet_conf_path, env_config: testnet_env_config, cmd: Command::SafelyAbort { @@ -749,7 +759,6 @@ mod tests { let expected_args = Arguments { testnet: false, json: false, - disable_timestamp: true, config_path: default_mainnet_conf_path, env_config: mainnet_env_config, cmd: Command::Start { resume_only: false }, diff --git a/swap/src/asb/tracing.rs b/swap/src/asb/tracing.rs deleted file mode 100644 index c21c1e70..00000000 --- a/swap/src/asb/tracing.rs +++ /dev/null @@ -1,30 +0,0 @@ -use anyhow::Result; -use tracing_subscriber::filter::LevelFilter; -use tracing_subscriber::fmt::time::UtcTime; -use tracing_subscriber::FmtSubscriber; - -pub fn init(level: LevelFilter, json_format: bool, timestamp: bool) -> Result<()> { - if level == LevelFilter::OFF { - return Ok(()); - } - - let is_terminal = atty::is(atty::Stream::Stderr); - - let builder = FmtSubscriber::builder() - .with_env_filter(format!("asb={},swap={}", level, level)) - .with_writer(std::io::stderr) - .with_ansi(is_terminal) - .with_timer(UtcTime::rfc_3339()) - .with_target(false); - - match (json_format, timestamp) { - (true, true) => builder.json().init(), - (true, false) => builder.json().without_time().init(), - (false, true) => builder.init(), - (false, false) => builder.without_time().init(), - } - - tracing::info!(%level, "Initialized tracing"); - - Ok(()) -} diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs index 66630b88..3a0d2dd4 100644 --- a/swap/src/bin/asb.rs +++ b/swap/src/bin/asb.rs @@ -31,7 +31,8 @@ use swap::asb::config::{ initial_setup, query_user_for_initial_config, read_config, Config, ConfigNotInitialized, }; use swap::asb::{cancel, punish, redeem, refund, safely_abort, EventLoop, Finality, KrakenRate}; -use swap::common::check_latest_version; +use swap::common::tracing_util::Format; +use swap::common::{self, check_latest_version, get_logs}; use swap::database::{open_db, AccessMode}; use swap::network::rendezvous::XmrBtcNamespace; use swap::network::swarm; @@ -40,44 +41,40 @@ use swap::protocol::alice::{run, AliceState}; use swap::protocol::State; use swap::seed::Seed; use swap::tor::AuthenticatedClient; -use swap::{asb, bitcoin, kraken, monero, tor}; +use swap::{bitcoin, kraken, monero, tor}; use tracing_subscriber::filter::LevelFilter; const DEFAULT_WALLET_NAME: &str = "asb-wallet"; #[tokio::main] async fn main() -> Result<()> { + // parse cli arguments let Arguments { testnet, json, - disable_timestamp, config_path, env_config, cmd, } = match parse_args(env::args_os()) { Ok(args) => args, Err(e) => { + // make sure to display the clap error message it exists if let Some(clap_err) = e.downcast_ref::() { - match clap_err.kind { - ErrorKind::HelpDisplayed | ErrorKind::VersionDisplayed => { - println!("{}", clap_err.message); - std::process::exit(0); - } - _ => { - bail!(e); - } + if let ErrorKind::HelpDisplayed | ErrorKind::VersionDisplayed = clap_err.kind { + println!("{}", clap_err.message); + std::process::exit(0); } } bail!(e); } }; + // warn if we're not on the latest version if let Err(e) = check_latest_version(env!("CARGO_PKG_VERSION")).await { eprintln!("{}", e); } - asb::tracing::init(LevelFilter::DEBUG, json, !disable_timestamp).expect("initialize tracing"); - + // read config from the specified path let config = match read_config(config_path.clone())? { Ok(config) => config, Err(ConfigNotInitialized {}) => { @@ -86,6 +83,12 @@ async fn main() -> Result<()> { } }; + // initialize tracing + let format = if json { Format::Json } else { Format::Raw }; + let log_dir = config.data.dir.join("logs"); + common::tracing_util::init(LevelFilter::DEBUG, format, log_dir).expect("initialize tracing"); + + // check for conflicting env / config values if config.monero.network != env_config.monero_network { bail!(format!( "Expected monero network in config file to be {:?} but was {:?}", @@ -112,6 +115,7 @@ async fn main() -> Result<()> { rendezvous_addrs.sort(); rendezvous_addrs.dedup(); let new_len = rendezvous_addrs.len(); + if new_len < prev_len { tracing::warn!( "`rendezvous_point` config has {} duplicate entries, they are being ignored.", @@ -119,9 +123,12 @@ async fn main() -> Result<()> { ); } + // initialize monero wallet let monero_wallet = init_monero_wallet(&config, env_config).await?; let monero_address = monero_wallet.get_main_address(); tracing::info!(%monero_address, "Monero wallet address"); + + // check monero balance let monero = monero_wallet.get_balance().await?; match (monero.balance, monero.unlocked_balance) { (0, _) => { @@ -144,6 +151,7 @@ async fn main() -> Result<()> { } } + // init bitcoin wallet let bitcoin_wallet = init_bitcoin_wallet(&config, &seed, env_config).await?; let bitcoin_balance = bitcoin_wallet.balance().await?; tracing::info!(%bitcoin_balance, "Bitcoin wallet balance"); @@ -314,6 +322,19 @@ async fn main() -> Result<()> { let config_json = serde_json::to_string_pretty(&config)?; println!("{}", config_json); } + Command::Logs { + logs_dir, + swap_id, + redact, + } => { + let dir = logs_dir.unwrap_or(config.data.dir.join("logs")); + + let log_messages = get_logs(dir, swap_id, redact).await?; + + for msg in log_messages { + println!("{msg}"); + } + } Command::WithdrawBtc { amount, address } => { let bitcoin_wallet = init_bitcoin_wallet(&config, &seed, env_config).await?; diff --git a/swap/src/cli.rs b/swap/src/cli.rs index f0faf146..6085eca0 100644 --- a/swap/src/cli.rs +++ b/swap/src/cli.rs @@ -3,7 +3,6 @@ pub mod cancel_and_refund; pub mod command; mod event_loop; mod list_sellers; -pub mod tracing; pub mod transport; pub use behaviour::{Behaviour, OutEvent}; diff --git a/swap/src/cli/command.rs b/swap/src/cli/command.rs index 6c460f82..acce7a50 100644 --- a/swap/src/cli/command.rs +++ b/swap/src/cli/command.rs @@ -105,6 +105,22 @@ where .await?; (context, request) } + CliCommand::Logs { + logs_dir, + redact, + swap_id, + } => { + let request = Request::new(Method::Logs { + logs_dir, + redact, + swap_id, + }); + let context = + Context::build(None, None, None, data, is_testnet, debug, json, None, false) + .await?; + + (context, request) + } CliCommand::Config => { let request = Request::new(Method::Config); @@ -341,6 +357,25 @@ enum CliCommand { }, /// Show a list of past, ongoing and completed swaps History, + /// Output all logging messages that have been issued. + Logs { + #[structopt( + short = "d", + help = "Print the logs from this directory instead of the default one." + )] + logs_dir: Option, + #[structopt( + help = "Redact swap-ids, Bitcoin and Monero addresses.", + long = "redact" + )] + redact: bool, + #[structopt( + long = "swap-id", + help = "Filter for logs concerning this swap.", + long_help = "This checks whether each logging message contains the swap id. Some messages might be skipped when they don't contain the swap id even though they're relevant." + )] + swap_id: Option, + }, #[structopt(about = "Prints the current config")] Config, #[structopt(about = "Allows withdrawing BTC from the internal Bitcoin wallet.")] diff --git a/swap/src/cli/tracing.rs b/swap/src/cli/tracing.rs deleted file mode 100644 index 6b6de60f..00000000 --- a/swap/src/cli/tracing.rs +++ /dev/null @@ -1,112 +0,0 @@ -use anyhow::Result; -use std::path::Path; -use time::format_description::well_known::Rfc3339; -use tracing::subscriber::set_global_default; -use tracing::{Event, Level, Subscriber}; -use tracing_subscriber::fmt::format::{DefaultFields, Format, JsonFields}; -use tracing_subscriber::fmt::time::UtcTime; -use tracing_subscriber::layer::{Context, SubscriberExt}; -use tracing_subscriber::{fmt, EnvFilter, Layer, Registry}; - -pub fn init(debug: bool, json: bool, dir: impl AsRef) -> Result<()> { - let level_filter = EnvFilter::try_new("swap=debug")?; - let registry = Registry::default().with(level_filter); - - let appender = tracing_appender::rolling::never(dir.as_ref(), "swap-all.log"); - - let file_logger = registry.with( - fmt::layer() - .with_ansi(false) - .with_target(false) - .json() - .with_writer(appender), - ); - - if json && debug { - set_global_default(file_logger.with(debug_json_terminal_printer()))?; - } else if json && !debug { - set_global_default(file_logger.with(info_json_terminal_printer()))?; - } else if !json && debug { - set_global_default(file_logger.with(debug_terminal_printer()))?; - } else { - set_global_default(file_logger.with(info_terminal_printer()))?; - } - - tracing::info!("Logging initialized to {}", dir.as_ref().display()); - Ok(()) -} - -pub struct StdErrPrinter { - inner: L, - level: Level, -} - -type StdErrLayer = - fmt::Layer, fn() -> std::io::Stderr>; - -type StdErrJsonLayer = - fmt::Layer, fn() -> std::io::Stderr>; - -fn debug_terminal_printer() -> StdErrPrinter>> { - let is_terminal = atty::is(atty::Stream::Stderr); - StdErrPrinter { - inner: fmt::layer() - .with_ansi(is_terminal) - .with_target(false) - .with_timer(UtcTime::rfc_3339()) - .with_writer(std::io::stderr), - level: Level::DEBUG, - } -} - -fn debug_json_terminal_printer() -> StdErrPrinter>> { - let is_terminal = atty::is(atty::Stream::Stderr); - StdErrPrinter { - inner: fmt::layer() - .with_ansi(is_terminal) - .with_target(false) - .with_timer(UtcTime::rfc_3339()) - .json() - .with_writer(std::io::stderr), - level: Level::DEBUG, - } -} - -fn info_terminal_printer() -> StdErrPrinter> { - let is_terminal = atty::is(atty::Stream::Stderr); - StdErrPrinter { - inner: fmt::layer() - .with_ansi(is_terminal) - .with_target(false) - .with_level(false) - .without_time() - .with_writer(std::io::stderr), - level: Level::INFO, - } -} - -fn info_json_terminal_printer() -> StdErrPrinter> { - let is_terminal = atty::is(atty::Stream::Stderr); - StdErrPrinter { - inner: fmt::layer() - .with_ansi(is_terminal) - .with_target(false) - .with_level(false) - .without_time() - .json() - .with_writer(std::io::stderr), - level: Level::INFO, - } -} - -impl Layer for StdErrPrinter -where - L: 'static + Layer, - S: Subscriber + for<'a> tracing_subscriber::registry::LookupSpan<'a>, -{ - fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>) { - if self.level.ge(event.metadata().level()) { - self.inner.on_event(event, ctx); - } - } -} diff --git a/swap/src/common.rs b/swap/src/common.rs deleted file mode 100644 index 98b9b99d..00000000 --- a/swap/src/common.rs +++ /dev/null @@ -1,56 +0,0 @@ -use anyhow::anyhow; - -const LATEST_RELEASE_URL: &str = "https://github.com/comit-network/xmr-btc-swap/releases/latest"; - -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum Version { - Current, - Available, -} - -/// Check the latest release from GitHub API. -pub async fn check_latest_version(current_version: &str) -> anyhow::Result { - let response = reqwest::get(LATEST_RELEASE_URL).await?; - let e = "Failed to get latest release."; - let download_url = response.url(); - let segments = download_url.path_segments().ok_or_else(|| anyhow!(e))?; - let latest_version = segments.last().ok_or_else(|| anyhow!(e))?; - - let result = if is_latest_version(current_version, latest_version) { - Version::Current - } else { - tracing::warn!(%current_version, %latest_version, %download_url, - "You are not on the latest version", - ); - Version::Available - }; - - Ok(result) -} - -// todo: naive implementation can be improved using semver -fn is_latest_version(current: &str, latest: &str) -> bool { - current == latest -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn it_compares_versions() { - assert!(is_latest_version("0.10.2", "0.10.2")); - assert!(!is_latest_version("0.10.2", "0.10.3")); - assert!(!is_latest_version("0.10.2", "0.11.0")); - } - - #[tokio::test] - #[ignore = "For local testing, makes http requests to github."] - async fn it_compares_with_github() { - let result = check_latest_version("0.11.0").await.unwrap(); - assert_eq!(result, Version::Available); - - let result = check_latest_version("0.11.1").await.unwrap(); - assert_eq!(result, Version::Current); - } -} diff --git a/swap/src/common/mod.rs b/swap/src/common/mod.rs new file mode 100644 index 00000000..bae1c0f4 --- /dev/null +++ b/swap/src/common/mod.rs @@ -0,0 +1,221 @@ +pub mod tracing_util; + +use std::{collections::HashMap, path::PathBuf}; + +use anyhow::anyhow; +use tokio::{ + fs::{read_dir, File}, + io::{AsyncBufReadExt, BufReader}, +}; +use uuid::Uuid; + +const LATEST_RELEASE_URL: &str = "https://github.com/comit-network/xmr-btc-swap/releases/latest"; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Version { + Current, + Available, +} + +/// Check the latest release from GitHub API. +pub async fn check_latest_version(current_version: &str) -> anyhow::Result { + let response = reqwest::get(LATEST_RELEASE_URL).await?; + let e = "Failed to get latest release."; + let download_url = response.url(); + let segments = download_url.path_segments().ok_or_else(|| anyhow!(e))?; + let latest_version = segments.last().ok_or_else(|| anyhow!(e))?; + + let result = if is_latest_version(current_version, latest_version) { + Version::Current + } else { + tracing::warn!(%current_version, %latest_version, %download_url, + "You are not on the latest version", + ); + Version::Available + }; + + Ok(result) +} + +// todo: naive implementation can be improved using semver +fn is_latest_version(current: &str, latest: &str) -> bool { + current == latest +} + +/// helper macro for [`redact`]... eldrich sorcery +/// the macro does in essence the following: +/// 1. create a static regex automaton for the pattern +/// 2. find all matching patterns using regex +/// 3. create a placeholder for each distinct matching pattern +/// 4. add the placeholder to the hashmap +macro_rules! regex_find_placeholders { + ($pattern:expr, $create_placeholder:expr, $replacements:expr, $input:expr) => {{ + // compile the regex pattern + static REGEX: once_cell::sync::Lazy = once_cell::sync::Lazy::new(|| { + tracing::debug!("initializing regex"); + regex::Regex::new($pattern).expect("invalid regex pattern") + }); + + // keep count of count patterns to generate distinct placeholders + let mut counter: usize = 0; + + // for every matched address check whether we already found it + // and if we didn't, generate a placeholder for it + for address in REGEX.find_iter($input) { + if !$replacements.contains_key(address.as_str()) { + #[allow(clippy::redundant_closure_call)] + $replacements.insert(address.as_str().to_owned(), $create_placeholder(counter)); + counter += 1; + } + } + }}; +} + +/// Print the logs from the specified logs or from the default location +/// to the specified path or the terminal. +/// +/// If specified, filter by swap id or redact addresses. +pub async fn get_logs( + logs_dir: PathBuf, + swap_id: Option, + redact_addresses: bool, +) -> anyhow::Result> { + tracing::debug!("reading logfiles from {}", logs_dir.display()); + + // get all files in the directory + let mut log_files = read_dir(&logs_dir).await?; + + let mut log_messages = Vec::new(); + // when we redact we need to store the placeholder + let mut placeholders = HashMap::new(); + + // print all lines from every log file. TODO: sort files by date? + while let Some(entry) = log_files.next_entry().await? { + // get the file path + let file_path = entry.path(); + + // filter for .log files + let file_name = file_path + .file_name() + .and_then(|name| name.to_str()) + .unwrap_or(""); + + if !file_name.ends_with(".log") { + continue; + } + + // use BufReader to stay easy on memory and then read line by line + let buf_reader = BufReader::new(File::open(&file_path).await?); + let mut lines = buf_reader.lines(); + + // print each line, redacted if the flag is set + while let Some(line) = lines.next_line().await? { + // if we should filter by swap id, check if the line contains it + if let Some(swap_id) = swap_id { + // we only want lines which contain the swap id + if !line.contains(&swap_id.to_string()) { + continue; + } + } + + // redact if necessary + let line = if redact_addresses { + redact_with(&line, &mut placeholders) + } else { + line + }; + // save redacted message + log_messages.push(line); + } + } + + Ok(log_messages) +} + +/// Redact logs, etc. by replacing Bitcoin and Monero addresses +/// with generic placeholders. +/// +/// # Example +/// ```rust +/// use swap::common::redact; +/// +/// let redacted = redact("a9165a1e-d26d-4b56-bf6d-ca9658825c44"); +/// assert_eq!(redacted, ""); +/// ``` +pub fn redact(input: &str) -> String { + let mut replacements = HashMap::new(); + redact_with(input, &mut replacements) +} + +/// Same as [`redact`] but retrieves palceholders from and stores them +/// in a specified hashmap. +pub fn redact_with(input: &str, replacements: &mut HashMap) -> String { + // TODO: verify regex patterns + const MONERO_ADDR_REGEX: &str = r#"[48][1-9A-HJ-NP-Za-km-z]{94}"#; + const BITCOIN_ADDR_REGEX: &str = r#"\b[13][a-km-zA-HJ-NP-Z1-9]{25,34}\b"#; + // Both XMR and BTC transactions have + // a 64 bit hex id so they aren't distinguishible + const TX_ID_REGEX: &str = r#"\b[a-fA-F0-9]{64}\b"#; + const SWAP_ID_REGEX: &str = + r#"\b[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}\b"#; + + // use the macro to find all addresses and generate placeholders + // has to be a macro in order to create the regex automata only once. + regex_find_placeholders!( + MONERO_ADDR_REGEX, + |count| format!(""), + replacements, + input + ); + regex_find_placeholders!( + BITCOIN_ADDR_REGEX, + |count| format!(""), + replacements, + input + ); + regex_find_placeholders!( + TX_ID_REGEX, + |count| format!(""), + replacements, + input + ); + regex_find_placeholders!( + SWAP_ID_REGEX, + |count| format!(""), + replacements, + input + ); + + // allocate string variable to operate on + let mut redacted = input.to_owned(); + + // Finally we go through the input string and replace each occurance of an + // address we want to redact with the corresponding placeholder + for (address, placeholder) in replacements.iter() { + redacted = redacted.replace(address, placeholder); + } + + redacted +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn it_compares_versions() { + assert!(is_latest_version("0.10.2", "0.10.2")); + assert!(!is_latest_version("0.10.2", "0.10.3")); + assert!(!is_latest_version("0.10.2", "0.11.0")); + } + + #[tokio::test] + #[ignore = "For local testing, makes http requests to github."] + async fn it_compares_with_github() { + let result = check_latest_version("0.11.0").await.unwrap(); + assert_eq!(result, Version::Available); + + let result = check_latest_version("0.11.1").await.unwrap(); + assert_eq!(result, Version::Current); + } +} diff --git a/swap/src/common/tracing_util.rs b/swap/src/common/tracing_util.rs new file mode 100644 index 00000000..191c43bf --- /dev/null +++ b/swap/src/common/tracing_util.rs @@ -0,0 +1,64 @@ +use std::path::Path; +use std::str::FromStr; + +use anyhow::Result; +use tracing_subscriber::filter::{Directive, LevelFilter}; +use tracing_subscriber::fmt::time::UtcTime; +use tracing_subscriber::layer::SubscriberExt; +use tracing_subscriber::util::SubscriberInitExt; +use tracing_subscriber::{fmt, EnvFilter, Layer}; + +/// Output formats for logging messages. +pub enum Format { + /// Standard, human readable format. + Raw, + /// JSON, machine readable format. + Json, +} + +/// Initialize tracing and enable logging messages according to these options. +/// Besides printing to `stdout`, this will append to a log file. +/// Said file will contain JSON-formatted logs of all levels, +/// disregarding the arguments to this function. +pub fn init(level_filter: LevelFilter, format: Format, dir: impl AsRef) -> Result<()> { + let env_filter = EnvFilter::from_default_env() + .add_directive(Directive::from_str(&format!("asb={}", &level_filter))?) + .add_directive(Directive::from_str(&format!("swap={}", &level_filter))?); + + // file logger will always write in JSON format and with timestamps + let file_appender = tracing_appender::rolling::never(&dir, "swap-all.log"); + + let file_layer = fmt::layer() + .with_writer(file_appender) + .with_ansi(false) + .with_timer(UtcTime::rfc_3339()) + .with_target(false) + .json() + .with_filter(env_filter); + + // terminal logger + let is_terminal = atty::is(atty::Stream::Stderr); + let terminal_layer = fmt::layer() + .with_writer(std::io::stdout) + .with_ansi(is_terminal) + .with_timer(UtcTime::rfc_3339()) + .with_target(false); + + // combine the layers and start logging, format with json if specified + if let Format::Json = format { + tracing_subscriber::registry() + .with(file_layer) + .with(terminal_layer.json().with_filter(level_filter)) + .init(); + } else { + tracing_subscriber::registry() + .with(file_layer) + .with(terminal_layer.with_filter(level_filter)) + .init(); + } + + // now we can use the tracing macros to log messages + tracing::info!(%level_filter, logs_dir=%dir.as_ref().display(), "Initialized tracing"); + + Ok(()) +} diff --git a/swap/src/database/sqlite.rs b/swap/src/database/sqlite.rs index eb013f66..ce455b6c 100644 --- a/swap/src/database/sqlite.rs +++ b/swap/src/database/sqlite.rs @@ -5,7 +5,7 @@ use anyhow::{anyhow, Context, Result}; use async_trait::async_trait; use libp2p::{Multiaddr, PeerId}; use sqlx::sqlite::{Sqlite, SqliteConnectOptions}; -use sqlx::{Pool, SqlitePool}; +use sqlx::{ConnectOptions, Pool, SqlitePool}; use std::collections::HashMap; use std::path::Path; use std::str::FromStr; @@ -26,7 +26,8 @@ impl SqliteDatabase { let read_only = matches!(access_mode, AccessMode::ReadOnly); let path_str = format!("sqlite:{}", path.as_ref().display()); - let options = SqliteConnectOptions::from_str(&path_str)?.read_only(read_only); + let mut options = SqliteConnectOptions::from_str(&path_str)?.read_only(read_only); + options.disable_statement_logging(); let pool = SqlitePool::connect_with(options).await?; let mut sqlite = Self { pool }; diff --git a/swap/src/rpc/methods.rs b/swap/src/rpc/methods.rs index f804e085..dd3d9a62 100644 --- a/swap/src/rpc/methods.rs +++ b/swap/src/rpc/methods.rs @@ -7,7 +7,9 @@ use anyhow::Result; use jsonrpsee::server::RpcModule; use jsonrpsee::types::Params; use libp2p::core::Multiaddr; +use serde::Deserialize; use std::collections::HashMap; +use std::path::PathBuf; use std::str::FromStr; use std::sync::Arc; use uuid::Uuid; @@ -48,8 +50,30 @@ pub fn register_modules(context: Arc) -> Result> execute_request(params_raw, Method::Balance { force_refresh }, &context).await })?; - module.register_async_method("get_history", |params, context| async move { - execute_request(params, Method::History, &context).await + module.register_async_method("get_history", |params_raw, context| async move { + execute_request(params_raw, Method::History, &context).await + })?; + + module.register_async_method("get_logs", |params_raw, context| async move { + #[derive(Debug, Clone, Deserialize)] + struct Params { + swap_id: Option, + logs_dir: Option, + redact: bool, + } + + let params: Params = params_raw.parse()?; + + execute_request( + params_raw, + Method::Logs { + swap_id: params.swap_id, + logs_dir: params.logs_dir, + redact: params.redact, + }, + &context, + ) + .await })?; module.register_async_method("get_raw_states", |params, context| async move { diff --git a/swap/src/seed.rs b/swap/src/seed.rs index aa363905..a17a7964 100644 --- a/swap/src/seed.rs +++ b/swap/src/seed.rs @@ -1,9 +1,9 @@ use crate::fs::ensure_directory_exists; -use ::bitcoin::secp256k1::constants::SECRET_KEY_SIZE; -use ::bitcoin::secp256k1::{self, SecretKey}; use anyhow::{Context, Result}; use bdk::bitcoin::util::bip32::ExtendedPrivKey; use bitcoin::hashes::{sha256, Hash, HashEngine}; +use bitcoin::secp256k1::constants::SECRET_KEY_SIZE; +use bitcoin::secp256k1::{self, SecretKey}; use libp2p::identity; use pem::{encode, Pem}; use rand::prelude::*; From 2faf7561bd279fc152de5ff4df776c308ebc1c4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:57:24 +0000 Subject: [PATCH 25/52] build(deps): bump regex from 1.10.5 to 1.10.6 Bumps [regex](https://github.com/rust-lang/regex) from 1.10.5 to 1.10.6. - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.10.5...1.10.6) --- updated-dependencies: - dependency-name: regex dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0997737..44dfaae1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3458,9 +3458,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick 1.1.3", "memchr", From 29ee6acb95408f140b96e4e103a4dc186c89af5f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 11:31:16 +0000 Subject: [PATCH 26/52] build(deps): bump async-trait from 0.1.81 to 0.1.82 Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.81 to 0.1.82. - [Release notes](https://github.com/dtolnay/async-trait/releases) - [Commits](https://github.com/dtolnay/async-trait/compare/0.1.81...0.1.82) --- updated-dependencies: - dependency-name: async-trait dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44dfaae1..6095ec0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,9 +163,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", From a8a99db73868631ecfa51adfc44a335da1b1e805 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:47:01 +0000 Subject: [PATCH 27/52] build(deps): bump serde_json from 1.0.124 to 1.0.128 Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.124 to 1.0.128. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.124...1.0.128) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44dfaae1..9df5e994 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4062,9 +4062,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.124" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", From ff9f3498892964c3f375697e467e94dbe6f99f2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:47:31 +0000 Subject: [PATCH 28/52] build(deps): bump tokio-util from 0.7.11 to 0.7.12 Bumps [tokio-util](https://github.com/tokio-rs/tokio) from 0.7.11 to 0.7.12. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-util-0.7.11...tokio-util-0.7.12) --- updated-dependencies: - dependency-name: tokio-util dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44dfaae1..8801db02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4930,9 +4930,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", From 4114772bb78b14a7dedde9a7931a44d874c91b67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:02:58 +0000 Subject: [PATCH 29/52] build(deps): bump serde from 1.0.208 to 1.0.210 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.208 to 1.0.210. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.208...v1.0.210) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44dfaae1..a046bc24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4022,9 +4022,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -4051,9 +4051,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", From 8022d8b423ad15e1def0b20a154bfff143410128 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:08:00 +0000 Subject: [PATCH 30/52] build(deps): bump anyhow from 1.0.86 to 1.0.88 Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.86 to 1.0.88. - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.86...1.0.88) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44dfaae1..d5052cb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4e1496f8fb1fbf272686b8d37f523dab3e4a7443300055e74cdaa449f3114356" [[package]] name = "arrayref" From fe77b5af95567ed4ef9663a5e37206a48f968198 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:14:20 +0000 Subject: [PATCH 31/52] build(deps): bump anyhow from 1.0.88 to 1.0.89 Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.88 to 1.0.89. - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.88...1.0.89) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 69053647..6bc9e794 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e1496f8fb1fbf272686b8d37f523dab3e4a7443300055e74cdaa449f3114356" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arrayref" From e3f31af88a48b6448739f1a003c4755abbf0e12f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:15:38 +0000 Subject: [PATCH 32/52] build(deps): bump once_cell from 1.19.0 to 1.20.0 Bumps [once_cell](https://github.com/matklad/once_cell) from 1.19.0 to 1.20.0. - [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md) - [Commits](https://github.com/matklad/once_cell/compare/v1.19.0...v1.20.0) --- updated-dependencies: - dependency-name: once_cell dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- swap/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 69053647..efc263cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2848,9 +2848,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" [[package]] name = "opaque-debug" diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 8354ec0a..ec496e45 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -37,7 +37,7 @@ jsonrpsee-core = "0.16.2" 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" } -once_cell = "1.19" +once_cell = "1.20" pem = "3.0" proptest = "1" qrcode = "0.14" From e01986bb5018e39944753d764d41fa7a2e6dfcb1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:42:15 +0000 Subject: [PATCH 33/52] build(deps): bump thiserror from 1.0.63 to 1.0.64 Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.63 to 1.0.64. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.63...1.0.64) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6bc9e794..4c3a59e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4716,18 +4716,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", From 523adc6d26dad1529d2e0c8c46732ceb9eecf112 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:18:25 +0000 Subject: [PATCH 34/52] build(deps): bump async-trait from 0.1.82 to 0.1.83 Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.82 to 0.1.83. - [Release notes](https://github.com/dtolnay/async-trait/releases) - [Commits](https://github.com/dtolnay/async-trait/compare/0.1.82...0.1.83) --- updated-dependencies: - dependency-name: async-trait dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6bc9e794..169ad3f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,9 +163,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", From 6abd951b4631f9bd1a42415a4084af2763f29989 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:36:32 +0000 Subject: [PATCH 35/52] build(deps): bump regex from 1.10.6 to 1.11.0 Bumps [regex](https://github.com/rust-lang/regex) from 1.10.6 to 1.11.0. - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.10.6...1.11.0) --- updated-dependencies: - dependency-name: regex dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 20 ++++++++++---------- swap/Cargo.toml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10d3cb5a..f4c5efde 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3177,7 +3177,7 @@ dependencies = [ "rand 0.8.3", "rand_chacha 0.3.1", "rand_xorshift", - "regex-syntax 0.8.2", + "regex-syntax 0.8.5", "rusty-fork", "tempfile", "unarray", @@ -3458,14 +3458,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick 1.1.3", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.2", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -3480,13 +3480,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick 1.1.3", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.5", ] [[package]] @@ -3497,9 +3497,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rend" diff --git a/swap/Cargo.toml b/swap/Cargo.toml index ec496e45..d7d06387 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -43,7 +43,7 @@ proptest = "1" qrcode = "0.14" rand = "0.8" rand_chacha = "0.3" -regex = "1.10" +regex = "1.11" reqwest = { version = "0.12", features = [ "http2", "rustls-tls", "stream", "socks" ], default-features = false } rust_decimal = { version = "1", features = [ "serde-float" ] } rust_decimal_macros = "1" From 12c6974458a0013caa1fd21b2f85ca3a999be34f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:37:04 +0000 Subject: [PATCH 36/52] build(deps): bump tempfile from 3.12.0 to 3.13.0 Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.12.0 to 3.13.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.12.0...v3.13.0) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10d3cb5a..b673ddce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1224,9 +1224,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "fastrand" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "filetime" @@ -2132,9 +2132,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libgit2-sys" @@ -2468,9 +2468,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -3677,9 +3677,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.4.0", "errno", @@ -4667,9 +4667,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if 1.0.0", "fastrand", From a3ffd35fc0ba0bc0416fb8f29af23e64df90cbf2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:09:42 +0000 Subject: [PATCH 37/52] build(deps): bump reqwest from 0.12.7 to 0.12.8 Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.12.7 to 0.12.8. - [Release notes](https://github.com/seanmonstar/reqwest/releases) - [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md) - [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.7...v0.12.8) --- updated-dependencies: - dependency-name: reqwest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10d3cb5a..24dc7bac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3512,9 +3512,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ "base64 0.22.1", "bytes", From 88e61127363d71e267263020fe7f4dfa994e707f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:39:41 +0000 Subject: [PATCH 38/52] build(deps): bump once_cell from 1.20.0 to 1.20.2 Bumps [once_cell](https://github.com/matklad/once_cell) from 1.20.0 to 1.20.2. - [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md) - [Commits](https://github.com/matklad/once_cell/compare/v1.20.0...v1.20.2) --- updated-dependencies: - dependency-name: once_cell dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10d3cb5a..52d43f60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2848,9 +2848,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "opaque-debug" From 851086c5a24eea17147af09737bff88a3559584f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 11:47:11 +0000 Subject: [PATCH 39/52] build(deps): bump actions/checkout from 4.1.7 to 4.2.1 Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4.1.7...v4.2.1) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/build-release-binaries.yml | 2 +- .github/workflows/ci.yml | 16 ++++++++-------- .github/workflows/create-release.yml | 2 +- .github/workflows/draft-new-release.yml | 2 +- .github/workflows/preview-release.yml | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index 662e3a5e..b0fefb92 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -54,7 +54,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout tagged commit - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 with: ref: ${{ github.event.release.target_commitish }} token: ${{ secrets.BOTTY_GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3f742fc..732c2491 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 - uses: dtolnay/rust-toolchain@master with: @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 - uses: Swatinem/rust-cache@v2.7.3 @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 - uses: Swatinem/rust-cache@v2.7.3 @@ -78,7 +78,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout sources - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 - uses: Swatinem/rust-cache@v2.7.3 @@ -131,7 +131,7 @@ jobs: tool-cache: false - name: Checkout sources - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 - uses: Swatinem/rust-cache@v2.7.3 @@ -171,7 +171,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 - uses: Swatinem/rust-cache@v2.7.3 @@ -182,7 +182,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 - uses: Swatinem/rust-cache@v2.7.3 @@ -193,7 +193,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.1 - uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 443c4418..3dcd492d 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@v4.1.7 + - uses: actions/checkout@v4.2.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 9b9c849d..bd926d53 100644 --- a/.github/workflows/draft-new-release.yml +++ b/.github/workflows/draft-new-release.yml @@ -12,7 +12,7 @@ jobs: name: "Draft a new release" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.7 + - uses: actions/checkout@v4.2.1 with: token: ${{ secrets.BOTTY_GITHUB_TOKEN }} diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index ccd7e641..b216d283 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@v4.1.7 + - uses: actions/checkout@v4.2.1 - name: Delete 'preview' release uses: larryjoelane/delete-release-action@v1.0.24 From 19710e296d7680d7a3b4f3ef0c7affd84e9d5e7b Mon Sep 17 00:00:00 2001 From: binarybaron <86064887+binarybaron@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:58:27 +0600 Subject: [PATCH 40/52] docs: Add notice to ReadMe about status of maintenance (#1790) docs: Add notice to ReadMe about status of maintenance and reference community fork at UnstoppableSwap/core --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 35adc5f0..1c0226b2 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ Currently, swaps are only offered in one direction with the `swap` CLI on the bu We are working on implementing a protocol where XMR moves first, but are currently blocked by advances on Monero itself. You can read [this blogpost](https://comit.network/blog/2021/07/02/transaction-presigning) for more information. +## Maintenance + +This repository is currently maintained by community volunteers. While it remains safe to use, the original developers (@comit-network) have stopped contributing. For a more actively maintained version that includes a GUI, please check out this community fork: https://github.com/UnstoppableSwap/core + ## Quick Start 1. Download the [latest `swap` binary release](https://github.com/comit-network/xmr-btc-swap/releases/latest) for your operating system. From 3d4bc971a2874ac1676aaa7ede4abeb0a4dbbac9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:07:29 +0000 Subject: [PATCH 41/52] build(deps): bump Swatinem/rust-cache from 2.7.3 to 2.7.5 Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.3 to 2.7.5. - [Release notes](https://github.com/swatinem/rust-cache/releases) - [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md) - [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.3...v2.7.5) --- updated-dependencies: - dependency-name: Swatinem/rust-cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/build-release-binaries.yml | 2 +- .github/workflows/ci.yml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index 662e3a5e..6b8cae14 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -59,7 +59,7 @@ jobs: ref: ${{ github.event.release.target_commitish }} token: ${{ secrets.BOTTY_GITHUB_TOKEN }} - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - uses: dtolnay/rust-toolchain@master with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3f742fc..3cc27914 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: toolchain: "1.74" components: clippy,rustfmt - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - name: Check formatting uses: dprint/check@v2.2 @@ -37,7 +37,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v4.1.7 - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - name: Build swap run: cargo build --bin swap @@ -51,7 +51,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v4.1.7 - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - name: Install sqlx-cli run: cargo install --locked --version 0.6.3 sqlx-cli @@ -80,7 +80,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v4.1.7 - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - uses: dtolnay/rust-toolchain@master with: @@ -133,7 +133,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v4.1.7 - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - name: Build tests run: cargo build --tests --workspace --all-features @@ -173,7 +173,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v4.1.7 - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - name: Run test ${{ matrix.test_name }} run: cargo test --package swap --all-features --test ${{ matrix.test_name }} -- --nocapture @@ -184,7 +184,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v4.1.7 - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - name: Run RPC server tests run: cargo test --package swap --all-features --test rpc -- --nocapture @@ -197,7 +197,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2.7.3 + - uses: Swatinem/rust-cache@v2.7.5 - name: Run cargo check on stable rust run: cargo check --all-targets From 61c7afb35886dba5a9ce46f1aa6defcf367e4a7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:32:11 +0000 Subject: [PATCH 42/52] build(deps): bump futures from 0.3.30 to 0.3.31 Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.30 to 0.3.31. - [Release notes](https://github.com/rust-lang/futures-rs/releases) - [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.30...0.3.31) --- updated-dependencies: - dependency-name: futures dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 66 +++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0821b73f..17eb7fc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -169,7 +169,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] @@ -1310,9 +1310,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1325,9 +1325,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1335,15 +1335,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1364,19 +1364,19 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] @@ -1392,15 +1392,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-timer" @@ -1410,9 +1410,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -3156,9 +3156,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.74" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -4057,7 +4057,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] @@ -4137,7 +4137,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] @@ -4526,7 +4526,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] @@ -4635,9 +4635,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.46" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -4731,7 +4731,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] @@ -4837,7 +4837,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] @@ -5063,7 +5063,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] @@ -5470,7 +5470,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -5504,7 +5504,7 @@ checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5915,7 +5915,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.79", ] [[package]] From ec567ccba1eb295ca11aa43aa8debfc51dcfbbec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:55:59 +0000 Subject: [PATCH 43/52] build(deps): bump uuid from 1.10.0 to 1.11.0 Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.10.0 to 1.11.0. - [Release notes](https://github.com/uuid-rs/uuid/releases) - [Commits](https://github.com/uuid-rs/uuid/compare/1.10.0...1.11.0) --- updated-dependencies: - dependency-name: uuid dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- swap/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0821b73f..608c302d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5361,9 +5361,9 @@ checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom 0.2.11", "serde", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index d7d06387..d38d2c81 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -69,7 +69,7 @@ tracing-appender = "0.2" tracing-futures = { version = "0.2", features = [ "std-future", "futures-03" ] } tracing-subscriber = { version = "0.3", default-features = false, features = [ "fmt", "ansi", "env-filter", "time", "tracing-log", "json" ] } url = { version = "2", features = [ "serde" ] } -uuid = { version = "1.10", features = [ "serde", "v4" ] } +uuid = { version = "1.11", features = [ "serde", "v4" ] } void = "1" [target.'cfg(not(windows))'.dependencies] From d521815e913c3c50775009b5b93d260452d3c647 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:58:25 +0000 Subject: [PATCH 44/52] build(deps): bump hyper from 1.4.1 to 1.5.0 Bumps [hyper](https://github.com/hyperium/hyper) from 1.4.1 to 1.5.0. - [Release notes](https://github.com/hyperium/hyper/releases) - [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md) - [Commits](https://github.com/hyperium/hyper/compare/v1.4.1...v1.5.0) --- updated-dependencies: - dependency-name: hyper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 14 +++++++------- swap/Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0821b73f..37acc516 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1772,9 +1772,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", @@ -1799,7 +1799,7 @@ checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", "http 1.0.0", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-util", "rustls 0.23.10", "rustls-pki-types", @@ -1820,7 +1820,7 @@ dependencies = [ "futures-util", "http 1.0.0", "http-body 1.0.0", - "hyper 1.4.1", + "hyper 1.5.0", "pin-project-lite 0.2.13", "socket2 0.5.5", "tokio", @@ -2614,7 +2614,7 @@ dependencies = [ "http 1.0.0", "http-body 1.0.0", "http-body-util", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-util", "log", "rand 0.8.3", @@ -3524,7 +3524,7 @@ dependencies = [ "http 1.0.0", "http-body 1.0.0", "http-body-util", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-rustls", "hyper-util", "ipnet", @@ -4569,7 +4569,7 @@ dependencies = [ "futures", "get-port", "hex", - "hyper 1.4.1", + "hyper 1.5.0", "itertools 0.13.0", "jsonrpsee", "jsonrpsee-core", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index d7d06387..6bbdf8ea 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -81,7 +81,7 @@ zip = "0.5" [dev-dependencies] bitcoin-harness = { git = "https://github.com/delta1/bitcoin-harness-rs.git", rev = "80cc8d05db2610d8531011be505b7bee2b5cdf9f" } get-port = "3" -hyper = "1.4" +hyper = "1.5" jsonrpsee = { version = "0.16.2", features = [ "ws-client" ] } mockito = "1.5" monero-harness = { path = "../monero-harness" } From de7c8aec0a79a21280d53ebf41c271cdb2d50fec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:44:43 +0000 Subject: [PATCH 45/52] build(deps): bump anyhow from 1.0.89 to 1.0.90 Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.89 to 1.0.90. - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.89...1.0.90) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0821b73f..109f8dfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" [[package]] name = "arrayref" From 7b1b5ec3a5323049d1165683d6bf98d647b215f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:45:16 +0000 Subject: [PATCH 46/52] build(deps): bump serde_json from 1.0.128 to 1.0.132 Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.128 to 1.0.132. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/1.0.128...1.0.132) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0821b73f..c020f4e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4062,9 +4062,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", From 02a3711cc939462f75b6f1246a048ddf75d70c85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:45:51 +0000 Subject: [PATCH 47/52] build(deps): bump anyhow from 1.0.90 to 1.0.91 Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.90 to 1.0.91. - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.90...1.0.91) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7e33323..5749a8e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.90" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" [[package]] name = "arrayref" From fac5df93faf0a1ed3c255b570a06941a46f80677 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:46:56 +0000 Subject: [PATCH 48/52] build(deps): bump thiserror from 1.0.64 to 1.0.65 Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.64 to 1.0.65. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.64...1.0.65) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7e33323..b5d26f34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4716,18 +4716,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", From 44fafc792e7427e8ad3f7cb8061ee0095171e811 Mon Sep 17 00:00:00 2001 From: Binarybaron Date: Mon, 11 Nov 2024 16:02:55 +0100 Subject: [PATCH 49/52] feat(asb): Add Dockerfile --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..05e5d64c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# This Dockerfile builds the asb binary + +FROM rust:1.79-slim AS builder + +WORKDIR /build + +RUN apt-get update +RUN apt-get install -y git clang cmake libsnappy-dev + +COPY . . + +WORKDIR /build/swap + +RUN cargo build --release --bin=asb + +FROM debian:bookworm-slim + +WORKDIR /data + +COPY --from=builder /build/target/release/asb /bin/asb + +ENTRYPOINT ["asb"] From a2cc3591b158e6695f318f4b816068cd5a9ad7be Mon Sep 17 00:00:00 2001 From: Binarybaron Date: Mon, 11 Nov 2024 16:03:15 +0100 Subject: [PATCH 50/52] fix: do not panic if electrum server does not support fee estimation --- swap/src/bitcoin/wallet.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/swap/src/bitcoin/wallet.rs b/swap/src/bitcoin/wallet.rs index 9748d740..55a05b73 100644 --- a/swap/src/bitcoin/wallet.rs +++ b/swap/src/bitcoin/wallet.rs @@ -468,6 +468,7 @@ where ) -> Result { let client = self.client.lock().await; let fee_rate = client.estimate_feerate(self.target_block)?; + let min_relay_fee = client.min_relay_fee()?; estimate_fee(weight, transfer_amount, fee_rate, min_relay_fee) @@ -871,6 +872,11 @@ impl EstimateFeeRate for Client { // https://github.com/romanz/electrs/blob/f9cf5386d1b5de6769ee271df5eef324aa9491bc/src/rpc.rs#L213 // Returned estimated fees are per BTC/kb. let fee_per_byte = self.electrum.estimate_fee(target_block)?; + + if fee_per_byte < 0.0 { + bail!("Fee per byte returned by electrum server is negative: {}. This may indicate that fee estimation is not supported by this server", fee_per_byte); + } + // we do not expect fees being that high. #[allow(clippy::cast_possible_truncation)] Ok(FeeRate::from_btc_per_kvb(fee_per_byte as f32)) From 81b89d63c28562476d05c5a39c952bfbe2d7c995 Mon Sep 17 00:00:00 2001 From: binarybaron <86064887+binarybaron@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:24:06 +0100 Subject: [PATCH 51/52] docs: Add notice about breaking backwards compatability --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c0226b2..80612c4f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ You can read [this blogpost](https://comit.network/blog/2021/07/02/transaction-p ## Maintenance -This repository is currently maintained by community volunteers. While it remains safe to use, the original developers (@comit-network) have stopped contributing. For a more actively maintained version that includes a GUI, please check out this community fork: https://github.com/UnstoppableSwap/core +**This repository is unmaintained**. The original developers (@comit-network) have moved on to other projects. Community volunteers are continuing development at [UnstoppableSwap/core](https://github.com/UnstoppableSwap/core), which includes a graphical user interface. Please note that the fork has introduced network-level breaking changes, making it incompatible with peers running this repository - you will not be able to initiate swaps with them. ## Quick Start From 4db069b02c79a108ffa1d752f40cfea47deddb45 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Mon, 26 May 2025 11:14:21 +0200 Subject: [PATCH 52/52] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 80612c4f..72130de7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +> [!CAUTION] +> # THIS REPO IS UNMAINTAINED
PLEASE USE [UNSTOPPABLESWAP]([url](https://github.com/UnstoppableSwap/core)) INSTEAD + +**This repository is unmaintained**. The original developers (@comit-network) have moved on to other projects. Community volunteers are continuing development at [UnstoppableSwap/core](https://github.com/UnstoppableSwap/core), which includes a graphical user interface. Please note that the fork has introduced network-level breaking changes, making it incompatible with peers running this repository - you will not be able to initiate swaps with them. + # XMR to BTC Atomic Swap This repository hosts an MVP for atomically swapping BTC to XMR. @@ -9,10 +14,6 @@ Currently, swaps are only offered in one direction with the `swap` CLI on the bu We are working on implementing a protocol where XMR moves first, but are currently blocked by advances on Monero itself. You can read [this blogpost](https://comit.network/blog/2021/07/02/transaction-presigning) for more information. -## Maintenance - -**This repository is unmaintained**. The original developers (@comit-network) have moved on to other projects. Community volunteers are continuing development at [UnstoppableSwap/core](https://github.com/UnstoppableSwap/core), which includes a graphical user interface. Please note that the fork has introduced network-level breaking changes, making it incompatible with peers running this repository - you will not be able to initiate swaps with them. - ## Quick Start 1. Download the [latest `swap` binary release](https://github.com/comit-network/xmr-btc-swap/releases/latest) for your operating system.