xmr-btc-swap/swap-core
наб e9e598f77f
fix(tree-wide): tests (#731)
* fix(monero-sys): -j$(nproc) instead of -j4

We already have this version of num_proc in the dep tree

* fix(monero-*): fix test building, some tests

What remains:
  $ cargo test -p monero-harness -p monero-rpc -p monero-sys -p monero-tests
  error: 7 targets failed:
      `-p monero-sys --test sign_message`
  thread 'test_sign_message' panicked at monero-sys/tests/sign_message.rs:79:5:
  assertion `left == right` failed: Signatures should be the same when using same key and address
    left: "SigV2TaTzgYm3ZKF3SfG6JFiVKQdwKDNTjGiyYLpZz8LcuwuxbJZndhyFg3M6jif3jk2f8kPE4TeQMh2EiAWXcktqt7vG"
   right: "SigV28HFN64UUAzq5STURuWR9UKTZ6s5vzEZ18NxGogswLfdrAGExwL39RupTh9aNLeZWRELKGJy99vq5KPhgNqBTWx2b"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

      `-p monero-sys --test simple`
  thread 'main' panicked at monero-sys/tests/simple.rs:64:10:
  called `Result::unwrap()` on an `Err` value: Failed to transfer funds after multiple attempts: Failed to ensure transaction has one txid and at least one tx key before publ
  ishing

  Caused by:
      Expected at least one tx key, got 0

  These all want docker:
      `-p monero-harness --test monerod`
      `-p monero-harness --test wallet`
      `-p monero-tests --test transaction_keys`
      `-p monero-tests --test transfers`
      `-p monero-tests --test transfers_wrong_key`

* fix(orchestrator): tests

* refactor(swap-core): move tests dependent on TestWalletBuilder and swap_machine to swap

swap_machine from swap-core is circular.

TestWalletBuilder doesn't exist in swap-core.

* refactor(swap-core,swap-machine): #![allow(non_snake_case)] in files that use protocol-based(?) variable names

* fix(asb): correctly validate --rpc-bind-*

The real parser is ToSocketAddrs, not just numeric

Port 0 isn't special in the parser,
we log the local address explicitly to enable it

* fix(swap): tests build and work sans exceptions, reify swap-proptest

failures:
    asb::event_loop::tests::test_make_quote_with_developer_tip
    protocol::alice::swap::tests::test_build_transfer_destinations_with_fractional_tip
    protocol::alice::swap::tests::test_build_transfer_destinations_with_small_tip
    protocol::alice::swap::tests::test_build_transfer_destinations_with_tip
    protocol::alice::swap::tests::test_build_transfer_destinations_with_zero_tip
    protocol::alice::swap::tests::test_build_transfer_destinations_without_tip
"not yet implemented: implement once unit tests compile again"

    bitcoin::wallet::swap_core_bitcoin_lock_tests::bob_can_fund_without_a_change_output
    bitcoin::wallet::swap_core_bitcoin_lock_tests::given_bob_is_sending_less_than_agreed_when_reconstructing_txlock_then_fails
    bitcoin::wallet::swap_core_bitcoin_lock_tests::given_bob_is_sending_to_a_bad_output_reconstructing_txlock_then_fails
    bitcoin::wallet::swap_core_bitcoin_lock_tests::given_bob_sends_good_psbt_when_reconstructing_then_succeeeds
    bitcoin::wallet::swap_core_bitcoin_tests::calculate_transaction_weights
    bitcoin::wallet::swap_core_bitcoin_tests::tx_early_refund_can_be_constructed_and_signed
    bitcoin::wallet::tests::funding_never_fails_with_insufficient_funds
    bitcoin::wallet::tests::given_amounts_with_change_outputs_when_signing_tx_then_output_index_0_is_ensured_for_script
"not implemented: stub method called erroneously"
mostly in ways that seem... overtly wrong?

* cleanup(swap): remove commented-out wait_for_confirmations_with() tests

Commit 2e6d324ab8 replaced the
wait_for_confirmations_with()/watch_for_transfer_with() monero-rpc
machinery with monero-sys

These tests very clearly test the specific behaviour of
wait_for_confirmations_with(), which no longer exists

Replicating these tests would be just testing libmonero

* refactor(swap): lift context out of parse_args_and_apply_defaults() match

* refactor(swap): cleave parse_args_and_apply_defaults() at _and_

* fix(swap): uncomment and update argument parsing tests

--debug is gone so so are the tests for --debug

* More cleanups and fixes

* Apply clippy
2025-11-19 18:55:45 +01:00
..
src fix(tree-wide): tests (#731) 2025-11-19 18:55:45 +01:00
Cargo.toml refactor: swap-core / swap-machine (#530) 2025-10-10 16:29:00 +02:00