comit-network / xmr-btc-swap

Bitcoin–Monero Cross-chain Atomic Swap
GNU General Public License v3.0
635 stars 78 forks source link

Can't swap: can't `list-sellers` because local peer doesn't support protocols requested by remote #1414

Open icy-ux opened 1 year ago

icy-ux commented 1 year ago

Describe the bug

1215 but it appears on non-Whonix systems as well: I have tested it on Ubuntu, Debian, and Fedora. All produced the same problem.

This makes it impossible to actually perform swaps.

The issue arises even when talking to the quasi-official unstoppableswap.net peer:

2023-07-27T08:02:25.004881109Z DEBUG Connection established to peer peer_id=12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX address=/dns4/beta.unstoppableswap.net/tcp/9939/p2p/12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX
2023-07-27T08:02:25.534101275Z DEBUG Ignoring seller, because unable to request quote: The local peer supports none of the protocols requested by the remote peer=12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX

Therefore it seems unlikely to be the result of sellers using outdated software. I assume unstoppableswap.net keeps theirs updated.

Lost/trapped Funds No

Debug logs

$ ./swap --debug list-sellers --rendezvous-point /dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE
2023-07-27T08:02:19.192388355Z  INFO Logging initialized to /home/user/.local/share/xmr-btc-swap/cli/mainnet/logs
2023-07-27T08:02:19.240634756Z DEBUG Reading in seed from /home/user/.local/share/xmr-btc-swap/cli/mainnet/seed.pem
2023-07-27T08:02:20.835367339Z DEBUG Establishing connection through Tor proxy address=/dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE
2023-07-27T08:02:21.142249942Z DEBUG Connection through Tor established
2023-07-27T08:02:22.02048704Z  INFO Connected to rendezvous point, discovering nodes in 'xmr-btc-swap-mainnet' namespace ...
2023-07-27T08:02:22.5103932Z  INFO Discovered peer peer_id=12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX address=/dns4/beta.unstoppableswap.net/tcp/9939
2023-07-27T08:02:22.510501164Z  INFO Discovered peer peer_id=12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX address=/dns4/beta.unstoppableswap.net/tcp/9940/ws
2023-07-27T08:02:22.510571354Z  INFO Discovered peer peer_id=12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS address=/onion3/l2teomifhbwi56auubfe24fxxi6lsqz6ukw3dspbzw4umxgl7e7oo2id:9939
2023-07-27T08:02:22.510632925Z  INFO Discovered peer peer_id=12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS address=/onion3/l2teomifhbwi56auubfe24fxxi6lsqz6ukw3dspbzw4umxgl7e7oo2id:9940
2023-07-27T08:02:22.510667671Z  INFO Discovered peer peer_id=12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS address=/ip4/45.138.50.29/tcp/9939
2023-07-27T08:02:22.510699411Z  INFO Discovered peer peer_id=12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS address=/ip4/45.138.50.29/tcp/9940/ws
2023-07-27T08:02:22.510866778Z DEBUG Establishing connection through Tor proxy address=/dns4/beta.unstoppableswap.net/tcp/9939/p2p/12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX
2023-07-27T08:02:22.510935563Z DEBUG Establishing connection through Tor proxy address=/onion3/l2teomifhbwi56auubfe24fxxi6lsqz6ukw3dspbzw4umxgl7e7oo2id:9939/p2p/12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS
2023-07-27T08:02:23.433592079Z DEBUG Connection through Tor established
2023-07-27T08:02:25.004881109Z DEBUG Connection established to peer peer_id=12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX address=/dns4/beta.unstoppableswap.net/tcp/9939/p2p/12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX
2023-07-27T08:02:25.534101275Z DEBUG Ignoring seller, because unable to request quote: The local peer supports none of the protocols requested by the remote peer=12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX
2023-07-27T08:02:25.719624099Z ERROR Received bid quote from unexpected peer, this record will be removed! peer=12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX
2023-07-27T08:02:28.416391555Z DEBUG Establishing connection through Tor proxy address=/onion3/l2teomifhbwi56auubfe24fxxi6lsqz6ukw3dspbzw4umxgl7e7oo2id:9940/p2p/12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS
2023-07-27T08:02:35.681932448Z DEBUG Establishing connection through Tor proxy address=/ip4/45.138.50.29/tcp/9939/p2p/12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS
2023-07-27T08:02:36.02411797Z DEBUG Connection through Tor established
2023-07-27T08:02:37.508109644Z DEBUG Connection established to peer peer_id=12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS address=/ip4/45.138.50.29/tcp/9939/p2p/12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS
2023-07-27T08:02:38.137964837Z DEBUG Ignoring seller, because unable to request quote: The local peer supports none of the protocols requested by the remote peer=12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS
+-------+--------------+--------------+--------+---------+
| PRICE | MIN_QUANTITY | MAX_QUANTITY | STATUS | ADDRESS |
+========================================================+
+-------+--------------+--------------+--------+---------+

Platform (please complete the following information):

icy-ux commented 1 year ago

The problem seems to come from the libp2p library: the "Ignoring seller" message comes from swap/src/cli/list_sellers.rs and is the product of an InboundFailure.

Next step might be to find out which protocols the remote is asking for, and which protocols the local swap supports, and see why there is a mismatch. Both asb and swap appear to use the same Cargo.toml so it is not a question of library version mismatch.

icy-ux commented 1 year ago

Using a different rendezvous point works, because one of the sellers on this rendezvous point supports the correct protocols.

 ./swap --debug list-sellers --rendezvous-point /dns4/eratosthen.es/tcp/7798/p2p/12D3KooWAh7EXXa2ZyegzLGdjvj1W4G3EXrTGrf6trraoT1MEobs
2023-07-27T08:51:15.218686623Z  INFO Logging initialized to /home/user/.local/share/xmr-btc-swap/cli/mainnet/logs
2023-07-27T08:51:15.218843451Z DEBUG Reading in seed from /home/user/.local/share/xmr-btc-swap/cli/mainnet/seed.pem
2023-07-27T08:51:16.915897392Z DEBUG Establishing connection through Tor proxy address=/dns4/eratosthen.es/tcp/7798/p2p/12D3KooWAh7EXXa2ZyegzLGdjvj1W4G3EXrTGrf6trraoT1MEobs
2023-07-27T08:51:17.717009277Z DEBUG Connection through Tor established
2023-07-27T08:51:18.820820499Z  INFO Connected to rendezvous point, discovering nodes in 'xmr-btc-swap-mainnet' namespace ...
2023-07-27T08:51:19.827214002Z  INFO Discovered peer peer_id=12D3KooWMFPndCd4w3EkKQrFiecB72zbCPWbHWiN7K2U7QAxMit8 address=/onion3/xmrswapnme3snsgr2oydj2fmgao2l7acpyzncwnacmi5i5vbgnqby4id:9941
2023-07-27T08:51:19.827339954Z  INFO Discovered peer peer_id=12D3KooWEKJYMDstzF4i8V4LqH8xfUYRQv4p6uyA3uisKp4HaQtP address=/dnsaddr/xmrswap.me
2023-07-27T08:51:19.827395712Z  INFO Discovered peer peer_id=12D3KooWEKJYMDstzF4i8V4LqH8xfUYRQv4p6uyA3uisKp4HaQtP address=/ip4/62.210.127.86/tcp/9939
2023-07-27T08:51:19.82744586Z  INFO Discovered peer peer_id=12D3KooWEKJYMDstzF4i8V4LqH8xfUYRQv4p6uyA3uisKp4HaQtP address=/ip4/62.210.127.86/tcp/9940/ws
2023-07-27T08:51:19.827496603Z  INFO Discovered peer peer_id=12D3KooWCcFVKnFf2u1c4t47fiHLNKSnC4g6wh2i7nkczjwYRWG3 address=/dns4/xmrswap.loki/tcp/9942/p2p/12D3KooWCcFVKnFf2u1c4t47fiHLNKSnC4g6wh2i7nkczjwYRWG3
2023-07-27T08:51:19.827711841Z DEBUG Establishing connection through Tor proxy address=/onion3/xmrswapnme3snsgr2oydj2fmgao2l7acpyzncwnacmi5i5vbgnqby4id:9941/p2p/12D3KooWMFPndCd4w3EkKQrFiecB72zbCPWbHWiN7K2U7QAxMit8
2023-07-27T08:51:19.827841999Z DEBUG Establishing connection through Tor proxy address=/dns4/xmrswap.loki/tcp/9942/p2p/12D3KooWCcFVKnFf2u1c4t47fiHLNKSnC4g6wh2i7nkczjwYRWG3
2023-07-27T08:51:19.970959188Z DEBUG Connection established to peer peer_id=12D3KooWEKJYMDstzF4i8V4LqH8xfUYRQv4p6uyA3uisKp4HaQtP address=/dnsaddr/xmrswap.me/p2p/12D3KooWEKJYMDstzF4i8V4LqH8xfUYRQv4p6uyA3uisKp4HaQtP
2023-07-27T08:51:22.765179884Z ERROR Failed to connect to peer: An error occurred while negotiating the transport protocol(s) on a connection: [("/dns4/xmrswap.loki/tcp/9942/p2p/12D3KooWCcFVKnFf2u1c4t47fiHLNKSnC4g6wh2i7nkczjwYRWG3", Other(Custom { kind: Other, error: Other(A(A(Custom { kind: Other, error: A(Custom { kind: ConnectionRefused, error: HostUnreachable }) }))) }))]. peer_id=12D3KooWCcFVKnFf2u1c4t47fiHLNKSnC4g6wh2i7nkczjwYRWG3
2023-07-27T08:51:22.765322252Z DEBUG Ignoring seller, because unable to request quote: Failed to dial the requested peer peer=12D3KooWCcFVKnFf2u1c4t47fiHLNKSnC4g6wh2i7nkczjwYRWG3
2023-07-27T08:51:25.768083521Z DEBUG Connection through Tor established
2023-07-27T08:51:27.435636735Z DEBUG Connection established to peer peer_id=12D3KooWMFPndCd4w3EkKQrFiecB72zbCPWbHWiN7K2U7QAxMit8 address=/onion3/xmrswapnme3snsgr2oydj2fmgao2l7acpyzncwnacmi5i5vbgnqby4id:9941/p2p/12D3KooWMFPndCd4w3EkKQrFiecB72zbCPWbHWiN7K2U7QAxMit8
2023-07-27T08:51:28.248542402Z DEBUG Ignoring seller, because unable to request quote: The local peer supports none of the protocols requested by the remote peer=12D3KooWMFPndCd4w3EkKQrFiecB72zbCPWbHWiN7K2U7QAxMit8
+----------------+--------------+--------------+--------+------------------------------------------------------------------------------+
| PRICE          | MIN_QUANTITY | MAX_QUANTITY | STATUS | ADDRESS                                                                      |
+======================================================================================================================================+
| 0.00574386 BTC | 0.0002 BTC   | 0.0055 BTC   | Online | /dnsaddr/xmrswap.me/p2p/12D3KooWEKJYMDstzF4i8V4LqH8xfUYRQv4p6uyA3uisKp4HaQtP |
+----------------+--------------+--------------+--------+------------------------------------------------------------------------------+
icy-ux commented 1 year ago

Very strange... Now one of the sellers on the unstoppableswap.net rendezvous point is also showing up in the table when I do list-sellers with that rendezvous point, indicating the swap client and the seller were able to negotiate a connection. Previously this seller produced the previously-described protocol error and the table of sellers was empty.

The "official" unstoppableswap.net seller is still not showing up, however.

delta1 commented 1 year ago

I've seen this before, but couldn't narrow it down at the time :(

It seemed to happen only over Tor, I don't think I ever had the issue when using DNS/TCP.

@thomaseizinger is this something you have any insight on?

delta1 commented 1 year ago

It's possible upgrading libp2p could help with this, this thread has some useful info: https://github.com/libp2p/rust-libp2p/pull/3605

Unfortunately upgrading libp2p is a major task

icy-ux commented 1 year ago

It seemed to happen only over Tor, I don't think I ever had the issue when using DNS/TCP.

I saw this issue when testing over clearnet and also when testing over Tor

thomaseizinger commented 12 months ago

@thomaseizinger is this something you have any insight on?

Unfortunately no. You are running on libp2p 0.42.2 which is 1.5 years old. I am happy to answer any questions regarding updating to the latest version. I'd suggest you open a draft PR and then we can discuss things there.

binarybaron commented 11 months ago

How can it be that we are still receiving a quote?

2023-07-27T08:02:25.534101275Z DEBUG Ignoring seller, because unable to request quote: The local peer supports none of the protocols requested by the remote peer=12D3KooWMiriru5viqde3BMFLTqPur8Yrjpp4ULFc76ubQLfuYYX
icy-ux commented 11 months ago

Correction: looks like I was wrong when I suggested I had also got this problem over clearnet.

swap by default automatically uses any running Tor instance and I had Tor running on all systems that I tested this with.

Therefore all my tests (and failures) ran over Tor.

Running with

$ ./swap --debug list-sellers --rendezvous-point /dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE --tor-socks5-port 0

results in a successful handshake with all non-Tor sellers.

Since some sellers are only accessible via Tor, this is a terrible workaround!

icy-ux commented 11 months ago

I will put a 1 XMR bounty on this. Happy to send it to one of the maintainers for escrow.

icy-ux commented 11 months ago

Unfortunately upgrading libp2p is a major task

My approach to upgrading libraries is usually:

  1. bump the version in Cargo.toml
  2. commit once the compiler stops complaining

:)

tczee36 commented 8 months ago

is this fixed? i'm having the exact issue at v0.12.3