Commit Graph

487 Commits (418aa021912fc8c2bb0467b9ad6d97b501091111)

Author SHA1 Message Date
Thomas Eizinger 418aa02191
Remove unnecessary ed25519-dalek dependency 4 years ago
bors[bot] 61a8282be1
Merge #203
203: Introduce dynamic rates r=da-kami a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Daniel Karzel b4ceee49df Change monitoring to default wallet
The automated swap backend (asb) requires Monero funds, because Alice is selling Monero.
We use a hardcoded default wallet named asb-wallet. This wallet is opened upon startup.
If the default wallet does not exist it will be created.
4 years ago
Daniel Karzel 9496dce917 Skip heartbeat messages 4 years ago
Thomas Eizinger a8bfc1d686 Make LatestRate::Error require std::error::Error trait bound
This allows us to use .context instead of .map_err when calling
`latest_rate()`. For the static rate module, we simply fill in
`Infallible` which is actually better suited because it describes
that we are never using this error.
4 years ago
Thomas Eizinger b47b06aa23 Import anyhow::Result across the codebase
There is no need to fully qualify this type because it is a type
alias for std::Result. We can mix and match the two as we want.
4 years ago
Franck Royer 519d1a5701 Log rate and amounts for Alice when doing execution setup 4 years ago
Franck Royer b20c16df78 Improving logging on failure 4 years ago
Franck Royer 644f4c1732 Bubble up ws error to consumer
Note that because we are using `watch` channel, only a reference to the
channel value can be returned.
Hence, using custom Error that can be cloned to be able to
pass `Result` through the channel.
4 years ago
Franck Royer 92b3df4158 Introduce dynamic rates 4 years ago
bors[bot] 0359f8fbc0
Merge #216
216: To avoid CI failure wait for the balance instead of sleep r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
bors[bot] a6724f29af
Merge #214
214: Rename nectar to asb (automated swap backend) r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Daniel Karzel bdb35c310d To avoid CI failure wait for the balance instead of sleep 4 years ago
bors[bot] 81228c9d5b
Merge #209
209: Upgrade to bdk 0.4 r=thomaseizinger a=thomaseizinger

Effectively, this also means:

- Upgrading to rust-bitcoin 0.26
- Upgrading to miniscript 5
- Upgrading monero to 0.10
- Upgrading curve25519-dalek to 3
- Upgrading bitcoin-harness to rust-bitcoin 0.26 (https://github.com/coblox/bitcoin-harness-rs/pull/21)
- Upgrade `ecdsa_fun` to latest version
- Replace `cross_curve_dleq` with `sigma_fun` (to avoid an upgrade dance on that library)

I refrained from specifying `rev`s in the Cargo.toml because we have a lock-file anyway. This should allow us to update those dependencies easier in the future by just running `cargo update -p <dependency>`.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
4 years ago
Daniel Karzel fe3d6f1fef Rename nectar to asb (automated swap backend) 4 years ago
Daniel Karzel 164de3c524 Properly calculate the confirmations for Bitcoin tx
Once the transaction was included into a block it has one confirmation - before inclusion it has zero.
current-block-height - transaction-block-height = zero; but that means one confirmation.
Hence, the confirmation calculation was adapted to: Current-block-height - (transaction-block-height - 1).
4 years ago
Thomas Eizinger 2d8ede80e1
Use released version of backoff 4 years ago
Thomas Eizinger cabf0efb8c
Only construct proof system once
The proof system is a static element and can be reused several times.
4 years ago
Thomas Eizinger 84bc2c82b7
Upgrade to bdk 4.0
To achieve this we also:

- upgrade rust-bitcoin to 0.26
- upgrade bitcoin-harness to latest version (which also depends bitcoin 0.26)
- upgrade to latest edcsa-fun
- replace cross_curve_dleq proof with sigma_fun (to avoid an upgrade dance over there)
4 years ago
bors[bot] b3f49cf83e
Merge #200
200: Wait for refund if insufficient Monero is locked up r=da-kami a=da-kami

In a scenario where Alice does not lock up sufficient funds Bob should properly transition to refunds. At the moment the CLI just panics. 
I noticed this when Alice accidentally had a different amount set than Bob. In the future this should not happen, because Alice provides the amount for Bob. However, in case Alice is malicious Bob should still transition correctly. 

Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
bors[bot] 8537b88a68
Merge #201
201: Fix ASB - Prevent the future from being stopped in production r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
bors[bot] 48635156ad
Merge #206
206: Remove misplaced wallet sync call r=rishflab a=rishflab

These bdk wallet sync calls must of gotten lost during a rebase. Removed the call in build TxLock and added one when nectar starts up

Co-authored-by: rishflab <rishflab@hotmail.com>
4 years ago
Daniel Karzel babd1d7b60
Wait for refund if insufficient Monero is locked up 4 years ago
Daniel Karzel ebb869e6f4 Distinguish transient and permanent Electrum errors 4 years ago
Daniel Karzel 9b93cabfdf Use context instead of map_error 4 years ago
rishflab fe362d765b Add sync wallet on nectar's startup 4 years ago
rishflab 00e2b257c4 Remove misplaced sync wallet call 4 years ago
Thomas Eizinger 8c83f7e2e1
Upgrade to testcontainers v0.12 4 years ago
Daniel Karzel 2ced9ddba4 Prevent future from being stopped by calling forget on handle 4 years ago
Daniel Karzel 77ec7e502f Distinguish permanent and transient error when watching tx 4 years ago
rishflab b66bb00c77 Remove stale code 4 years ago
rishflab bc1d2bda54 Test URL creation for default electrum HTTP API 4 years ago
rishflab d296c22ecf Log bitcoin deposit address on startup 4 years ago
rishflab 4768c79070 Derive bitcoin private key from seed 4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
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>
4 years ago
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>
4 years ago
Franck Royer f36f5acaf1
Remove unnecessary async block 4 years ago
Franck Royer 73c52ffb61
Remove unused structs 4 years ago
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.
4 years ago
Franck Royer 144da75270
Remove redundant data 4 years ago
Franck Royer fb3b2aa546
Remove unnecessary pub qualifier 4 years ago
Franck Royer b4e2e11dde
Remove unnecessary fields 4 years ago
Franck Royer d6effb7d39
Remove unnecessary pub qualifiers 4 years ago
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.
4 years ago
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.
4 years ago
Franck Royer 65e0e5b731
Use Remote handle to access ongoing swaps on Alice 4 years ago
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>
4 years ago