Commit Graph

811 Commits

Author SHA1 Message Date
bors[bot]
bd00abe070
Merge #204
204: Upgrade to testcontainers v0.12 r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-02-17 01:16:50 +00:00
Daniel Karzel
babd1d7b60
Wait for refund if insufficient Monero is locked up 2021-02-17 11:58:05 +11:00
Daniel Karzel
ebb869e6f4 Distinguish transient and permanent Electrum errors 2021-02-17 11:56:17 +11:00
Daniel Karzel
9b93cabfdf Use context instead of map_error 2021-02-17 11:09:09 +11:00
rishflab
fe362d765b Add sync wallet on nectar's startup 2021-02-17 10:56:39 +11:00
rishflab
00e2b257c4 Remove misplaced sync wallet call 2021-02-17 10:56:10 +11:00
Thomas Eizinger
8c83f7e2e1
Upgrade to testcontainers v0.12 2021-02-16 17:11:25 +11:00
Daniel Karzel
2ced9ddba4 Prevent future from being stopped by calling forget on handle 2021-02-16 16:31:11 +11:00
Daniel Karzel
77ec7e502f Distinguish permanent and transient error when watching tx 2021-02-16 16:26:37 +11:00
bors[bot]
7a9569ffd4
Merge #178
178: Replace bitcoind wallet with bdk wallet r=rishflab a=da-kami

Create and pair bitcoind and electrs testcontainers using the same docker network and volume.

Follow-up to be fixed on top: 

- [ ] Remove bitcoin-harness dependency and directly depend on https://github.com/thomaseizinger/rust-jsonrpc-client for the RPC client. 

Co-authored-by: rishflab <rishflab@hotmail.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-02-16 05:08:08 +00:00
rishflab
b66bb00c77 Remove stale code 2021-02-16 15:13:45 +11:00
rishflab
bc1d2bda54 Test URL creation for default electrum HTTP API 2021-02-16 15:13:45 +11:00
rishflab
d296c22ecf Log bitcoin deposit address on startup 2021-02-16 14:57:12 +11:00
rishflab
4768c79070 Derive bitcoin private key from seed 2021-02-16 14:57:12 +11:00
Thomas Eizinger
a51194b9fa Instantiate electrum client with custom config with 2 retries
The default number of retries is 1. Unfortunately, the way this config
value is interpreted doesn't actually lead to a retry. We have to set
it to 2 to actually make it retry.

See https://github.com/bitcoindevkit/rust-electrum-client/issues/47.
2021-02-16 14:57:12 +11:00
rishflab
180e778df9 Allow blockchain calls to fail
Prior to this change, functions could not fail early on permanent errors eg. parsing a url. Merged error enums.
2021-02-16 14:57:10 +11:00
rishflab
a0ef1f96ec Replace bitcoind wallet with bdk wallet
The bitcoind wallet required the user to run a bitcoind node. It was replaced with a bdk wallet which allows the user to connect to an electrum instance hosted remotely. An electrum and bitcoind testcontainer were created to the test the bdk wallet. The electrum container reads the blockdata from the bitcoind testcontainer through a shared volume. bitcoind-harness was removed as bitcoind initialisation code was moved into test_utils. The bdk wallet differs from the bitcoind wallet in that it needs to be manually synced with an electrum node. We synchronise the wallet once upon initialisation to prevent a potentially long running blocking task from interrupting protocol execution. The electrum HTTP API was used to get the latest block height and the transaction block height as this functionality was not present in the bdk wallet API or it required the bdk wallet to be re-synced to get an up to date value.
2021-02-16 14:04:52 +11:00
bors[bot]
4d8e801c1e
Merge #190
190: Do not pass Monero amount to the CLI r=D4nte a=D4nte

The CLI user only pass the Bitcoin amount they want to sell.

The CLI then do a quote request to nectar which provides the Monero amount the taker can get.

Co-authored-by: Franck Royer <franck@coblox.tech>
2021-02-15 22:56:50 +00:00
bors[bot]
5d215caf35
Merge #188
188: Tor cleanup r=da-kami a=da-kami

We never removed Tor install from CI. I don't think it should be necessary given that Tor was removed in code.

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-02-15 06:29:24 +00:00
bors[bot]
946483d880
Merge #192
192: Remove unnecessary async block r=D4nte a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
2021-02-15 05:24:00 +00:00
Franck Royer
f36f5acaf1
Remove unnecessary async block 2021-02-15 16:23:21 +11:00
Franck Royer
73c52ffb61
Remove unused structs 2021-02-15 16:20:34 +11:00
Franck Royer
2dbd43e2c0
Only pass btc amount to CLI
The CLI requests a quote to nectar to know how much xmr it can get.
Also align terminology with the sequence diagram.
2021-02-15 16:20:34 +11:00
Franck Royer
144da75270
Remove redundant data 2021-02-15 16:20:34 +11:00
Franck Royer
fb3b2aa546
Remove unnecessary pub qualifier 2021-02-15 16:20:34 +11:00
Franck Royer
b4e2e11dde
Remove unnecessary fields 2021-02-15 16:20:34 +11:00
Franck Royer
d6effb7d39
Remove unnecessary pub qualifiers 2021-02-15 16:20:34 +11:00
Franck Royer
b8a84aa34b
Avoid possible mix up between timelocks
Introduce new type to ensure no mix up happens when ordering the fields
in function calls.
2021-02-15 16:20:31 +11:00
Franck Royer
9a321a4f09
Move transaction types in dedicated modules
To allow the related timelock to be defined with the
transaction that uses it. This will allow the access to the
timelock's struct inner field with defining `From` impl.
2021-02-15 16:10:40 +11:00
bors[bot]
6e6c207715
Merge #191
191: Use Remote handle to access ongoing swaps on Alice r=rishflab a=D4nte

This helps stabilizing the test as sometimes we were checking Alice state (in the DB) too early.

Co-authored-by: Franck Royer <franck@coblox.tech>
2021-02-15 04:18:24 +00:00
Franck Royer
65e0e5b731
Use Remote handle to access ongoing swaps on Alice 2021-02-15 15:00:47 +11:00
bors[bot]
a0753e24dc
Merge #189
189: The first message is more of a quote request than a swap request r=D4nte a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
2021-02-15 00:24:39 +00:00
bors[bot]
4314006b2a
Merge #184
184: Make `config` argument global r=D4nte a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
2021-02-15 00:02:36 +00:00
Franck Royer
5d78556665
Give a more specific name to the CLI binary: swap-cli
The current binary name is very generic `cli`. `swap-cli` better
describes what this binary does.
2021-02-15 11:01:50 +11:00
Franck Royer
8fada42074
Make config argument global
The `config` argument apply to all commands. It is now optional and
needs to be passed before a command.
E.g. `cli --config ./config.toml history`
2021-02-15 11:01:50 +11:00
Franck Royer
83dcf4ba3c
Add nectar binary 2021-02-15 11:01:47 +11:00
Daniel Karzel
c166232daf Remove unnecessary mention of Tor in comment 2021-02-15 10:12:08 +11:00
Daniel Karzel
e353d0e89b Remove tor installation from CI 2021-02-15 10:11:41 +11:00
Franck Royer
9ded728879
The first message is actually a quote or rate request 2021-02-12 17:05:06 +11:00
bors[bot]
c117885dad
Merge #183
183: Introduce binary for nectar r=D4nte a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
2021-02-11 22:19:38 +00:00
Franck Royer
ee43125bdd
Add nectar binary 2021-02-11 15:24:38 +11:00
bors[bot]
66d9c7c2cb
Merge #182
182: Segregate CLI specific modules r=D4nte a=D4nte

To prepare for the introduction of nectar modules.

Co-authored-by: Franck Royer <franck@coblox.tech>
2021-02-11 04:08:55 +00:00
Franck Royer
fac5b59d17
Remove unnecessary specification of the types 2021-02-11 10:34:44 +11:00
Franck Royer
7805a6d684
Move cli specific modules under cli folder
nectar will also have its own folder with a separate config.
2021-02-11 10:34:44 +11:00
Franck Royer
901c9e89c9
No evident added value of having separate Seed structs
Hence, reducing complexity of the codebase. Note that the seed will be
used by both nectar and the cli whereas the config mod will be different
so this changes helps with the next step of having a dedicated config
module for each binary.
2021-02-11 09:57:17 +11:00
Franck Royer
7d392c3086
This files contains Command and Arguments structs 2021-02-11 09:47:42 +11:00
Franck Royer
45dccb8be2
Rename the config struct Config 2021-02-11 09:38:29 +11:00
bors[bot]
fadbf1638a
Merge #177
177: Nectar r=D4nte a=D4nte

Re-work Alice do be the Service Provider (nectar).
This means that Alice's event loop runs all the time and processes swap requests.

- We currently use a hardcoded fixed rate
- The binary for nectar is to be done in follow-up PR
- We removed the message acknowledgement feature as it created issues with other work and some work would have been needed to link a ack to the correct swap on Alice side.
- Because we removed the acks, we had to remove a number of restart tests. This can be re-introduced at a later stage once a decision on how to best test the restarts can be done
- We remove the punish test as it is a nectar (alice) feature and current focus is on the CLI (bob).

Co-authored-by: Franck Royer <franck@coblox.tech>
2021-02-10 05:43:34 +00:00
Franck Royer
eb39add5ff
Fix typo 2021-02-10 16:42:55 +11:00
Franck Royer
6e6dc320b4
Alice event loop now handles the creation of new swaps 2021-02-10 16:42:55 +11:00