Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASB errors not propagated to CLI #249

Closed
da-kami opened this issue Mar 1, 2021 · 3 comments
Closed

ASB errors not propagated to CLI #249

da-kami opened this issue Mar 1, 2021 · 3 comments

Comments

@da-kami
Copy link
Member

da-kami commented Mar 1, 2021

Our assumption was that ASB errors involving maximum amount tradable / insufficient balance would lead to dopping the response channel, which in turn would lead to the connection being dropped at the other side (CLI).

However, this is not the case. The CLI does not react to the Failure being triggered by the ASB.

Example of the CLI triggering a swap that exceeds the maximum amount tradable:

ASB log:

2021-03-01T06:30:59.463327Z DEBUG swap::protocol::alice::event_loop: Connection Established with 12D3KooWKoWwKEgurc4B1pZ1VTZSDsUi76mYYzceAhhHE3vpMWAB
2021-03-01T06:30:59.467872Z DEBUG swap::protocol::alice::quote_response: Received quote request from 12D3KooWKoWwKEgurc4B1pZ1VTZSDsUi76mYYzceAhhHE3vpMWAB
2021-03-01T06:30:59.468086Z ERROR swap::protocol::alice::event_loop: Failed to handle quote request: The amount 7.562281951640 XMR exceeds the configured maximum sell amount of 0.500000000000 XMR XMR
2021-03-01T06:30:59.468476Z ERROR swap::protocol::alice::event_loop: Communication error: Quote Request/Response failure: Inbound failure: ResponseOmission

CLI log:

2021-03-01T06:30:57.949817Z  INFO swap_cli: Connection to Bitcoin wallet succeeded, balance: 0.03503459 BTC
2021-03-01T06:30:59.427925Z  INFO swap_cli: Opened Monero wallet for blockchain monitoring with name swap-tool-blockchain-monitoring-wallet
2021-03-01T06:30:59.429407Z  INFO swap_cli: The Monero wallet RPC is set up correctly!
2021-03-01T06:30:59.431648Z  INFO swap_cli: Swapping 0.03502849 BTC ...
2021-03-01T06:30:59.434383Z  INFO swap{id=d8cb8f1d-052d-4406-8982-df9e442c7ba9}: swap::protocol::bob::swap: Current state: quote has been requested
2021-03-01T06:30:59.434629Z DEBUG swap{id=d8cb8f1d-052d-4406-8982-df9e442c7ba9}: swap::protocol::bob::event_loop: Attempt to dial Alice
2021-03-01T06:30:59.434765Z  INFO swap::protocol::bob::event_loop: dialing alice: 12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi
2021-03-01T06:30:59.464589Z  INFO swap::protocol::bob: Requesting quote from: 12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi

The CLI waits forever at Requesting quote from ....

@thomaseizinger
Copy link
Contributor

I just looked into this and we should probably not just drop the ResponseChannel but actually send an error back.

I also saw that the TIMEOUT we are configuring is 1(!) hour so that might also play a role although a quick look into the source code suggests that the upgrade should still fail on the dialer side.

@thomaseizinger
Copy link
Contributor

I've re-read the libp2p source code and found the bug. This should fix it.

@thomaseizinger
Copy link
Contributor

#265 introduced a new protocol that now uses the default timeout of 10 seconds so at least, the CLI should no longer hang here.

Once the bugfix in libp2p is released, the error will be propagated immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants