2020-09-28 02:18:50 -04:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
2021-03-23 20:30:51 -04:00
|
|
|
pull_request: # Need to run on pull-requests, otherwise PRs from forks don't run
|
2020-09-28 02:18:50 -04:00
|
|
|
push:
|
|
|
|
branches:
|
2022-04-04 06:49:02 -04:00
|
|
|
- "master" # Always build head of master for the badge in the README
|
2020-09-28 02:18:50 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
static_analysis:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-05-17 07:12:37 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
2020-09-28 02:18:50 -04:00
|
|
|
|
2023-03-15 08:12:28 -04:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
2024-05-27 05:03:20 -04:00
|
|
|
toolchain: "1.74"
|
2023-03-15 08:12:28 -04:00
|
|
|
components: clippy,rustfmt
|
|
|
|
|
2024-01-15 06:38:18 -05:00
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
2020-09-28 02:18:50 -04:00
|
|
|
|
2021-04-29 03:32:42 -04:00
|
|
|
- name: Check formatting
|
2023-01-25 06:01:45 -05:00
|
|
|
uses: dprint/check@v2.2
|
2023-07-31 04:32:15 -04:00
|
|
|
with:
|
|
|
|
dprint-version: 0.39.1
|
2021-03-23 19:40:02 -04:00
|
|
|
|
2020-10-27 20:18:14 -04:00
|
|
|
- name: Run clippy with default features
|
2020-10-27 01:02:32 -04:00
|
|
|
run: cargo clippy --workspace --all-targets -- -D warnings
|
|
|
|
|
2021-02-14 18:11:41 -05:00
|
|
|
- name: Run clippy with all features enabled
|
2020-09-28 02:18:50 -04:00
|
|
|
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
|
|
|
2022-11-22 08:39:42 -05:00
|
|
|
bdk_test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-05-17 07:12:37 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
2022-11-22 08:39:42 -05:00
|
|
|
|
2024-01-15 06:38:18 -05:00
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
2022-11-22 08:39:42 -05:00
|
|
|
|
|
|
|
- name: Build swap
|
|
|
|
run: cargo build --bin swap
|
|
|
|
|
|
|
|
- name: Run BDK regression script
|
|
|
|
run: ./swap/tests/bdk.sh
|
|
|
|
|
2022-11-30 06:39:20 -05:00
|
|
|
sqlx_test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-05-17 07:12:37 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
2022-11-30 06:39:20 -05:00
|
|
|
|
2024-01-15 06:38:18 -05:00
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
2022-11-30 06:39:20 -05:00
|
|
|
|
|
|
|
- name: Install sqlx-cli
|
2024-03-26 03:08:38 -04:00
|
|
|
run: cargo install --locked --version 0.6.3 sqlx-cli
|
2022-11-30 06:39:20 -05:00
|
|
|
|
|
|
|
- name: Run sqlite_dev_setup.sh script
|
|
|
|
run: |
|
|
|
|
cd swap
|
|
|
|
./sqlite_dev_setup.sh
|
|
|
|
|
2021-02-16 22:46:12 -05:00
|
|
|
build:
|
2020-11-09 23:50:25 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
|
|
|
os: ubuntu-latest
|
2021-03-14 22:40:03 -04:00
|
|
|
- target: armv7-unknown-linux-gnueabihf
|
|
|
|
os: ubuntu-latest
|
2020-11-09 23:50:25 -05:00
|
|
|
- target: x86_64-apple-darwin
|
2024-04-30 04:17:15 -04:00
|
|
|
os: macos-12
|
|
|
|
- target: aarch64-apple-darwin
|
2020-11-09 23:50:25 -05:00
|
|
|
os: macos-latest
|
2021-03-01 19:12:01 -05:00
|
|
|
- target: x86_64-pc-windows-msvc
|
|
|
|
os: windows-latest
|
2020-11-09 23:50:25 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-09-28 02:18:50 -04:00
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-05-17 07:12:37 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
2020-09-28 02:18:50 -04:00
|
|
|
|
2024-01-15 06:38:18 -05:00
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
2020-09-28 02:18:50 -04:00
|
|
|
|
2023-01-10 07:43:07 -05:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
2022-11-18 07:58:58 -05:00
|
|
|
with:
|
2024-05-27 05:03:20 -04:00
|
|
|
toolchain: "1.74"
|
2022-12-27 12:27:59 -05:00
|
|
|
targets: armv7-unknown-linux-gnueabihf
|
2021-03-11 19:25:30 -05:00
|
|
|
|
2020-11-09 23:50:25 -05:00
|
|
|
- name: Build binary
|
2022-11-18 07:58:58 -05:00
|
|
|
if: matrix.target != 'armv7-unknown-linux-gnueabihf'
|
2022-12-27 12:27:59 -05:00
|
|
|
run: cargo build -p swap --target ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Install cross (armv7)
|
|
|
|
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
|
|
|
|
run: cargo install cross --locked
|
2022-11-18 07:58:58 -05:00
|
|
|
|
|
|
|
- name: Build binary (armv7)
|
|
|
|
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
|
2022-12-27 12:27:59 -05:00
|
|
|
run: cross build -p swap --target ${{ matrix.target }}
|
2020-11-09 23:50:25 -05:00
|
|
|
|
2021-03-05 00:14:21 -05:00
|
|
|
- name: Upload swap binary
|
2023-12-15 06:14:29 -05:00
|
|
|
uses: actions/upload-artifact@v4
|
2020-11-09 23:50:25 -05:00
|
|
|
with:
|
|
|
|
name: swap-${{ matrix.target }}
|
2021-03-05 00:14:21 -05:00
|
|
|
path: target/${{ matrix.target }}/debug/swap
|
2021-01-27 23:40:47 -05:00
|
|
|
|
2021-02-21 18:24:11 -05:00
|
|
|
- name: Upload asb binary
|
2023-12-15 06:14:29 -05:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-02-16 22:42:15 -05:00
|
|
|
with:
|
2021-02-21 18:24:11 -05:00
|
|
|
name: asb-${{ matrix.target }}
|
|
|
|
path: target/${{ matrix.target }}/debug/asb
|
2021-02-16 22:42:15 -05:00
|
|
|
|
2021-02-16 22:46:12 -05:00
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-04-04 06:49:02 -04:00
|
|
|
os: [ubuntu-latest, macos-latest]
|
2021-02-16 22:46:12 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
2024-02-14 15:22:35 -05:00
|
|
|
- name: (Free disk space on Ubuntu)
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
|
|
|
|
with:
|
|
|
|
# removing all of these takes ~10 mins, so just do as needed
|
|
|
|
android: true
|
|
|
|
dotnet: true
|
|
|
|
haskell: true
|
|
|
|
docker-images: false
|
|
|
|
large-packages: false
|
|
|
|
swap-storage: false
|
|
|
|
tool-cache: false
|
|
|
|
|
2021-02-16 22:46:12 -05:00
|
|
|
- name: Checkout sources
|
2024-05-17 07:12:37 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
2021-02-16 22:46:12 -05:00
|
|
|
|
2024-01-15 06:38:18 -05:00
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
2021-02-16 22:46:12 -05:00
|
|
|
|
|
|
|
- name: Build tests
|
|
|
|
run: cargo build --tests --workspace --all-features
|
|
|
|
|
|
|
|
- name: Run monero-harness tests
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: cargo test --package monero-harness --all-features
|
|
|
|
|
|
|
|
- name: Run library tests for swap
|
|
|
|
run: cargo test --package swap --lib --all-features
|
|
|
|
|
2021-01-27 23:40:47 -05:00
|
|
|
docker_tests:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-04-04 06:49:02 -04:00
|
|
|
test_name:
|
|
|
|
[
|
2021-01-27 23:40:47 -05:00
|
|
|
happy_path,
|
2021-03-22 01:28:59 -04:00
|
|
|
happy_path_restart_bob_after_xmr_locked,
|
|
|
|
happy_path_restart_bob_before_xmr_locked,
|
2021-03-26 00:38:30 -04:00
|
|
|
happy_path_restart_alice_after_xmr_locked,
|
2021-04-27 00:51:53 -04:00
|
|
|
alice_and_bob_refund_using_cancel_and_refund_command,
|
2023-01-04 04:23:24 -05:00
|
|
|
alice_and_bob_refund_using_cancel_then_refund_command,
|
2021-04-27 00:51:53 -04:00
|
|
|
alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired,
|
2021-03-26 00:38:30 -04:00
|
|
|
punish,
|
2021-04-28 02:13:04 -04:00
|
|
|
alice_punishes_after_restart_bob_dead,
|
|
|
|
alice_manually_punishes_after_bob_dead,
|
2021-04-08 04:56:26 -04:00
|
|
|
alice_refunds_after_restart_bob_refunded,
|
|
|
|
ensure_same_swap_id,
|
2021-04-28 02:13:04 -04:00
|
|
|
concurrent_bobs_before_xmr_lock_proof_sent,
|
2022-04-04 06:49:02 -04:00
|
|
|
alice_manually_redeems_after_enc_sig_learned,
|
|
|
|
]
|
2021-01-27 23:40:47 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-05-17 07:12:37 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
2021-01-27 23:40:47 -05:00
|
|
|
|
2024-01-15 06:38:18 -05:00
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
2021-01-27 23:40:47 -05:00
|
|
|
|
|
|
|
- name: Run test ${{ matrix.test_name }}
|
2021-04-19 23:03:59 -04:00
|
|
|
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} -- --nocapture
|
2024-04-10 03:53:32 -04:00
|
|
|
|
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 09:12:58 -04:00
|
|
|
rpc_tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-05-23 07:10:29 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
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 09:12:58 -04:00
|
|
|
|
2024-05-23 07:10:26 -04:00
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
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 09:12:58 -04:00
|
|
|
|
|
|
|
- name: Run RPC server tests
|
|
|
|
run: cargo test --package swap --all-features --test rpc -- --nocapture
|
|
|
|
|
2024-04-10 03:53:32 -04:00
|
|
|
check_stable:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-05-17 07:12:37 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
2024-04-10 03:53:32 -04:00
|
|
|
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
|
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
|
|
|
|
|
|
|
- name: Run cargo check on stable rust
|
|
|
|
run: cargo check --all-targets
|