Commit Graph

2708 Commits

Author SHA1 Message Date
pokkst
c9f379a108 Move check to outside of select, in case Alice redeems the BTC and we saw that before we get confirmation that she received the encrypted signature. 2024-06-04 00:14:54 +02:00
pokkst
9f09bd759c Add safety checks
(cherry picked from commit 1bd9b6abdca6bb1fbb60835cae58c5c5caad2683)
2024-06-04 00:14:47 +02:00
pokkst
65a9c1680e Add edge case bugfix for our databse not updating correctly when Alice redeems her BTC 2024-06-04 00:13:07 +02:00
dependabot[bot]
1930540c1f
build(deps): bump reqwest from 0.11.27 to 0.12.4 (#1588)
* build(deps): bump reqwest from 0.11.27 to 0.12.0

Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.27 to 0.12.0.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.27...v0.12.0)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* wip

* wip

* ci: lock sqlx-cli install

* bump reqwest to 0.12.2

* deps: reqwest to 0.12.4

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Byron Hambly <byron@hambly.dev>
2024-05-30 10:27:48 +02:00
COMIT Botty McBotface
2932abc9ec
Prepare release 0.13.0 (#1659) 2024-05-29 16:00:17 +02:00
binarybaron
41687ffab9
CI: Fix faulty x86-darwin release name (#1658) 2024-05-29 11:58:28 +02:00
Byron Hambly
6c487d4a5f
Merge pull request #1654 from comit-network/dependabot/cargo/serde-1.0.203
build(deps): bump serde from 1.0.202 to 1.0.203
2024-05-28 12:57:11 +02:00
Byron Hambly
21e6bbe681
Merge pull request #1656 from delta1/ci-binaries
ci: wip fixing binaries
2024-05-28 12:39:32 +02:00
Byron Hambly
e09401b9f7
ci: wip fixing build binaries actions 2024-05-28 12:37:55 +02:00
Byron Hambly
81d1f7e1bb
Merge pull request #1655 from delta1/ci-binaries
ci: wip fixing build binaries actions
2024-05-28 12:23:41 +02:00
Byron Hambly
66bc59892a
ci: wip fixing build binaries actions 2024-05-28 12:21:19 +02:00
dependabot[bot]
6399343de9
build(deps): bump serde from 1.0.202 to 1.0.203
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.202 to 1.0.203.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.202...v1.0.203)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-27 11:29:09 +00:00
Byron Hambly
7b9ca3b420
Merge pull request #1653 from delta1/deps-miniscript
deps: bump miniscript 9.0.0 to 9.0.2 to fix overflow issue
2024-05-27 13:04:17 +02:00
Byron Hambly
268a24083f
deps: bump miniscript 9.0.0 to 9.0.2 to fix overflow issue 2024-05-27 12:57:32 +02:00
Byron Hambly
1d4a536bb1
Merge pull request #1652 from delta1/ci-release-bins
ci: fix build-release-binaries
2024-05-27 12:20:23 +02:00
Byron Hambly
52d56ae254
ci: fix build-release-binaries 2024-05-27 12:19:26 +02:00
Byron Hambly
2ef2863e89
Merge pull request #1651 from delta1/ci-release-bins
ci: fix build-release-binaries
2024-05-27 12:04:47 +02:00
Byron Hambly
bbf8f84312
ci: fix build-release-binaries 2024-05-27 12:04:04 +02:00
Byron Hambly
a471a17a88
Merge pull request #1648 from delta1/ci-fix-stable
ci: fix duplicate definition of check_stable
2024-05-27 11:38:09 +02:00
Byron Hambly
e6d37c01a6
ci: fix duplicate definition of check_stable 2024-05-27 11:06:10 +02:00
Byron Hambly
796863359f
upgrade secp256kfun (#1466)
* ci: add cargo check on rust stable

* refactor: upgrade secp256kfun and fix resulting issues

* build(deps): update sigma_fun and ecdsa_fun to a52142cf7f

 #1520
 #1521

* chore: fix clippy issue

* update to 91112f80b24

* bump to 294de1721add

* chore(deps): remove spectral

spectral fails to compile on rust stable 1.76 due to dep on deprecated
rustc-serialize

* secp256kfun: update to 7da9d277 and set rev in manifest

* update to 6fdc5d8

* switch to crates.io versions of ecdsa_fun and sigma_fun

* ci: update toolchain to 1.74 and fix draft action

* clippy fixes

---------

Co-authored-by: binarybaron <86064887+binarybaron@users.noreply.github.com>
2024-05-27 11:03:20 +02:00
Byron Hambly
1e2dddb61b
Merge pull request #1629 from comit-network/dependabot/cargo/toml-0.8.13
build(deps): bump toml from 0.8.12 to 0.8.13
2024-05-27 10:09:28 +02:00
Byron Hambly
dc8e1e53f2
Merge pull request #1647 from comit-network/monero-wallet-rpc-update-01831
CLI: Upgrade monero-wallet-rpc to 0.18.3.1, clarify a few log. messages
2024-05-27 09:42:06 +02:00
binarybaron
32ca0b1a4a CLI: Upgrade monero-wallet-rpc to 0.18.3.1, clarify a few log. messages 2024-05-25 18:22:17 +02:00
binarybaron
c433bd2389
CLI: Initiate tracing earlier to avoid lost logs (#1646) 2024-05-25 17:59:12 +02:00
binarybaron
0ca98cd0b7
Make tracing file appender blocking (#1643) 2024-05-25 14:43:22 +02:00
binarybaron
2f28ef9401
Add missing changelog entries (#1641) 2024-05-24 18:06:21 +02:00
binarybaron
0c4b7d50c2
Lower DEFAULT_BITCOIN_CONFIRMATION_TARGET to 1 to ensure timely confirmation of bitcoin transactions (#1640) 2024-05-24 18:02:29 +02:00
Byron Hambly
838a7ab5fb
Merge pull request #1637 from comit-network/dependabot/github_actions/actions/checkout-4.1.6
build(deps): bump actions/checkout from 4.1.1 to 4.1.6
2024-05-23 13:54:11 +02:00
Byron Hambly
db78a1e99e
Merge pull request #1636 from comit-network/dependabot/github_actions/Swatinem/rust-cache-2.7.3
build(deps): bump Swatinem/rust-cache from 2.7.1 to 2.7.3
2024-05-23 13:54:00 +02:00
dependabot[bot]
b443a96469
build(deps): bump actions/checkout from 4.1.1 to 4.1.6
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.1...v4.1.6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-23 11:10:29 +00:00
dependabot[bot]
97210739a1
build(deps): bump Swatinem/rust-cache from 2.7.1 to 2.7.3
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.1 to 2.7.3.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.1...v2.7.3)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-23 11:10:26 +00:00
yamabiiko
5ff46be279
RPC server for API Interface (#1276)
* saving: implementing internal api shared by cli and rpc server

* writing async rpc methods and using arc for shared struct references

* cleaning up, renamed Init to Context

* saving: cleaning up and initial work for tests

* Respond with bitcoin withdraw txid

* Print RPC server address

* Cleanup, formatting, add `get_seller`, `get_swap_start_date` RPC endpoints

* fixing tests in cli module

* uncommenting and fixing more tests

* split api module and propagate errors with rpc server

* moving methods to api and validating addresses for rpc

* add broadcast channel to handle shutdowns gracefully and prepare for RPC server test

* added files

* Update rpc.rs

* adding new unfinished RPC tests

* updating rpc-server tests

* fixing warnings

* fixing formatting and cargo clippy warnings

* fix missing import in test

* fix: add data_dir to config to make config command work

* set server listen address manually and return file locations in JSON on Config

* Add called api method and swap_id to tracing for context, reduced boilerplate

* Pass server_address properly to RpcServer

* Update Cargo.lock

* dprint fmt

* Add cancel_refund RPC endpoint

* Combine Cmd and Params

* Disallow concurrent swaps

* Use RwLock instead of Mutex to allow for parallel reads and add get_current_swap endpoint

* Return wallet descriptor to RPC API caller

* Append all cli logs to single log file

After careful consideration, I've concluded that it's not practical/possible to ensure that the previous behaviour (one log file per swap) is preserved due to limitations of the tracing-subscriber crate and a big in the built in JSON formatter

* Add get_swap_expired_timelock timelock, other small refactoring

- Add get_swap_expired_timelock endpoint to return expired timelock if one exists. Fails if bitcoin lock tx has not yet published or if swap is already finished.
- Rename current_epoch to expired_timelock to enforce consistent method names
- Add blocks left until current expired timelock expires (next timelock expires) to ExpiredTimelock struct
- Change .expect() to .unwrap() in rpc server method register because those will only fail if we register the same method twice which will never happen

* initiating swaps in a separate task and handling shutdown signals with broadcast queues

* Replace get_swap_start_date, get_seller, get_expired_timelock with one get_swap_info rpc method

* WIP: Struct for concurrent swaps manager

* Ensure correct tracing spans

* Add note regarding Request, Method structs

* Update request.rs

* Add tracing span attribute log_reference_id to logs caused by rpc call

* Sync bitcoin wallet before initial max_giveable call

* use Span::current() to pass down to tracing span to spawned tasks

* Remove unused shutdown channel

* Add `get_monero_recovery_info` RPC endpoint

- Add `get_monero_recovery_info` RPC endpoint
- format PrivateViewKey using Display

* Rename `Method::RawHistory` to `Method::GetRawStates`

* Wait for swap to be suspended after sending signal

* Remove notes

* Add tracing span attribute log_reference_id to logs caused by rpc call

* Sync bitcoin wallet before initial max_giveable call

* use Span::current() to pass down to tracing span to spawned tasks

* Remove unused shutdown channel

* Add `get_monero_recovery_info` RPC endpoint

- Add `get_monero_recovery_info` RPC endpoint
- format PrivateViewKey using Display

* Rename `Method::RawHistory` to `Method::GetRawStates`

* Wait for swap to be suspended after sending signal

* Return additonal info on GetSwapInfo

* Update wallet.rs

* fix compile issues for tests and use serial_test crate

* fix rpc tests, only check for RPC errors and not returned values

* Rename `get_raw_history` tp `get_raw_states`

* Fix typo in rpc server stopped tracing log

* Remove unnecessary success property on suspend_current_swap response

* fixing test_cli_arguments and other tests

* WIP: RPC server integration tests

* WIP: Integration tests for RPC server

* Update rpc tests

* fix compile and warnings in tests/rpc.rs

* test: fix assert

* clippy --fix

* remove otp file

* cargo clippy fixes

* move resume swap initialization code out of spawned task

* Use `in_current_span` to pass down tracing span to spawned tasks

* moving buy_xmr initialization code out of spawned tasks

* cargo fmt

* Moving swap initialization code inside tokio select block to handle swap lock release logic

* Remove unnecessary swap suspension listener from determine_btc_to_swap call in BuyXmr

* Spawn event loop before requesting quote

* Release swap lock after receiving shutdown signal

* Remove inner tokio::select in BuyXmr and Resume

* Improve debug text for swap resume

* Return error to API caller if bid quote request fails

* Print error if one occurs during process invoked by API call

* Return bid quote to API caller

* Use type safe query! macro for database retrieval of states

* Return tx_lock_fee to API caller on GetSwapInfo call

Update request.rs

* Allow API caller to retrieve last synced bitcoin balane and avoid costly sync

* Return restore height on MoneroRecovery command to API Caller

* Include entire error cause-chain in API response

* Add span to bitcoin wallet logs

* Log event loop connection properties as tracing fields

* Wait for background tasks to complete before exiting CLI

* clippy

* specify sqlx patch version explicitly

* remove mem::forget and replace with _guard

* ci: add rpc test job

* test: wrap rpc test in #[cfg(test)]

* add missing tokio::test attribute

* fix and merge rpc tests, parse uuuid and multiaddr from serde_json value

* default Tor socks port to 9050, Cargo fmt

* Update swap/sqlite_dev_setup.sh: add version

Co-authored-by: Byron Hambly <byron@hambly.dev>

* ci: free up space on ubuntu test job

* Update swap/src/bitcoin/wallet.rs

Co-authored-by: Byron Hambly <byron@hambly.dev>

* Update swap/src/bitcoin/wallet.rs

Co-authored-by: Byron Hambly <byron@hambly.dev>

* fmt

---------

Co-authored-by: binarybaron <86064887+binarybaron@users.noreply.github.com>
Co-authored-by: Byron Hambly <byron@hambly.dev>
2024-05-22 15:12:58 +02:00
Byron Hambly
7d4a6c90f3
Merge pull request #1633 from comit-network/dependabot/cargo/anyhow-1.0.86
build(deps): bump anyhow from 1.0.83 to 1.0.86
2024-05-20 13:47:35 +02:00
Byron Hambly
2fba218429
Merge pull request #1632 from comit-network/dependabot/cargo/thiserror-1.0.61
build(deps): bump thiserror from 1.0.60 to 1.0.61
2024-05-20 13:47:21 +02:00
dependabot[bot]
928fe33532
build(deps): bump anyhow from 1.0.83 to 1.0.86
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.83 to 1.0.86.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.83...1.0.86)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 11:31:28 +00:00
dependabot[bot]
3bb6f060a0
build(deps): bump thiserror from 1.0.60 to 1.0.61
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.60 to 1.0.61.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.60...1.0.61)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 11:30:15 +00:00
icy-ux
8d8c938a94
document use of asb export-bitcoin-wallet (#1280)
* document use of asb export-bitcoin-wallet

Add to the `asb` document @delta1's text on exporting the Bitcoin wallet
descriptor and importing the descriptor into Sparrow Wallet.

TODO: maybe it would make sense to add the images to Git, instead of
linking to files on Github?

* bring asb/README.md into compliance with dprint

* update bullet point formatting in asb/README.md

* run

* add images to git

---------

Co-authored-by: icyfestive <>
Co-authored-by: Byron Hambly <byron@hambly.dev>
2024-05-20 10:28:44 +02:00
Byron Hambly
0b5a26a5e8
Merge pull request #1631 from comit-network/dependabot/cargo/itertools-0.13.0
build(deps): bump itertools from 0.12.1 to 0.13.0
2024-05-17 14:28:06 +02:00
dependabot[bot]
0e5241787f
build(deps): bump itertools from 0.12.1 to 0.13.0
Bumps [itertools](https://github.com/rust-itertools/itertools) from 0.12.1 to 0.13.0.
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.12.1...v0.13.0)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-17 11:58:52 +00:00
Byron Hambly
4b8f7987f7
Merge pull request #1630 from comit-network/dependabot/github_actions/actions/checkout-4.1.6
build(deps): bump actions/checkout from 4.1.5 to 4.1.6
2024-05-17 13:33:13 +02:00
dependabot[bot]
c8e5768955
build(deps): bump actions/checkout from 4.1.5 to 4.1.6
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.5 to 4.1.6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.5...v4.1.6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-17 11:12:37 +00:00
dependabot[bot]
6edcc28b8d
build(deps): bump toml from 0.8.12 to 0.8.13
Bumps [toml](https://github.com/toml-rs/toml) from 0.8.12 to 0.8.13.
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.12...toml-v0.8.13)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-16 11:18:16 +00:00
Byron Hambly
8cd0d3cd17
Merge pull request #1628 from comit-network/dependabot/cargo/serde-1.0.202
build(deps): bump serde from 1.0.201 to 1.0.202
2024-05-15 14:23:45 +02:00
dependabot[bot]
d9de1b6cf3
build(deps): bump serde from 1.0.201 to 1.0.202
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.201 to 1.0.202.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.201...v1.0.202)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-15 11:33:15 +00:00
Byron Hambly
0a2a32a31b
Merge pull request #1627 from comit-network/dependabot/cargo/serde-1.0.201
build(deps): bump serde from 1.0.200 to 1.0.201
2024-05-08 14:29:56 +02:00
Byron Hambly
71ea249d73
Merge pull request #1626 from comit-network/dependabot/cargo/serde_json-1.0.117
build(deps): bump serde_json from 1.0.116 to 1.0.117
2024-05-08 14:29:48 +02:00
dependabot[bot]
081bb965ee
build(deps): bump serde from 1.0.200 to 1.0.201
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.200 to 1.0.201.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.200...v1.0.201)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-08 11:59:51 +00:00
dependabot[bot]
f1d7859334
build(deps): bump serde_json from 1.0.116 to 1.0.117
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.116 to 1.0.117.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.116...v1.0.117)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-08 11:58:50 +00:00
Byron Hambly
6acabda6ab
Merge pull request #1623 from comit-network/dependabot/github_actions/actions/checkout-4.1.5
build(deps): bump actions/checkout from 4.1.4 to 4.1.5
2024-05-07 15:28:47 +02:00