Commit Graph

873 Commits (bc176bc4fbdee9ec4b5b904cecadb8dfa5284a9d)
 

Author SHA1 Message Date
Thomas Eizinger bc176bc4fb
Minor import optimizations 3 years ago
Thomas Eizinger 6d9b21cb47
Change `imports_granularity` to module
This reduces the overall amount of LoC that imports take up in our
codebase by almost 100.
It also makes merge-conflicts less likely because there is less
grouping together of imports that may lead to layout changes which
in turn can cause merge conflicts.
3 years ago
Thomas Eizinger 2c8200621d
Move `pub use` into pub use block 3 years ago
Thomas Eizinger 45b5e29d40
Don't format tokio-tar 3 years ago
bors[bot] d1363d130c
Merge #265
265: Replace quote with spot-price protocol r=thomaseizinger a=thomaseizinger

This is essentially functionally equivalent but includes some
cleanups by removing a layer of abstraction: `spot_price::Behaviour`
is now just a type-alias for a request-response behaviour.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
bors[bot] 18980f4b8a
Merge #269
269: Monero address validity check r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
3 years ago
Daniel Karzel 7504c6ceee Context for monero address parsing errors
Most of the errors are not user friendly, thus added context to tell the user the given address is incorrect.
3 years ago
Daniel Karzel 35d0e246d8 Monero address network check
Add a network check to ensure the given monero address is on the configured network.
3 years ago
bors[bot] cba9f119b6
Merge #261
261: Sweep xmr funds from generated temp wallet r=da-kami a=da-kami

Fixes #252

Please review by commit :)
Did a few cleanups before actually doing the feature.

Please note the comment that influenced this solution: https://github.com/comit-network/xmr-btc-swap/issues/252#issuecomment-789387074



Co-authored-by: Daniel Karzel <daniel@comit.network>
3 years ago
Daniel Karzel 2e3c2d8edf Remove Arcs in favour of references 3 years ago
Daniel Karzel 0b4c0758bb Turbofish syntax
This way, we are co-locating the type with the expression that requires it.
This makes it easier to take this expression and compose it with other ones
without having to touch the type hint on the variable.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
Daniel Karzel 5d807e9647 Reorder: Move utility functionality to bottom 3 years ago
Daniel Karzel 862c29f1a8 Reorder: Move sweep_all after transfer 3 years ago
Daniel Karzel 5a43b3453e Reorder: Move create after open 3 years ago
Daniel Karzel b17e6cbd94 Reorder: Move open to top 3 years ago
Daniel Karzel d63790c2a6 Remove unnecessary monero wallet trait abstractions 3 years ago
Daniel Karzel 1041212a60 Work in review comments 3 years ago
Daniel Karzel 66c8401c95 Sweep all from generated wallet to user wallet
The default implementation for the command was removed because it does not
add additional value if we have a mandatory parameter anyway.
3 years ago
Thomas Eizinger 7042ed9441
Replace quote with spot-price protocol
This is essentially functionally equivalent but includes some
cleanups by removing a layer of abstraction: `spot_price::Behaviour`
is now just a type-alias for a request-response behaviour.
3 years ago
bors[bot] cca9808b8e
Merge #257
257: Allow ASB to be configured with max BTC buy amount r=thomaseizinger a=thomaseizinger

This will make it easier to also configure the CLI to display an appropriate max amount the user has to deal with.

This is the first step in working towards https://github.com/comit-network/xmr-btc-swap/issues/255.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
Daniel Karzel 5111a12706 Wallet name constants for the e2e test setup
Container initialization and wallet initialization have to ensure to use the same wallet name.
In order to avoid problems constants are introduced to ensure we use the same wallet name.
3 years ago
Daniel Karzel 2bb1c1e177 No prefix for wallets in monero harness
Prefixing docker-containers and -networks is a necessity to be able to spin up multiple containers and networks.
However, there is no reason to prefix the wallet names that live inside a container. One cannot add a wallet with
the same name twice, so the prefixing of wallets does not bring any advantage. When re-opening a wallet by name
the wallet name prefix is cumbersome and was thus removed.
3 years ago
Daniel Karzel 9f53dab3c6 Harmonize names to make more sense
The wallet is an instance of a wallet that has a name.
When we use `CreateWalletForOutputThenReloadWallet` we actually unload the wallet.
It would be cleaner to create a new instance that does that swap, but I did not go that far.
3 years ago
Daniel Karzel 70494fcb4f Create means creating the current wallet 3 years ago
Daniel Karzel 5b798217bc Open means opening the current wallet 3 years ago
Thomas Eizinger 2440964385
Allow ASB to be configured with max BTC buy amount
This will make it easier to also configure the CLI to display an appropriate max amount the user has to deal with.
3 years ago
bors[bot] ab4c98678c
Merge #264
264: Untangle Bob's `EventLoop` from the `Builder` r=thomaseizinger a=thomaseizinger

This is work towards #255.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
bors[bot] 2dbc177f24
Merge #263
263: Cleanup swap initialization for Alice and Bob r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
3 years ago
Thomas Eizinger ce077a3ff5
Decouple Bob's EventLoop from the builder
Instead of instantiating the `EventLoop` within the builder, we only
pass in the necessary arguments (which is the `EventLoopHandle`) to
the Builder upon `new`.

This is work towards #255 which will require us to perform network
communication (which implies having the `EventLoop`) before starting
a swap.
3 years ago
Thomas Eizinger 54bc91581f
Don't unnecessarily create async blocks
If our expression directly evaluates to a future, we don't need to
create an async block.

This requires us to have `EventLoopRun::run` consume the instance
instead of just taking a mutable reference (otherwise we run into
lifetime issues). However, that is better anyway because `run` is
an endless loop so you never get to use the handle afterwards
anyway.
3 years ago
Thomas Eizinger a4c25080b6
Merge network::Seed into crate::Seed
This allows us to unify the way we derive new secret key material
and simplify the usage of seed by only having a single one.
3 years ago
Thomas Eizinger 089ac0806e
Simplify constructor of Bob's EventLoop
We never customize the behaviour or transport. Might as well hide
those details in the implementation.
3 years ago
Daniel Karzel 1b167f3eb6 Cleanup swap initialization for Alice and Bob 3 years ago
bors[bot] a8ebd4d16e
Merge #259
259: Upgrade bitcoin wallet to use BIP84 derivation scheme r=rishflab a=rishflab

Closes #258 

Co-authored-by: rishflab <rishflab@hotmail.com>
3 years ago
rishflab a41b255dab Upgrade bitcoin wallet to use BIP84 derivation scheme
Explicitly specify the change descriptor because the behaviour when it
is not specified is unclear.
3 years ago
bors[bot] 3f12c6f58a
Merge #256
256: Give GitHub some time to process the deletion of the release  r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
Thomas Eizinger 75cec57e9d
Give GitHub some time to process the deletion of the release
If we immediately chain the two actions, `create-release` only creates
a draft for some reason.
3 years ago
bors[bot] 31475ab07d
Merge #253
253: Monero rpc installer for windows r=rishflab a=rishflab

I could not find an async zip archive extractor. The download is still async. One potential follow up could be to spawn the extraction of the zip in the windows path.

Closes #228 

Co-authored-by: rishflab <rishflab@hotmail.com>
3 years ago
rishflab e9b56934e8 Add windows to release and build workflow 3 years ago
rishflab bcdde021eb Add windows support to monero rpc installer 3 years ago
rishflab 27df9128be Bail if monero wallet rpc is not found in downloaded archive
Previously we were ignoring if the monero wallet rpc was not found and
unpacked from archive leading to a failure down the line when trying to
run a non-existent executable. Bail when the executable is no found in
the archive.
3 years ago
bors[bot] 17278d1278
Merge #248
248: Wait for wallet to catch up instead of block generation r=thomaseizinger a=da-kami

The monero harness wallet always starts a miner that mines new blocks every second.
This can conflict with additionally triggering block generation  and cause this error:

```
monero_rpc::rpc::monerod: generate blocks response: {
  "error": {
    "code": -7,
    "message": "Block not accepted"
  },
  "id": "1",
  "jsonrpc": "2.0"
}
```

See error in CI run here: https://github.com/comit-network/xmr-btc-swap/runs/2001131193

Since the miner is generating blocks anyway we can wait for the wallet to catch up.
Refresh is done upon querying the balance, thus the refresh calls were removed.

---

Note: we could also opt for starting the miner optionally. This would make this test more efficient, but is a more intrusive change, thus I opted for this fix for now. 

Co-authored-by: Daniel Karzel <daniel@comit.network>
3 years ago
bors[bot] 8bc918c511
Merge #243
243: Some cleanup + improve logging of the `swap_cli` r=thomaseizinger a=thomaseizinger

Please see commit messages for details. I've also included a few minor cleanups that I noticed on the way.



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
Daniel Karzel 31c23a24ac use tokio::time::sleep instead of std:🧵:sleep 3 years ago
bors[bot] b6bcdbfbf8
Merge #254
254: Smoke test the binary in the release workflow + create 'latest' release r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
Thomas Eizinger 3ad9516188
Reduce logging when signing transactions
1. We can generalize the signing interface by passing a PSBT in
instead of the `TxLock` transaction.
2. Knowing the transaction ID of a transaction that we are about
to sign is not very useful. Instead, it is much more useful to know
what failed. Hence we add a `.context` to the call of `sign_and_finalize`.
3. In case the signing succeeds, we will immediately broadcast it
afterwards. The new broadcasting interface will tell us that we broadcasted
the "lock" transaction.
3 years ago
Thomas Eizinger 8c9b087e39
Unify logging of broadcasted transactions
We eliminate unnecessary layers of indirection for broadcasting logic
and force our callers to provide us with the `kind` of transaction
that we are publishing.

Eventually, we can replace this string with some type-system magic
we can derive the name from the actual transaction. For now, we just
require the caller to duplicate this information because it is faster
and good enough TM.
3 years ago
Thomas Eizinger 3a503bf95f
Shorten function name
This struct is a wallet. The only thing it can meaningfully broadcast
are transactions. The fact that they have to be signed for that is
implied. You cannot broadcast unsigned transactions.
3 years ago
Thomas Eizinger 45cff81ea5
Remove traits in favor of using the wallet struct directly
Abstracting over the individual bits of functionality of the wallet
does have its place, especially if one wants to keep a separation
of an abstract protocol library that other people can use with their
own wallets.

However, at the moment, the traits only cause unnecessary friction.
We can always add such abstraction layers again once we need them.
3 years ago
Thomas Eizinger 73bbec1bc0
Create a 'latest' release on pushes to master
Fixes #241.
3 years ago