Commit Graph

750 Commits (03078f328c49bc801fe6ffba263a1edbd2bdfbce)
 

Author SHA1 Message Date
Thomas Eizinger 03078f328c
Split monero-harness into harness and rpc
This allows us to move `monero-harness` and `bitcoin-harness` into
`[dev-dependencies]` of `swap`.
3 years ago
Thomas Eizinger 2a3db9bd80
Remove unnecessary derivative dependency 3 years ago
Thomas Eizinger f0ba80794c
Remove unnecessary serde_derive dependency declaration
We already express the same thing through the serde `derive` feature.
3 years ago
Thomas Eizinger d54fac6fd9
Remove unnecessary tempfile prod dependency 3 years ago
Thomas Eizinger 729f4f09a8
Remove unnecessary tracing_core dependency 3 years ago
Thomas Eizinger 418aa02191
Remove unnecessary ed25519-dalek dependency 3 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>
3 years ago
bors[bot] 12c67bee3d
Merge #210
210: Change monitoring to default wallet r=da-kami a=da-kami

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.

Additionally there is a check for the balance - if the balance is zero an address is printed for depositing funds.

Co-authored-by: Daniel Karzel <daniel@comit.network>
3 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.
3 years ago
Daniel Karzel 9496dce917 Skip heartbeat messages 3 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.
3 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.
3 years ago
Franck Royer 519d1a5701 Log rate and amounts for Alice when doing execution setup 3 years ago
Franck Royer b20c16df78 Improving logging on failure 3 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.
3 years ago
Franck Royer 92b3df4158 Introduce dynamic rates 3 years ago
bors[bot] b9b8d2ce1a
Merge #215
215: Debug log level in monero harness tests to see RPC responses r=da-kami a=da-kami

CI keeps failing when generating blocks, but response is only printed on debug level.
To investigate what is the problem change monero-harness log levels to debug.

Example failure:

https://github.com/comit-network/xmr-btc-swap/runs/1938109584

The failure happened when generating blocks, but without seeing the response error it is impossible to know what happened. Could not reproduce this problem locally. 

Co-authored-by: Daniel Karzel <daniel@comit.network>
3 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>
3 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>
3 years ago
Daniel Karzel bdb35c310d To avoid CI failure wait for the balance instead of sleep 3 years ago
Daniel Karzel 7e25c4ad4f Debug log level in monero harness tests to see RPC responses
CI keeps failing when generating blocks, but response is only printed on debug level.
To investigate what is the problem change monero-harness log levels to debug.
3 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>
3 years ago
bors[bot] c4df3fdcbc
Merge #213
213: Properly calculate the confirmations for Bitcoin tx r=da-kami a=da-kami

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).

I could not think of a more elegant solution - if you have one please comment :)

Co-authored-by: Daniel Karzel <daniel@comit.network>
3 years ago
Daniel Karzel fe3d6f1fef Rename nectar to asb (automated swap backend) 3 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).
3 years ago
Thomas Eizinger 2d8ede80e1
Use released version of backoff 3 years ago
Thomas Eizinger cabf0efb8c
Only construct proof system once
The proof system is a static element and can be reused several times.
3 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)
3 years ago
bors[bot] 374c2d4372
Merge #205
205: Optimize GitHub workflow file r=thomaseizinger a=thomaseizinger

See commit messages for further details.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
Thomas Eizinger fb45ff66eb
Update rust-toolchain to new toml syntax
This allows us to completely skip the "Install Rust" step in CI
because the rust-toolchain file completely describes what we need.
The first invocation of cargo will simply install all the required
components.

Additionally, we make all caches dependant on the version of Rust
that we require.
3 years ago
Thomas Eizinger 8072f4d7ee
Only install tomlfmt if we don't have ~/.cargo/bin cached 3 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>
3 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>
3 years ago
Thomas Eizinger a3b5c13b52
Upgrade to actions/cache@v2.1.4
Usually, we can follow the rolling major tag (@v2) of actions.
However the recent release (2.1.4) is not yet included. See
https://github.com/actions/cache/issues/528 for more details.

We do want to depend on 2.1.4 because it contains a fix that allows
us to use the cache action MacOS. v2 also features better compression
and allows for multiple paths to be specified.
3 years ago
Thomas Eizinger f1b097877b
Split `build_test` into `build` and `test`
Building binaries and building tests results in different artifacts
inside the `target` directory. If we use distinct caches for these
commands, the caches are more useful because less code has to be
re-built.
3 years ago
Thomas Eizinger e57c005920
Remove unused matrix entry 3 years ago
Thomas Eizinger acbc0f5551
Upload nectar binary in addition to swap_cli 3 years ago
Thomas Eizinger 3c7880f771
Fix path to CLI for artifact upload
The name was recently changed but the workflow wasn't adapted.
3 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>
3 years ago
bors[bot] bd00abe070
Merge #204
204: Upgrade to testcontainers v0.12 r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
Daniel Karzel babd1d7b60
Wait for refund if insufficient Monero is locked up 3 years ago
Daniel Karzel ebb869e6f4 Distinguish transient and permanent Electrum errors 3 years ago
Daniel Karzel 9b93cabfdf Use context instead of map_error 3 years ago
rishflab fe362d765b Add sync wallet on nectar's startup 3 years ago
rishflab 00e2b257c4 Remove misplaced sync wallet call 3 years ago
Thomas Eizinger 8c83f7e2e1
Upgrade to testcontainers v0.12 3 years ago
Daniel Karzel 2ced9ddba4 Prevent future from being stopped by calling forget on handle 3 years ago
Daniel Karzel 77ec7e502f Distinguish permanent and transient error when watching tx 3 years ago
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>
3 years ago
rishflab b66bb00c77 Remove stale code 3 years ago