From 6f623f0d101d9a499a9424e745b294df75c03be9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Nov 2021 11:14:00 +0000 Subject: [PATCH 1/6] Bump actions/checkout from 2.3.4 to 2.4.0 Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.4.0. - [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/v2.3.4...v2.4.0) --- 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 | 8 ++++---- .github/workflows/create-release.yml | 2 +- .github/workflows/draft-new-release.yml | 2 +- .github/workflows/preview-release.yml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index 955a24ee..1604cde2 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -45,7 +45,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout tagged commit - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 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 c1d4d341..46246c84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - uses: Swatinem/rust-cache@v1.3.0 @@ -42,7 +42,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - uses: Swatinem/rust-cache@v1.3.0 @@ -75,7 +75,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout sources - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - uses: Swatinem/rust-cache@v1.3.0 @@ -111,7 +111,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - uses: Swatinem/rust-cache@v1.3.0 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index ebe32ecb..ee95935f 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -11,7 +11,7 @@ jobs: if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2.4.0 - 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 c72725ed..6e831835 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@v2.3.4 + - uses: actions/checkout@v2.4.0 with: token: ${{ secrets.BOTTY_GITHUB_TOKEN }} diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index 65ecc775..a8207201 100644 --- a/.github/workflows/preview-release.yml +++ b/.github/workflows/preview-release.yml @@ -10,7 +10,7 @@ jobs: name: Create preview release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2.4.0 - name: Delete 'preview' release uses: larryjoelane/delete-release-action@v1.0.24 From ea790b73357c758ee2d8648458a3ea5f1c83b55b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Nov 2021 11:08:29 +0000 Subject: [PATCH 2/6] Bump strum from 0.21.0 to 0.23.0 Bumps [strum](https://github.com/Peternator7/strum) from 0.21.0 to 0.23.0. - [Release notes](https://github.com/Peternator7/strum/releases) - [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md) - [Commits](https://github.com/Peternator7/strum/commits) --- updated-dependencies: - dependency-name: strum dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 27 +++++++++++++++++++++++---- swap/Cargo.toml | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9497efba..50663a27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -567,8 +567,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11e95a3e867422fd8d04049041f5671f94d53c32a9dcd82e2be268714942f3f3" dependencies = [ "crossterm", - "strum", - "strum_macros", + "strum 0.21.0", + "strum_macros 0.21.0", "unicode-width", ] @@ -3876,8 +3876,14 @@ name = "strum" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2" + +[[package]] +name = "strum" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" dependencies = [ - "strum_macros", + "strum_macros 0.23.0", ] [[package]] @@ -3892,6 +3898,19 @@ dependencies = [ "syn", ] +[[package]] +name = "strum_macros" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00ad150e9d51e33e8142984f577662c1324d49f3be45ed37bac8645fdcbe0fe5" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "subtle" version = "2.4.0" @@ -3955,7 +3974,7 @@ dependencies = [ "spectral", "sqlx", "structopt", - "strum", + "strum 0.23.0", "tempfile", "testcontainers 0.12.0", "thiserror", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index e1ec464b..ad9c23e0 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -50,7 +50,7 @@ sha2 = "0.9" sigma_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features = false, features = [ "ed25519", "serde" ] } sqlx = { version = "0.5", features = [ "sqlite", "runtime-tokio-rustls", "offline" ] } structopt = "0.3" -strum = { version = "0.21", features = [ "derive" ] } +strum = { version = "0.23", features = [ "derive" ] } thiserror = "1" time = "0.3" tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } From e62df9c9c44f29cdc2131492d3cbd8049a78635d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Nov 2021 11:09:32 +0000 Subject: [PATCH 3/6] Bump actions/setup-python from 2.2.2 to 2.3.1 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2.2.2 to 2.3.1. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v2.2.2...v2.3.1) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/build-release-binaries.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index 955a24ee..0b7e1240 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -67,7 +67,7 @@ jobs: run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help # Remove once python 3 is the default - - uses: actions/setup-python@v2.2.2 + - uses: actions/setup-python@v2.3.1 with: python-version: '3.x' From df89ed68a9f404ffe8fc7a80b7241a1f9f53ea77 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Mon, 20 Dec 2021 14:18:10 +1100 Subject: [PATCH 4/6] Add `monero-recovery` command to print address + view/spend keys This allows manual recovery of problems like https://github.com/comit-network/xmr-btc-swap/issues/537 Since we could not figure out what causes this issue, and it is most likely an upstream problem this is the best we can do so far to allow the user to manually interact with `monero-wallet-cli` or `monero-wallet-rpc`. --- CHANGELOG.md | 8 ++++++++ swap/src/bin/swap.rs | 39 ++++++++++++++++++++++++++++++++++++++- swap/src/cli/command.rs | 19 +++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26745ad6..9690e405 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- `monero-recovery` command that can be used to print the monero address, private spend and view key so one can manually recover instances where the `monero-wallet-rpc` does not pick up the Monero funds locked up by the ASB. + Related issue: https://github.com/comit-network/xmr-btc-swap/issues/537 + The command takes the swap-id as parameter. + The swap has to be in a `BtcRedeemed` state. + Use `--help` for more details. + ## [0.10.0] - 2021-10-15 ### Removed diff --git a/swap/src/bin/swap.rs b/swap/src/bin/swap.rs index c41212bb..50e1e520 100644 --- a/swap/src/bin/swap.rs +++ b/swap/src/bin/swap.rs @@ -12,7 +12,7 @@ #![forbid(unsafe_code)] #![allow(non_snake_case)] -use anyhow::{Context, Result}; +use anyhow::{bail, Context, Result}; use comfy_table::Table; use qrcode::render::unicode; use qrcode::QrCode; @@ -417,6 +417,43 @@ async fn main() -> Result<()> { let wallet_export = bitcoin_wallet.wallet_export("cli").await?; println!("{}", wallet_export.to_string()) } + Command::MoneroRecovery { swap_id } => { + let db = open_db(data_dir.join("sqlite")).await?; + + let swap_state: BobState = db.get_state(swap_id).await?.try_into()?; + + match swap_state { + BobState::Started { .. } + | BobState::SwapSetupCompleted(_) + | BobState::BtcLocked(_) + | BobState::XmrLockProofReceived { .. } + | BobState::XmrLocked(_) + | BobState::EncSigSent(_) + | BobState::CancelTimelockExpired(_) + | BobState::BtcCancelled(_) + | BobState::BtcRefunded(_) + | BobState::BtcPunished { .. } + | BobState::SafelyAborted + | BobState::XmrRedeemed { .. } => { + bail!("Cannot print monero recovery information in state {}, only possible for BtcRedeemed", swap_state) + } + BobState::BtcRedeemed(state5) => { + let (spend_key, view_key) = state5.xmr_keys(); + + let address = monero::Address::standard( + env_config.monero_network, + monero::PublicKey::from_private_key(&spend_key), + monero::PublicKey::from(view_key.public()), + ); + tracing::info!("Wallet address: {}", address.to_string()); + + let view_key = serde_json::to_string(&view_key)?; + println!("View key: {}", view_key); + + println!("Spend key: {}", spend_key); + } + } + } }; Ok(()) } diff --git a/swap/src/cli/command.rs b/swap/src/cli/command.rs index 491f3dea..2628d5f5 100644 --- a/swap/src/cli/command.rs +++ b/swap/src/cli/command.rs @@ -249,6 +249,15 @@ where }, } } + RawCommand::MoneroRecovery { swap_id } => Arguments { + env_config: env_config_from(is_testnet), + debug, + json, + data_dir: data::data_dir_from(data, is_testnet)?, + cmd: Command::MoneroRecovery { + swap_id: swap_id.swap_id, + }, + }, }; Ok(ParseResult::Arguments(arguments)) @@ -303,6 +312,9 @@ pub enum Command { bitcoin_electrum_rpc_url: Url, bitcoin_target_block: usize, }, + MoneroRecovery { + swap_id: Uuid, + }, } #[derive(structopt::StructOpt, Debug)] @@ -439,6 +451,13 @@ enum RawCommand { #[structopt(flatten)] bitcoin: Bitcoin, }, + /// Prints Monero information related to the swap in case the generated + /// wallet fails to detect the funds. This can only be used for swaps + /// that are in a `btc is redeemed` state. + MoneroRecovery { + #[structopt(flatten)] + swap_id: SwapId, + }, } #[derive(structopt::StructOpt, Debug)] From 0569b996f4ba7d84145af77a6b7962c572c8786b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Dec 2021 06:48:55 +0000 Subject: [PATCH 5/6] Bump pem from 1.0.0 to 1.0.1 Bumps [pem](https://github.com/jcreekmore/pem-rs) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/jcreekmore/pem-rs/releases) - [Changelog](https://github.com/jcreekmore/pem-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/jcreekmore/pem-rs/compare/v1.0.0...v1.0.1) --- updated-dependencies: - dependency-name: pem dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d72694e..dce6f7ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.51" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" +checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" dependencies = [ "proc-macro2", "quote", @@ -2551,9 +2551,9 @@ dependencies = [ [[package]] name = "pem" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2373df5233932a893d3bc2c78a0bf3f6d12590a1edd546b4fbefcac32c5c0f" +checksum = "06673860db84d02a63942fa69cd9543f2624a5df3aea7f33173048fa7ad5cf1a" dependencies = [ "base64 0.13.0", "once_cell", @@ -3209,9 +3209,9 @@ dependencies = [ [[package]] name = "rust_decimal_macros" -version = "1.16.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5732c6adfbb4bbf262b7625832174ef76ccec1786bf8badfcfd11c494214f1a9" +checksum = "f2a71e447554613b11da876d63d04e78fc3e8e86769488d3b58887671e23bc86" dependencies = [ "quote", "rust_decimal", @@ -3517,9 +3517,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062b87e45d8f26714eacfaef0ed9a583e2bfd50ebd96bdd3c200733bd5758e2c" +checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3" dependencies = [ "rustversion", "serde", @@ -3880,9 +3880,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "structopt" -version = "0.3.23" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf9d950ef167e25e0bdb073cf1d68e9ad2795ac826f2f3f59647817cf23c0bfa" +checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c" dependencies = [ "clap", "lazy_static", @@ -3891,9 +3891,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.16" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134d838a2c9943ac3125cf6df165eda53493451b719f3255b2a26b85f772d0ba" +checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck", "proc-macro-error", From d0e11bac038735a25b823ff7dc31037f0cef3a9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Dec 2021 06:49:04 +0000 Subject: [PATCH 6/6] Bump hyper from 0.14.13 to 0.14.16 Bumps [hyper](https://github.com/hyperium/hyper) from 0.14.13 to 0.14.16. - [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/v0.14.13...v0.14.16) --- updated-dependencies: - dependency-name: hyper dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d72694e..f2513cfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.51" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" +checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" dependencies = [ "proc-macro2", "quote", @@ -1335,9 +1335,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" +checksum = "8f072413d126e57991455e0a922b31e4c8ba7c2ffbebf6b78b4f8521397d65cd" dependencies = [ "bytes", "fnv", @@ -1493,9 +1493,9 @@ checksum = "05842d0d43232b23ccb7060ecb0f0626922c21f30012e97b767b30afd4a5d4b9" [[package]] name = "hyper" -version = "0.14.13" +version = "0.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d1cfb9e4f68655fa04c01f59edb405b6074a0f7118ea881e5026e4a1cd8593" +checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" dependencies = [ "bytes", "futures-channel", @@ -3209,9 +3209,9 @@ dependencies = [ [[package]] name = "rust_decimal_macros" -version = "1.16.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5732c6adfbb4bbf262b7625832174ef76ccec1786bf8badfcfd11c494214f1a9" +checksum = "f2a71e447554613b11da876d63d04e78fc3e8e86769488d3b58887671e23bc86" dependencies = [ "quote", "rust_decimal", @@ -3517,9 +3517,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062b87e45d8f26714eacfaef0ed9a583e2bfd50ebd96bdd3c200733bd5758e2c" +checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3" dependencies = [ "rustversion", "serde", @@ -3880,9 +3880,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "structopt" -version = "0.3.23" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf9d950ef167e25e0bdb073cf1d68e9ad2795ac826f2f3f59647817cf23c0bfa" +checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c" dependencies = [ "clap", "lazy_static", @@ -3891,9 +3891,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.16" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134d838a2c9943ac3125cf6df165eda53493451b719f3255b2a26b85f772d0ba" +checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck", "proc-macro-error",