mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-25 10:23:20 -05:00
13 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cf669a87d8
|
feat(wallet): Retry logic for Monero wallet (#417)
* add retries to monero-sys, also more logs * just fmt, satisfy clippy * change log msg |
||
|
|
2e6d324ab8
|
feat(monero-sys): Monero bindings (#303)
* feat(monero-sys): Initial commit. Regtest integration test. Wrapper around basic Wallet functions, depends on monero#9464 * refactor: remove unused monero-wallet crate Removed the monero-wallet crate which was not being used anywhere in the codebase, simplifying the project structure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * change order of members in Cargo.toml * fix monero submodule problem * progress * continue * fix tests * fix tests again * introduce error handling * update error message * implement Wallet::sync * add swap progress * fix import path * add check_tx_key, transfer, switch to anyhow * add more functionality * fix test -- todo: why is manager.connected() failing? * update Cargo.lock * cleanup api and tests, add wait_until_synced * show lib tracing in test * add wallet_dir to wallet manager, fix tests, start integration into swap * add main/default wallet to WalletManager * continue integration, add wait_for_confirmations * feat(ci): Install Monero build dependencies * feat(ci): extract monero build instructions into compose file, run monero-sys integration tests in ci.yml * fix compile errors and monero-sys/tests * satisfy clippy * update git CI to checkout git submodules * fix again: init submodules * fix? * fix(ci): increase max size of ccache to 10G * fix(ci): Include manual build step for Monero before running cargo * add armhf sources for apt * add armhf before running apt update * fix(monero-sys): MACOSX_DEPLOYMENT_TARGET=11.0 * remove armhf apt dpkg arch * fix BlockHeight serialization breakage * ci: make only binaries not tests * fix: let tauri ignore changes to monero-sys/monero * fix: don't implement Sync for monero-sys types, change close_wallet * move mutex into Wallet * close wallet on drop (test still failing) * pipe monero logs to tracing * do not emit c++ perf logs, add comments * get test wallet_closing to pass * fix(ci): increase swap file to allow fix issue where runners would run out of memory * fix(ci): use make -j4 release everywhere * fix: run ci on self hosted runner (more ram) * start changing to dedicated wallet threads * complete move to dedicated wallet threads also improve various minor things. tests not passing * satisfy clippy * add traces * refactor monero-harness to use monero-sys tests still fail because there is a connection is- sue between the wallet and monerod. * fix: wallet doesn't connect to monerod in harness test still failing because the miner wallet doesn't recognize its balance * make minimal progress * no progress * fix(monero-sys): Build on x_api_add_new_functions_release, which has been rebased on release and includes criticial fixes * feat(gui): Add a Introduction for new users (#287) * feat(gui): add IntroductionModal component * feat(gui): add interactivity to IntroductionModal * feat(gui): create SlideTemplate component for IntroductionModal Slides * feat(gui): add generic slides to IntroductionModal with images and content * feat(gui): add Slide with SwapStatusAlert to IntroductionModal * feat(gui): show the introduction only on the first app start * feat(gui): make external links functional * fix(gui): update github link to link to active repo * feat(gui): replace old images with new mockups and update Slide05 content * feat(gui): add CardSelectionGroup and CardSelectionOption components for improved card selection UI * feat(gui): add FiatPricePreference slide to IntroductionModal * feat(gui): save user preference regarding fiat prices I set the initial store configuration for fetching fiat prices to false to avoid any calls to coingecko without user consent * refactor(gui): remove old Slide05 component for improved codebase maintenance * fix(gui): add UnstoppableSwap logo to FiatPricePreference slide * refactor(gui): update image imports and improve slide content for introduction modal * fix(gui): introduce ExternalLink component and update Slide05 to use it for external navigation * fix(gui): replace webp images for introduction with svg mockups for improved quality * fix(gui): change order of introduction slides, to asking for fiat price preference at the end * refactor(gui): implement CardSelectionContext for managing card selection state * refactor: texts in intro modakl * fix(gui): update currency fetching SVG for improved design and clarity * feat(gui): added changelog entry for introduction --------- Co-authored-by: Binarybaron <binarybaron@protonmail.com> * feat(swap): Upgrade monero-wallet-rpc to v0.18.4.0 (#314) * Prepare release 1.0.0-rc.20 (#315) Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net> * feat(ci): Limit ci.yml to one concurrent running job per git branch (#316) * fix(ci): Set yarn network-timeout to 10 minutes to avoid spurious network failures (#317) * feat(docs): Add darkness.su rendezvous point to docs * fix(gui): Fetch alerts only once * Prepare release 1.0.0-rc.21 (#318) Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net> * upgrade(swap): Concurrent syncing, bdk upgrade, refactors (#180) * upgrade sqlx to 0.8, add bdk_wallet and bdk_electrum The new dependencies are part of the bdk upgrade and include the improved wallet code. They, too, depend on sqlite3. However, they use a newer version than we currently use via sqlx. This necessitated the sqlx upgrade. This entailed trivial changes (use Pool directly instead of pool.acquire()). We might have to fix the CI as well, I kept getting compile errors from the macro until I ran swap/sqlx_dev_setup.sh. * move old wallet code to extra module * fix fee estimation for old client * bump bitcoin crate, add new wallet constructor * remove unused old Client, move code around for better readibility * make Wallet generic over Persister (database) and move more code around for readibility * add script history, start reimplementing client methods * update some imports * cargo fmt * Add comments, fix fee estimation, address generation and status_of_script * redo state update and wallet sync * fix bitcoin address validation and more imports, use Amount everywhere * fix tx cancel, lock, punish, redeem, refund * fix bitcoin::Address de-/serialisation * fix more address validation * fix more address parsing and validation, also some more imports * cargo fmt * fix wallet initialization, start wallet migration * fail test instead of ignoring it * perform full scan on creation, load from db if it exists * add more wallet info, fix wallet initialization * fix: default to null in config * migrate from old wallet if needed * change something * fix some tests * temporarily patch bdk_wallet and bdk_electrum * fix more tests * fix missing rustls * asb: only start tor client if register_hidden_service=true in the config * fix: use p2wsh_signature_hash instead of p2wpkh_signature_hash * fix some bitcoin address parsing and fee rate parsing * dprint fmt * add bitcoin-harness to this project and update to the new bitcoin version * fix max_givible again * create electrum client separately from wallet, clean up some code * add comment * ignore .env.development * log config file path on ./asb config * feat(monero-sys): Initial commit. Regtest integration test. Wrapper around basic Wallet functions, depends on monero#9464 * Revert "feat(monero-sys): Initial commit. Regtest integration test. Wrapper around basic Wallet functions, depends on monero#9464" This reverts commit 14a5b4c348a109d2524657ffeba306422458ea44. * upgrade to rust toolchain 1.81 * Use new bdk update for code from master * fix * remove * fix: add empty .gitmodules file to fix Docker build * fix: clean up submodule references * fix: properly declare monero submodule with ignore flag * fix(wallet, bdk): only reveal new address if absolutely necessary * fix: private keys not loaded into bdk wallet * refactor: sync wallet progress log * dprint fmt * refactor: move bitcoin-harness to outside repo * refactor: remove redundant log message * Display sync progress * Remove redundant arg to swap/tests/harness/mod.rs function * fix: call rustls::crypto:💍:default_provider() * dprint fmt * refactor: remove debug code * refactor: move old bdk wallet export to own function, clear log messages * remove old migr for testnets (checksum mismatch), remove balance and stringified last revealed addresses from migration export * use revalidate_network function, remove redundant drop * Display progress of background tasks, TauriBackgroundProgressHandle struct * fix: almost satisfy clippy * fix: gen-bindings error * feat: add BackgroundRefund background type * feat: use builder pattern for constructing Bitcoin wallet * dprint ftm * sync electrum in seperate thread * do not allow user to start sync while sync is in progress * remove redundant log message * display random buffer in AlertWithLinearProgress progress * fix: use TauriContextStatusEvent.Available), dont show syncing wallet spinner if not syncing * differentiate between TestWalletBuilder and WalletBuilder * satisfy clippy * remove custom BackgroundRefund event, move into background process architecture * refactor * dprint fmt * progress: get unit tests compiling * fix: bitcoin unit tests specify const values like sync_interval * fix: get unit tests passing * make clippy happy * feat: display full sync progress, fix unit test import issues * dprint fmt * make clippy happy, use u32 for target_block and not usize * always spawn tor for asb * refactor: remove gen_background_progress_id and just use Uuid::new_v4() * refactor(hooks.ts): clarify comment on useConservativeBitcoinSyncProgress * fix typo * refactor: do not let WalletBuilder take entire env struct * dprint fmt * refactor: remove default feature from workspace patch of bdk * first try for concurrent syncing * refactor: concurrent syncing * fix(wallet.rs): Safely convert FeeRate from btc / kb to sats / kwu * feat(wallet.rs): persist published Bitcoin transactions without requiring re-scan This allows us to compute an updated Bitcoin balance without requiring a re-scan * refactor(wallet.rs): use just 5 concurrent sync requests * refactor: display snackbar error when Wallet refresh fails * fix: add missing space * dprint fmt * refactor: fancy traits for the CumulativeProgress struct, allow limiting amount of callback calls * make clippy happy * dprint fmt * refactor: clearly differntiate between SyncMutex and TokioMutex, use traits for converting to Arc<Mutex<_>>, move sync_ext into own moid * fix: skip syncing if no spks in wallet * fix: update bdk.sh to test migration from old wallet (pre 1.0.0 bdk) to new bdk * fix: increase bitcoin_lock_confirmed_timeout in RegTest env to 5 minutes * refactor: avoid usize where possible, create persistence only after full scan, transmit assumed_total for full scan to tauri, add some icons to progress displays * make clippy happy * fix(ci): change rust toolchain 1.81 * fix(cross compilation arm): use ring instead of aws-lc-rs * fmt * ignore failing rendezvous tests * fix printing_status_change_doesnt_spam_on_same_status * fix: given_bitcoin_address_network_mismatch_then_error test * ignore list_sellers_should_report_all_registered_asbs_with_a_quote test * feat: add tor icon * refactor(wallet.rs): reorder struct by abstraction level * refactor(bitcoin wallet): chunk size for syncing * fix(integration tests): decrease sync interval to 3s * fix(integration tests): parse_rpc_err method to take new bdk error, not old one * add changelog entry --------- Co-authored-by: Binarybaron <binarybaron@protonmail.com> Co-authored-by: Mohan <86064887+binarybaron@users.noreply.github.com> * amend: CHANGELOG.md * Prepare release 1.1.0-rc.1 (#325) Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net> * fix(ci): Extract gen-bindings-verbose from gen-bindings * Prepare release 1.1.0-rc.2 (#326) * amend: add comma after new package.json entry * revert: delete rc.1, rc.2 releases * Prepare release 1.1.0-rc.3 (#327) Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net> * fix: Issues with 1.1.0-rc (#328) * bump(rust): Toolchain to 1.82 * bump(tauri): Bump some Tauri peer-dependencies * fix(gui): Prefer maker with known version, bump MIN_ASB_VERSION to 1.1.0-rc.3 * amend: CHANGELOG.md * Prepare release 1.1.0 (#329) * feat: log enviroment info (#332) * Add justfile (#335) * fix(swap): Add retry logic for Bitcoin wallet sync (#333) * docs: add repo overview (#337) * Prepare release 1.1.1 (#338) Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net> * rebase * add monero-sys to swap/Cargo.toml * progress rebase * rebase * Fix integration test * Fix tests then break them again * fix monero integration test harness Integration tests were failing because the wallet/ node couldn't keep up with the amount of blocks we generated and took some time before it even reali- zed it was out of sync. That lead to unrecognized balances. Fix: we wait 0.25 seconds between each new block. This gives the wallet/node enough time to realize it's out of sync. * Fix errors - happy_path goes to btc is redeemed * fix: couldn't create walllet from keys By not using an empty password * fix happy_path: refresh wallet before sweeping * Handle missing Monero node (#348) * Allow automatic Monero node selection * amend * remove unused bridge.h file * fix(ci): Use ubuntu-latest instead of self hosted runner * fix(Dockerfile): Use rust 1.82, install apt packages required for Monero compilation * add docs * use scan_transactions instead of syncing monero wallet When redeeming the Monero we, instead of doing a full scan, simpyl import the Monero lock transaction by it's id. This avoids a full scan before redeeming and should speed up the process siginficantly. * uniform naming of monero lock_transfer_proof and migration * breaking: re-send lock transfer proof in cooperative redeem response * add retry logic to blockchain height fetching, adjust tracing output * fix merge * remove unused variables * satisfy clippy * fmt * changes * add seed export to ffi bindings * remove ccache from ci, don't manually build Monero codebase Since monero-sys is tightly integrated into the Cargo build system, the build output of the Monero codebase is stored in the same target dire- ctory as all other Rust build output and is thus cached by our existing cache solution. * really stop building Monero manually in CI * print monero-cpp logs in test * use default cargo caching action instead of rust-cache This commit introduces the default github cache action because rust-cache doesn't cache our own code, only our dependencies. * don't install ccache in ci * debug missing openssl * update changelog * ci: run on self hosted runnr * fix forward_cpp_log panic * write logs to stderr instead of stdout This enables us to `println` something and users can just `asb export-monero-wallet > wallet.txt` after which `wallet.txt` will contain just the wallet seed. * Revert "ci: run on self hosted runnr" This reverts commit 157dfa7dc5bac025a9fc0eefe996880230274928. * feat: ci run on large (expensive!!!) github runners, only run on non-draft PRs and only do this until we find a way around this * run on large windows runenrs * add asb-testnet command * add --trace to ExportMoneroWallet * ci: agressive caching (delegate to cargo instead of doing by hand) * fix: pin dtolnay/rust-toolchain to @v1 * switch to actions-rust-lang/setup-rust-toolchain@v1 * fix: dont manually call cache for cargo dirs, let this be done by actions-rust-lang/setup-rust-toolchain instead * disbale -D warnings in CI * don't refresh wallet before getting balance * ci: agressive caching to s3 * Change creation height to restore height in export-monero-wallet output * update changelog * concrete example in changelog * add docker ignore * limit monero build to just one core * dont .dockerignore the .git folder because we need it for sub directories * copy .git * dont copy .git * Dockerfile: run git submodule sync before updating * only include -mmacosx-version-min=11.0 on mac os * add retry convenience function * improve error messages in monero-sys * remove transfer proof from state6, retry redeem_xmr and refund_xmr * install libabsl-dev on ubuntu ci * fix(monero-sys): Disable BUILD_TESTS, TREZOR_DEBUG, USE_DEVICE_TREZOR, HIDAPI_FOUND, GTEST_HAS_ABSL CMake flags * alice: store transfer proof in more states, only use latest state for coop redeem * BUILD_SHARED_LIBS OFF * install libasl in docker * dont link against absl google * print multiaddr when confirming new address * dont build device_trezor, dont link hidapi and usb-1.0 * use MONERO_WALLET_CRYPTO_LIBRARY to cn * fix trezor shit * link against stub trezor impl * still include trezor in build (stub implementation) * remove DEVICE_TREZOR_READY * fmt * dont include ledger and trezor support * ci: dont fail fast * feat(monero-sys): Link boost statically * feat(monero-sys): Link OpenSSL (ssl and crypto libraries) statically * breaking: remove monero.wallet_rpc_url in asb config, take monero.daemon_url instead * fix MoneroDaemon::is_available * add test case for special paths * fix simple test (was failing because tx fee wasn't considered * add ffi sanitization test commands to justfile. todo: run these in CI * add dep on futures crate for testing * improve comments * just fmt * remove ThreadSanatizer as it doesn't work well with c++ bindings * update mem test command to use nightly cargo * fix(bob): Only warn if .expired_timelock(..) check fails in BtcLocked state * Resolve merge conflicts and add missing imports - Merged workflow configuration changes, CHANGELOG.md, tracing_util.rs, tauri_bindings.rs, network swap_setup alice.rs - Added missing imports for monero::Amount, url::Url, Duration, wallet types - Some API changes in monero wallet still need to be addressed * fix merge conflicts * dprint fmt, remove unused progress bars * link unbound statically (works on mac) * link protobuf dynamically (works on mac) * install libnghttp2-dev in linux for building, add justfile command for installing brew deps * install libevent-dev and libexpat1-dev on linux * Dockerfile: install libnghttp2-dev, libevent-dev, libexpat1-dev and build in debug mode * set CMAKE_DISABLE_FIND_PACKAGE_HIDAPI * if ci: -j1, else -j4 for monero-sys * println!("cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu"); * print full libp2p network errors * add migrate steps for wallet files to changelog * fix dockerfiel to use ubuntu24 * fix build ubuntu * fix(monero-sys): opt-level = 2 * opt-level = 0 * version: bump to 2.1.0-beta * include monero_cpp in tracing * bump version to 2.1.0-beta.2 * fmt * fix merge conflict in vscode.settings * use uint64_t instead o fu_int64_t * dynamically detect mac os brew prefix folder * fmt * add todo * remove unused coce * update docs for monero-wallet-rpc removal * Revert "dynamically detect mac os brew prefix folder" This reverts commit b55cbe3e115a3f98935815b7d37cb975c8f1a012. * update comment/test * try fix monero harness test * catch exceptions in c++ ffi calls, for some methods calls .expect() on the rust side now * force debug monero-sys mode * Reapply "dynamically detect mac os brew prefix folder" This reverts commit 0b340417525c085d213e6b6c1310410cd29dcc91. * fix tests * update synchronized() method * don't force refresh before sweep --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: einliterflasche <einliterflasche@pm.me> Co-authored-by: b-enedict <92430555+b-enedict@users.noreply.github.com> Co-authored-by: unstoppableswap-botty <binarybaron_bot@proton.me> Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net> Co-authored-by: Raphael <81313171+Einliterflasche@users.noreply.github.com> Co-authored-by: root <root@vmd145754.contaboserver.net> |
||
|
|
07f935bfbc
|
feat(protocol): Early Bitcoin refund (#344)
* feat(protocol): Early Bitcoin refund Alice can choose to let Bob refund his Bitcoin early (before TxCancel timelock expires) * feat: Let Bob check for TxEarlyRefund * fix: compile errors feat(alice): if we cannot lock Monero within 2 minutes, early refund bitcoin * satisfy clippy * fix(gui): Emit tauri event when Bitcoin is early refunded * tests progress * rename AliceStates * progress: working prototype! * add unit tests for tx_early_refund construction (tx_early_refund_can_be_constructed_and_signed, tx_early weight check) * fix compile error in swap/tests/alice_zero_xmr_early_refund.rs * only make [`tx_early_refund_sig_bob`] optional in state machine, not message machine * feat: working integration test alice_zero_xmr_early_refund.rs * fix tests * add changelog entry, add integration test with broken monero-wallet-rpc simulation * amend * amend changelog * nitpick * feat(gui): Bump MIN_ASB_VERSION to 2.0.0 * feat(bob): explicitly check for tx_early_rewfund * refactor(bob): Assume tx_early_refund will not be published if timelock has expired * add todo * refactor * refactor(swap): Differentiate between BtcRefundPublished, BtcEarlyRefundPublished, BtcEarlyRefunded and BtcRefunded * refactor: move weight of tx_early into TX_EARLY_REFUND_WEIGHT const * efactor(swap): Differentiate between BtcRefundPublished,BtcEarlyRefundPublished, BtcEarlyRefunded and BtcRefunded * small refactors * nitpciks * dprint fmt * add context to get_raw_transaction * refactor: remove duplicated code in watch_for_redeem_btc, dprint fmt * fix: parse -5 electrum transaction not found error correctly * refactor: send btc_refund_finalized flag to tauri with BtcRefunded state * remove uncessary .context * dprint dfmt * remove unused import * refactor: explicitly mark state3.expired_timelocks(...) as transient error when locking Monero * use .context instead of ok_or_else(...) * fix: in get_raw_transaction also check for "missing transaction" * add 4 different types of tauri events for different refund states * display BobStateName.BtcEarlyRefunded as done state * add global bottom to DialogContentText * fix(gui): Add missing padding in SwapDialog * proof of concept: electrum load balancer * load balancer progress * wrap Mutex<Vec<Arc<BdkElectrumClient<Client>>>> in electrum_balancer in another Arc, free locks as fast as possible * refactor * refactor(electrum balancer): use OnceCell to do lazy initilization * tests * refactor(electrum): enhance error handling with MultiError for comprehensive failure analysis This commit introduces a robust MultiError system for the Electrum balancer that collects and exposes all individual node failures, enabling better error analysis and decision making. Key improvements: - Add MultiError struct with methods for inspecting all collected errors from failed nodes - Modify electrum_balancer::call() to return MultiError instead of single Error - Enhance Client::get_tx() to properly detect transaction-not-found across multiple nodes - Add call_async_with_multi_error() method for detailed async error analysis - Improve error tracing and logging throughout the Bitcoin wallet operations - Add comprehensive test coverage for MultiError functionality and edge cases - Remove obsolete should_retry_on_error() logic in favor of MultiError inspection The MultiError type maintains backward compatibility through automatic conversion to Error while providing rich error analysis capabilities for callers that need detailed failure information. This particularly improves handling of transaction-not-found scenarios where different nodes may return different error formats. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * add changelog entry for electrum node balancing * refactors of electrum balancer * only warn if .check_for_tx_early_refund fails * clippy * remove verbose message * use AtomicUsize * final touches * log libp2p crates * merge master * display LinearProgressWithSubtitle as indeterminate if progress=100% * let broadcast return a MultiError, log all libp2p crates * nitpick * make clippy happy * log "kind" for join_all load balancer * add kind to join_all method, show warning alert if alice takes a long time to redeem Bitcoin * parse multierrors correctly * fmt --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
091ba57547
|
feat(wallet): Use mempool histogram for fee estimation (#358)
* feat(wallet): Use mempool.space as a secondary fee estimation source * fix: warn if mempool client cannot be instantiated * make clippy happy * nitpick: rename clippy_check to clippy in justfile * rename `estimate_fee_rate_from_mempool` to `estimate_fee_rate_from_histogram` for clarity * dprint fmt * make clippy happy * change teacing level back to debug! * change log levels * refactors * refactor: estimate_fee and min_relay_fee * serde camel case Co-authored-by: Byron Hambly <byron@hambly.dev> * refactors * Add comments, use Weight struct where possible * fmt, fix testrs * dont fallback to bitcoin::MAX, fail instead * make mempool space optional * fmt * refactor: use estimate_fee(...) in max_giveable(...) * refactor max_giveable(...) * refactor max_giveeable to return fee as well, remove safety margin for fee * fix compile * fmtr * fix(integration test): Use pre-calculated cancel / punish fees for assert_alice_punished * fix(integration test): Use real fees for asserts * sync wallet before transaction_fee call * split send_to_address into sweep_balance_to_address_dynamic_fee --------- Co-authored-by: Byron Hambly <byron@hambly.dev> |
||
|
|
3f4cbddf23
|
upgrade(swap): Concurrent syncing, bdk upgrade, refactors (#180)
* upgrade sqlx to 0.8, add bdk_wallet and bdk_electrum
The new dependencies are part of the bdk upgrade and
include the improved wallet code.
They, too, depend on sqlite3.
However, they use a newer version than we currently use via sqlx.
This necessitated the sqlx upgrade.
This entailed trivial changes (use Pool directly instead of pool.acquire()).
We might have to fix the CI as well, I kept getting compile
errors from the macro until I ran swap/sqlx_dev_setup.sh.
* move old wallet code to extra module
* fix fee estimation for old client
* bump bitcoin crate, add new wallet constructor
* remove unused old Client, move code around for better readibility
* make Wallet generic over Persister (database) and move more code around for readibility
* add script history, start reimplementing client methods
* update some imports
* cargo fmt
* Add comments, fix fee estimation, address generation and status_of_script
* redo state update and wallet sync
* fix bitcoin address validation and more imports, use Amount everywhere
* fix tx cancel, lock, punish, redeem, refund
* fix bitcoin::Address de-/serialisation
* fix more address validation
* fix more address parsing and validation, also some more imports
* cargo fmt
* fix wallet initialization, start wallet migration
* fail test instead of ignoring it
* perform full scan on creation, load from db if it exists
* add more wallet info, fix wallet initialization
* fix: default to null in config
* migrate from old wallet if needed
* change something
* fix some tests
* temporarily patch bdk_wallet and bdk_electrum
* fix more tests
* fix missing rustls
* asb: only start tor client if register_hidden_service=true in the config
* fix: use p2wsh_signature_hash instead of p2wpkh_signature_hash
* fix some bitcoin address parsing and fee rate parsing
* dprint fmt
* add bitcoin-harness to this project and update to the new bitcoin version
* fix max_givible again
* create electrum client separately from wallet, clean up some code
* add comment
* ignore .env.development
* log config file path on ./asb config
* feat(monero-sys): Initial commit. Regtest integration test. Wrapper around basic Wallet functions, depends on monero#9464
* Revert "feat(monero-sys): Initial commit. Regtest integration test. Wrapper around basic Wallet functions, depends on monero#9464"
This reverts commit 14a5b4c348a109d2524657ffeba306422458ea44.
* upgrade to rust toolchain 1.81
* Use new bdk update for code from master
* fix
* remove
* fix: add empty .gitmodules file to fix Docker build
* fix: clean up submodule references
* fix: properly declare monero submodule with ignore flag
* fix(wallet, bdk): only reveal new address if absolutely necessary
* fix: private keys not loaded into bdk wallet
* refactor: sync wallet progress log
* dprint fmt
* refactor: move bitcoin-harness to outside repo
* refactor: remove redundant log message
* Display sync progress
* Remove redundant arg to swap/tests/harness/mod.rs function
* fix: call rustls::crypto:💍:default_provider()
* dprint fmt
* refactor: remove debug code
* refactor: move old bdk wallet export to own function, clear log messages
* remove old migr for testnets (checksum mismatch), remove balance and stringified last revealed addresses from migration export
* use revalidate_network function, remove redundant drop
* Display progress of background tasks, TauriBackgroundProgressHandle struct
* fix: almost satisfy clippy
* fix: gen-bindings error
* feat: add BackgroundRefund background type
* feat: use builder pattern for constructing Bitcoin wallet
* dprint ftm
* sync electrum in seperate thread
* do not allow user to start sync while sync is in progress
* remove redundant log message
* display random buffer in AlertWithLinearProgress progress
* fix: use TauriContextStatusEvent.Available), dont show syncing wallet spinner if not syncing
* differentiate between TestWalletBuilder and WalletBuilder
* satisfy clippy
* remove custom BackgroundRefund event, move into background process architecture
* refactor
* dprint fmt
* progress: get unit tests compiling
* fix: bitcoin unit tests specify const values like sync_interval
* fix: get unit tests passing
* make clippy happy
* feat: display full sync progress, fix unit test import issues
* dprint fmt
* make clippy happy, use u32 for target_block and not usize
* always spawn tor for asb
* refactor: remove gen_background_progress_id and just use Uuid::new_v4()
* refactor(hooks.ts): clarify comment on useConservativeBitcoinSyncProgress
* fix typo
* refactor: do not let WalletBuilder take entire env struct
* dprint fmt
* refactor: remove default feature from workspace patch of bdk
* first try for concurrent syncing
* refactor: concurrent syncing
* fix(wallet.rs): Safely convert FeeRate from btc / kb to sats / kwu
* feat(wallet.rs): persist published Bitcoin transactions without requiring re-scan
This allows us to compute an updated Bitcoin balance without requiring a re-scan
* refactor(wallet.rs): use just 5 concurrent sync requests
* refactor: display snackbar error when Wallet refresh fails
* fix: add missing space
* dprint fmt
* refactor: fancy traits for the CumulativeProgress struct, allow limiting amount of callback calls
* make clippy happy
* dprint fmt
* refactor: clearly differntiate between SyncMutex and TokioMutex, use traits for converting to Arc<Mutex<_>>, move sync_ext into own moid
* fix: skip syncing if no spks in wallet
* fix: update bdk.sh to test migration from old wallet (pre 1.0.0 bdk) to new bdk
* fix: increase bitcoin_lock_confirmed_timeout in RegTest env to 5 minutes
* refactor: avoid usize where possible, create persistence only after full scan, transmit assumed_total for full scan to tauri, add some icons to progress displays
* make clippy happy
* fix(ci): change rust toolchain 1.81
* fix(cross compilation arm): use ring instead of aws-lc-rs
* fmt
* ignore failing rendezvous tests
* fix printing_status_change_doesnt_spam_on_same_status
* fix: given_bitcoin_address_network_mismatch_then_error test
* ignore list_sellers_should_report_all_registered_asbs_with_a_quote test
* feat: add tor icon
* refactor(wallet.rs): reorder struct by abstraction level
* refactor(bitcoin wallet): chunk size for syncing
* fix(integration tests): decrease sync interval to 3s
* fix(integration tests): parse_rpc_err method to take new bdk error, not old one
* add changelog entry
---------
Co-authored-by: Binarybaron <binarybaron@protonmail.com>
Co-authored-by: Mohan <86064887+binarybaron@users.noreply.github.com>
|
||
|
|
f1e5cdfbfe
|
fix(swap): Monero wallet thread safety (#281)
* add comment to ConfirmationListener * swap: always wrap monero::Wallet in tokio::sync::Mutex Before, monero::Wallet wrapped a Mutex<Client>, and locked the mutex on each operation. This meant releasing the lock in between operations, even though we rely on the operations being executed in order. To remedy this race condition, we wrap monero::Wallet itself in a mutex, requiring any caller to hold the lock for the duration of the operation, including any suboperations. * work on: releasing the lock while waiting for confirmations Due to the newly introduced thread safety, we are currently holding lock to the monero wallet while waiting for confirmations -- since this takes a lot of time, it starves all other tasks that do anything with the monero wallet. In this commit I start implementing a change that enables us to release the lock to the wallet while waiting for confirmations and only acquire it when necessary. This breaks with the current system of passing just a generic client which implements the MoneroWalletRpc trait (which we use to pass a dummy client for testing). This commit is the first step towards a small refactor to that system. * always pass Wallet instead of a MoneroWalletRpc client By always passing Arc<Mutex<Wallet>> instead of MoneroWalletRpc clients directly we can allow the wait_for_confirmations functions to lock the Mutex and access the client when they need to, while releasing the lock when waiting for the next tick. This stops the current starving of other tasks waiting for the lock. Since we use a dummy client for testing, this required adding a generic parameter to the Wallet. However, since we specify a default type, this doesn't actually require generic handling anywhere. * add warning comment to monero::wallet::Wallet::from_dummy * add timeout when waiting for monero lock during quote This commit adds a timeout after 60 seconds when trying to acquire the lock on the monero wallet while making a quote. Should a timout occur, we return an error. This makes sure that we get _some_ return value and that starvation is noticed. * fix lints, don't keep lock during loop body in wait_for_confirmations * always immediately drop lock in wait_for_transfer * fix clippy lints * open wallet instead of failing when we can't create from keys When we fail to create a monero wallet from keys, we will now try to open it instead. I also renamed the method to be more consistent with Wallet::open_or_create. These changes are mostly taken from #260. * improve documentation on monero::Wallet * use Wallet::open instead of Wallet::Client::open * use create_from_keys_and_sweep in bob's redeem_xmr This commit deduplicates logic by using create_from_keys_and_sweep_to in bob's redeem_xmr and also adds the create_from_keys_and_sweep_to method while making create_from_keys_and_sweep a wrapper around it. * add error context and improve logging * fix deadlock in wait_for_confirmation_with, add timout to test |
||
|
|
2633e8e6bf
|
fix(asb): Compilation error introduced in #203 (#222) | ||
|
|
d53c12d64e
|
feat(asb, cli): Listen on onion address, dial onion addresses (#203)
This pull requests - Adds rust native support for the `asb` to listen on an onion service. Previously we were depedent on a seperately running `torc` client. Instead we now use [arti](https://tpo.pages.torproject.net/core/arti/), a rust implementation of the tor protocol. - Removes the `tor.control_port` and `tor.socks5_port` property from the config of the `asb` - Adds a new `tor.register_hidden_service` boolean property to the config of the `asb` which when enabled automatically runs a hidden service at startup - Adds a new `tor.hidden_service_num_intro_points` config property to specify how many introduction points to register the onion service at - Adds support for the `cli` to dial onion addresses This is dependent on https://github.com/umgefahren/libp2p-tor/pull/24 Closes https://github.com/UnstoppableSwap/core/issues/16 |
||
|
|
6cd228fada
|
feat(swap): Use art_client to dial over Tor (#196)
- Upgrade `sqlx` to `0.8` - Use `arti_client@0.24` in combination with [`libp2p-community-tor`](https://crates.io/crates/libp2p-community-tor/0.4.1). https://github.com/umgefahren/libp2p-tor/pull/18 was required for this. - Display spinner in GUI while Tor circuits are being established - Remove unused dependencies (`once_cell`, `tauri-plugin-devtools`, `digest`, `hyper`, `itertools`, `erased_serde`) - Bundle roboto font from npm registry |
||
|
|
c027e51087
|
refactor(swap): Upgrade libp2p to 0.53.2, reliable retry mechanisms (#109)
Our libp2p version is out of date, and we need to tackle the upgrade even though it's a significant undertaking. This'll also fix some other [issues](https://github.com/UnstoppableSwap/core/issues/95). ## This PR includes the following changes: - Breaking network protocol change: The libp2p version has been upgraded to 0.53 which includes breaking network protocol changes. ASBs and CLIs will not be able to swap if one of them is on the old version. - ASB: Transfer proofs will be repeatedly sent until they are acknowledged by the other party. This fixes a bug where it'd seem to Bob as if the Alice never locked the Monero. Forcing the swap to be refunded. - CLI: Encrypted signatures will be repeatedly sent until they are acknowledged by the other party - CLI+ASB: Libp2p network errors in request-response protocols are now propagated throught the event loop channels. This allows the caller to retry if an error occurs (e.g timeout) Closes https://github.com/UnstoppableSwap/core/issues/101, https://github.com/UnstoppableSwap/core/issues/95 |
||
|
|
5bb33fe35d
|
fix(asb): Allow history command to be run while asb is running (#82)
This applies the following PRs from upstream to our fork: * fix(asb): Allow history command to be run while asb is running (#1724) * Allow history command to be executed while asb is running by opening database in read-only mode (#1722) --------- Co-authored-by: einliterflasche <einliterflasche@pm.me> Co-authored-by: Einliterflasche <81313171+Einliterflasche@users.noreply.github.com> |
||
|
|
dc3c937333 | fix(swap): Unit test compilation errors | ||
|
|
709a2820c4
|
feat: cargo project at root |
Renamed from src-xmr-btc-swap/swap/tests/harness/mod.rs (Browse further)