Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release] 1.0.0-beta #1576

Merged
merged 288 commits into from
Mar 6, 2023
Merged

[release] 1.0.0-beta #1576

merged 288 commits into from
Mar 6, 2023

Conversation

artemii235
Copy link
Member

@artemii235 artemii235 commented Dec 15, 2022

release v1.0.0-beta change-log:

Features:

  • [WIP] Lightning integration #1045
    • rust-lightning was updated to v0.0.110 in #1452
    • Inbound channels details was added to SQL channels history in #1339
    • Blocking was fixed for sync rust-lightning functions that calls other I/O functions or that has mutexes that can be held for some time in #1452
    • Default fees are retrieved from rpc instead of config when starting lightning #1452
    • 0 confirmations channels feature was added in #1452
    • An update_channel RPC was added that updates a channel that is open without closing it in #1452
    • Lightning RPCs now use the lightning:: namespace in #1497
    • TakerFee and MakerPayment swap messages were modified to include payment instructions for the other side, in the case of lightning this payment instructions is a lightning invoice #1497
    • MakerPaymentInstructionsReceived/TakerPaymentInstructionsReceived events are added to MakerSwapEvent/TakerSwapEvent in #1497, for more info Lightning integration #1045 (comment)
    • Lightning swaps were implemented in #1497, #1557
    • Lightning swap refunds were implemented in #1592
    • MakerPaymentRefundStarted, TakerPaymentRefundStarted, MakerPaymentRefundFinished, TakerPaymentRefundFinished events were added to swap error events in #1592, for more info Lightning integration #1045 (comment)
    • Enabling lightning now uses the task manager #1513
    • Disabling lightning coin or calling stop RPC now drops the BackgroundProcessor which persists the latest network graph and scorer to disk #1513, #1490
    • avg_blocktime from platform/utxo coin is used for l2/lightning estimating of the number of blocks swap payments are locked for #1606
  • Implemented get_current_mtp RPC [r2r] get_current_mtp rpc impl #1340
  • Custom enum from stringify derive macro to derive From implementations for enums [r2r] enum from variant derive macro #1502
  • Validate that input_tx is calling 'receiverSpend' in eth::extract_secret [r2r] validate input_tx is calling 'receiverSpend' in extract_secret #1596
  • Implement SPV with minimal storage requirements and fast block headers sync time [r2r] spv storage optimization #1 #1585
  • Implement block headers storage for IndexedDB and re-enable SPV in WASM [r2r] Implement block headers storage for IndexedDB and re-enable spv in wasm #1644
  • Validate all Swap parameters at the Negotiation stage [r2r] validate swap parameters #1475
    under review stage as r2r([r2r] cosmos ibc transfer implementation #1636):
    • ibc_withdraw, ibc_chains, ibc_transfer_channels rpc implementations
    • created new crate mm2_git(git functionality without 3rd party dependencies)
    • implemented fetching & deserializing cosmos/chain-registry repository using mm2_git
    • added slurp_url_with_headers function for native and wasm mode
    • implemented tests for integrated features
    • defined IBC commons in rust types and proto files in order to deserialize it in txs
  • ARRR integration #927:
    • Zcoin native mode support was added #1438
    • multi lightwalletd servers support was added #1472
    • Allow passing Zcash params file path to activation request #1538
    • Checksum verification of Zcash params files was added #1549
  • NFT integration #900
    • under review stage as [r2r] NFT proof of concept implementation #1652
    • gui-auth & enable_v2 rpc implementation 6631a20
  • tendermint htlc implementation 5e2dd3d
  • tendermint swap support(p.o.c level) 4de3cf2
  • created safe number type castings 535d6cb
  • complete tendermint support for swaps and tx history implementation 15ff4c5
  • Implement TX history V2 for UTXO coins activated with a Hardware wallet: 36392fd
  • Improve stop functionality 4a93790
  • Implement Global HD account activation mode a05819d
  • Login with a MetaMask wallet 7ea1436
  • Add max_maker_vol RPC 7201146
  • Add task::get_new_address::* RPCs 6b4ec0f

Enhancements/Fixes:

NB - Backwards compatibility breaking changes:

  • Because of #1548, old nodes will not be able to swap BTC segwit with new nodes since locktimes are exchanged and validated in the negotiation messages.

sergeyboyko0791 and others added 30 commits October 17, 2022 15:05
* Wrap lightning futures into `AbortOnDropHandle`

* Refactor `common::executor` by moving to a separate module

* Add `AbortableSpawner` that has `spawn` and `spawn_critical`

* Spawn TX history with `CoinFutureSpawner::spawn`

* Add `MmCoin::spawn`

* Spawn electrum client with `CoinFutureSpawner`

* Add `SpawnSettings`

* Use `CoinFutureSpawner` within `UtxoArcBuilder`

* Refactor `AbortableSpawner`

* Store abort handles by associated `FutureId` not to keep them forever
* Remove `wio::Timeout`

* Optimize `SpawnedFutured` by replacing HashMap with Vec

* Continue integrating `MmSpawner`

* Refactor `ws_transport` to avoid unnecessary `spawn` calls

* Integrate `FutureSpawner` into RPC task manager

* Add `FutureSpawner` trait to `executor`

* Make `spawn` and `spawn_local` unsafe

* Kick-start swaps by spawning them as futures, not as threads
* Remove `common::executor::spawn_boxed`
* Delete `common/executor.rs` file

* Make sure `AbortableSpawner` can't be cloned

* Leave Spawn traits in `spawner.rs` only
* Add `AbortableSpawnerWeak`
* Rename `CoinFutureSpawner` to `CoinFutSpawner`
* Rename `MmSpawner` to `MmFutSpawner`

* Remove `SWARM_RUNTIME` from `mm2_libp2p`

* `spawn_gossipsub` takes an `SwarmRuntime` instance to spawn futures

* Don't use `MmArc::on_stop`

* Add `SwapWatcherLock`
* Remove `SwapsContext::shutdown_rx`

* Don't use `MmArc::on_stop` when `spawn_gossipsub`

* Remove `spawn_abortable_with_settings`

* Refactor `AbortableSpawner` to `AbortableSystem`

* Allow to create an abortable subsystem that will be aborted if the linked supersystem is aborted.

* Spawn `check_balance_update_loop` future via `AbortableSimpleMap` subsystem

* Ignore unstable tests

* Add `test_mm2_stops_immediately` WASM test

* Fix `test_mm2_stops_immediately` by removing `QRC20` coin from test

* Run `test_mm2_stops_impl` twice

* Minor changes and fixes

* Refactor `ElectrumClient` not to use `spawn` function

* Add `AbortableQueue` field into `ElectrumClientImpl`, `ElectrumConnection`
* Pass a spawner to `ws_transport`
* Remove `wasm_ws::ClosingState` by replacing it with `ClosedState`

* Make `spawn` and `spawn_local` safe

* Increase `WASM_BINDGEN_TEST_TIMEOUT` to 180 seconds
* Avoid unnecessary `spawn` usage

* Minor changes

* Avoid using `allow(dead_code)`
* Add `spawn_local_abortable` to `wasm_executor`
* Avoid unnecessary `spawn_local` usage at `webusb_driver`

* Add `GracefulShutdownRegistry` and use it for hyper server

* Fix BCH, SLP tests

* Rename `QueueInner::remove_finished` to `on_finished`

* Remove `MmCtx::stop_listeners`, `MmCtx::on_stop`

* Spawn `save_channel_closing_details` with a critical timeout
* limited block headers to 2016 in mm2

* Testing — implemented get_block_headers_in_chunks

* added BLOCK_HEADERS_MAX_CHUNK_SIZE

* minor fix!

* retry fetching block headers if network error

* get headers in chunks if too large error

* changed sleep timer to 1 sec

* simplified header retrieval in chunks

* cargo clippy fix

* removed get_block_headers_in_chunks fn

* refactoring

* added is_response_too_large method UtxoRpcError

* PR review fixes and added is_network_error fn

* Pr review fixes — code optimizations

* fix is_network_error

* cargo clippy

* minor changes

* cargo fmt

* retry block header fetching before permanent error

* fetch_blocker_headers_attempts >= 1

* minor fix
* WIP rough implementation

* WIP orderbook_rpc

* WIP orderbook_rpc_v2

* WIP tests

* WIP CoinActivationResult

* WIP

* WIP add target_arch for protocol matching

* WIP check_point_block added

* WIP fix a typo

* WIP

* WIP valid check_point_block for zombie

* notes added

* fix is_mine_zhtlc

* remove mutex

* wip add_pubkey

* added my_p2p_pubkeys for wasm

* added remove_pubkey function

* r2r

* use one is_mine func

* little fix

* remove unnecessary code

* little fix

* add check_point_block 290_000 for test

* is_my_order remove pub

* move my_p2p_pubkeys in Orderbook

* remove my_p2p_pubkeys.insert from orders_kick_start
* save development state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev state

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* save dev state

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* IBC asset boilerplate. IRIS + USDC single RPC activation test WIP.

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev  state

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* WIP. Activation in progress.

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev state

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* save todo notes

Signed-off-by: ozkanonur <work@onurozkan.dev>

* IRIS + USDC activation done. Always set MsgCreateHtlc::timestamp to 0.
Pass secret hash directly.

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Add sleep to wait_for_taker_payment_spend to test.

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Display correct address for Tendermint related orders.

* save dev state

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* save dev state (integration test now passes)

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Add test that finds HTLC claim tx by HLTC id and extracts secret successfully.

* calculate amount

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Implement wait_for_tx_spend with test.

* implement `fn extract_secret`

Signed-off-by: ozkanonur <work@onurozkan.dev>

* fix clippy errors

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Fixed WASM compilation.

* Enable WASM tests on iris-swap-poc temporarily.

* handle errors/panics

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Added SecretHashAlgo and made SHA256 default temporarily.

* Lock sequence_lock in swap payments methods. NIMDA/RICK swap fails.
Temporarily remove is_tx_not_found_error check.

* Swap with UTXO works, but having issues with sequence on concurrent txs sending.

* WIP. Swaps fail.

* Refactor IBC -> TENDERMINTTOKEN. Make USDC and NIMDA TENDERMINTTOKEN in tests.

* Fix tests compilation.

* Pass secret hash as argument to HTLC spending methods.

* Temporarily return error from TendermintToken::withdraw (not implemented).

* Fix compilation.

* Additional logs in tests.

* implement `enable_tendermint_token` endpoint

Signed-off-by: ozkanonur <work@onurozkan.dev>

* WIP. Adding ETH swaps support with sha256 secret hash.

* implement `tendermint_token::withdraw` and write unit test for
withdraw&token activation

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Add USDC-IBC-IRIS/tBNB to swaps test. Successful.

* support multiple rpc_urls

Signed-off-by: ozkanonur <work@onurozkan.dev>

* fix wasm test

Signed-off-by: ozkanonur <work@onurozkan.dev>

* fix `fmt` error

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* provide wasm compatibility

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Hotfix for orderbook and best orders v2 RPCs.

* [cosmos] increase tendermint fee

* increase fees

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* reduce time blocking

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Fixes after merge.

* Fix some tests.

* WIP. Iris dex fee validation. Swaps can fail!

* Fix clippy.

* WIP. Dex fee validation. Swaps work.

* save fee calculation dev state

Signed-off-by: ozkanonur <work@onurozkan.dev>

* update `fn calculate_fee`

Signed-off-by: ozkanonur <work@onurozkan.dev>

* implement dynamic fee calculation via tx simulation

Signed-off-by: ozkanonur <work@onurozkan.dev>

* implement dynamic fee calculation on tendermint token and move `uuid` to
shared dependency section

Signed-off-by: ozkanonur <work@onurozkan.dev>

* implement missing parts of fee calculation

Signed-off-by: ozkanonur <work@onurozkan.dev>

* WIP. HTLC validation.

* WIP. Queried HTLC successfully.

* WIP. Payment validation done for now. Swaps work.

* Remove some #[allow(unused_variables)]. Impl get_public_key.

* Impl get_raw_transaction.

* make gas price as configurable

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save TODO notes for avg block time that will be used for time_lock calc

Signed-off-by: ozkanonur <work@onurozkan.dev>

* save dev state of time_lock calculation

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* refactor time_lock calculation

Signed-off-by: ozkanonur <work@onurozkan.dev>

* fix wasm compilation

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Add TODO title on p.o.c implementations

Signed-off-by: ozkanonur <work@onurozkan.dev>

* implement `fn check_if_my_payment_sent`

Signed-off-by: ozkanonur <work@onurozkan.dev>

* provide wasm compatibility for `fn check_if_my_payment_sent`

Signed-off-by: ozkanonur <work@onurozkan.dev>

* provide Abci paths as constants

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* rollback wasm pipeline diff

Signed-off-by: ozkanonur <work@onurozkan.dev>

* support `memo` field for withdraws

Signed-off-by: ozkanonur <work@onurozkan.dev>

* downgrade visibility of `TX_DEFAULT_MEMO`

Signed-off-by: ozkanonur <work@onurozkan.dev>

* use `TX_DEFAULT_MEMO` if memo is None for withdraws

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Fix few minor notes.

* use constants for ABCI request defaults

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* fix some review notes

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* fix some reivew notes

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* update `tendermint_token::check_if_my_payment_sent`

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* fix some PR notes

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* Stop ignoring some tests.

* create `MIN_TX_SATOSHIS` for tendermint

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* Fix some error mappings to avoid using empty ticker.

* Implement new trait methods after other PRs merge.

* refactor `fn check_if_my_payment_sent`

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* fix lint error

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* return `None` if can't find htlc in `fn check_if_my_payment_sent`

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* add fixes and optimizations

Signed-off-by: ozkanonur <work@onurozkan.dev>

* fix some  notes

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* return error instead of `None` on error code

Signed-off-by: ozkanonur <work@onurozkan.dev>

* fix fmt

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* Fixes after merge.

* fix compilation error for tests

Signed-off-by: ozkanonur <work@onurozkan.dev>

* update condition comment

Signed-off-by: ozkanonur <work@onurozkan.dev>

* Fix extremely long-running eth_tests.

* Fix tendermint_coin_tests::validate_payment_test.

* Fix more tests.

Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: Onur Özkan <work@onurozkan.dev>
Co-authored-by: Artem Vitae <ortgma@gmail.com>
Co-authored-by: Artem Vitae <artem@vitae.com>
Co-authored-by: Anton TonyL Lysakov <tlysakov@gmail.com>
Co-authored-by: Artem Vitae <email@not.set>
* add initial swap watcher node functionality

* broadcast watcher message immediately after taker payment is sent

* rename the WatcherData struct to TakerSwapWatcherData

* use separate SwapWatcherMsg for watchers

* make taker send the entire spending transaction to watcher nodes

* broadcast watcher message periodically in wait_for_taker_payment_spend

* check if transaction outputs is empty in p2sh_spending_tx

* fix minor details

* move utxo coin generation methods to docker_tests_common

* use Mm2TestConf for watcher node tests

* prevent running multiple watcher threads for the same swap

* remove async from spawn_taker_swap_watcher

* check if htlc spend fee is greater than the transaction output

* add empty line at the end of docker_tests_common

* discard prev_transaction mutability after modification

* check if transaction outputs is empty in utxo_common functions

* use the drop_mutability macro

* move all watcher related code to the swap_watcher module

* improve the taker_swap_watchers usage

* remove unused types and structs

* check if the transaction script has instructions

* check if the transaction has any inputs

* fix minor stuff

* make watchers validate taker payment at most once

* release taker_swap_watchers lock after inserting the uuid to the set

* fix the error type in instruction iterator

* reorder taker_swap_watchers lock/release structure

* use separate files for large json test strings

* remove watcher arguments from test helper functions

* propagate watcher messages whether the node is watcher or not

* remove swap lock related code from the swap_watcher

* remove running_swaps related code from swap_watcher

* check if a watcher with the same uuid exists before spawning a thread

* fix minor problems

* remove AtomicSwap implementation from swap_watcher

* make taker trigger a WatcherMessageSent event only if it is actually sent

* remove an unnecessary line

* log error if watcher message could not be sent

* improve mutex usage for the taker_swap_watchers

* fix formatting

* add state machines, watcher refund and ValidatePaymentError

* use DuplicateCache for taker_swap_watchers

* remove println statements

* make the watchers wait for half the locktime before spending the maker payment

* make the watchers wait for the taker before refunding

* add refund transaction confirmation for watchers

* check at watchers if the taker payment is already spent or refunded

* validate the public keys in the watcher message

* validate taker fees at watchers

* fix state implementation return types

* fix a bug in test_watcher_node

* change the name of test_watcher_node

* fix a bug in test_validate_maker_payment_malicious

* Fix ValidatePaymentError usage

* add preimage suffix to watcher-related transaction methods

* fix error handling

* separate WatcherOps from SwapOps

* fix error match usage

* reduce bchd_grpc module visibility to pub(crate)

* fix a bug in qrc20_tests

* inline WatcherOps functions

* increase dynamic fees for watcher preimages

* fix ethereum watcher preimage fee approximation

* take back unnecessary changes

* inline SwapOps functions

* use taker fee hash for logs instead of uuid

* extend TAKER_SWAP_ENTRY_TIMEOUT to 6 hours

* remove swap_unique_data field from WatcherSearchForSwapTxSpendInput struct

* fix error handling

* remove unnecessary taker swap removal in Stopped state

* improve match usage

* use WAIT_FOR_TAKER_PAYMENT_INTERVAL const

* inline DuplicateCache remove method

* add functions for wait taker/maker payment confirmation durations

* improve error handling

* rename check_all_inputs_signed_by_pub method

* add small fixes

* fix WatcherError naming
* fix some ignored tests

* move connect_to_lightning_node to rpc_command

* move open_channel to rpc_command

* move update_channel to rpc_command

* move list channels rpcs to rpc_command

* move get_channel_details, get_claimable_balances, trusted nodes rpcs to rpc_command

* move close_channel to rpc_command

* move get_payment_details, list_payments_by_filter to rpc_command

* move send_payment to rpc_command

* move the rest of lightning RPCs to rpc_command, use lightning:: prefix for lightning methods

* edit SwapMsg MakerPayment and TakerPayment to allow sending payment instructions to the other side

* create_invoice_for_hash fn, impl other_side_instructions for LightningCoin, copy needed parts of SecretHashAlgo from iris-swap-poc branch

* check connection to nodes before generating route hints, refactors

* fix TakerFee msg to include PaymentDataMsg (lightning invoice to be paid by maker to taker) instead of TakerPayment msg

* Validate invoice received from swap messages wip

* Validate invoice on maker side if maker is lightning coin

* add optional PaymentInstructions parameter to send_maker_payment, send_taker_payment functions

* implement send_taker_payment and send_maker_payment for LightningCoin

* change tx_enum_from_bytes to return none for lightning coin

* Some refactors and rollbacks

* impl more swap methods, do a unit test swap where taker is lightning

* refactor some code by adding payment_hash_from_slice fn

* minor fixes and added more todo for next PR/s

* refactor lightning taker swap test

* more refactors, broadcast_p2p_tx_msg shouldn't work with lightning payments, better todo comments

* add preimage of swap payment to DB after the secret is revealed (claiming funds)

* wip

* Final refactors

* Review fixes: better names for some functions/structs

* Review fixes: some errors fixes, add channels::, nodes::, payments:: namespaces to the RPC methods

* Review fixes: fix some error handling issues

* more review fixes

* review fixes wip: rename SwapTxDataMsg enum variants

* review fixes wip: validate_instructions to return an error instead of None, some refactors

* Review fixes: make TransactionIdentifier::tx_hex not an Option and add is_supported_by_watchers method to SwapOps

* re-add Todo that was removed by merge
* fixed block_header_utxo_loop

* minor fix

* first attempt for spawn_block_header_utxo_loop unit test

* temp remove unit test and minor fixes

* CantGetBlockCount error

* minor fix for block_count

* minor fix

* pr review fixes

* log coin ticker alongside error messages
* Use `futures-timer` instead of custom Timer implementation

* Remove `TimedMutexGuard` as it's not used anymore

* Run `cargo test` with `--nocapture` flag on MacOS CI

* Increase timeouts at the `abortable_system` tests

* Play with the timeouts

* `Timer::sleep_ms` should take ms as u64
* Fix `Timer::sleep_ms` in WASM

* Simplify conversion from u64 to u32
* if no `gui_auth` was given, consider it as `false`

Signed-off-by: ozkanonur <work@onurozkan.dev>

* increase simulated gas to predict better values for real tx operations

Signed-off-by: Onur Özkan <work@onurozkan.dev>

Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: Onur Özkan <work@onurozkan.dev>
Signed-off-by: ozkanonur <work@onurozkan.dev>

Signed-off-by: ozkanonur <work@onurozkan.dev>
…1527)

* Implement methods used in recover_funds_of_swap for Tendermint.
Also implemented validate_address.
Add dummy error return for others to avoid occasional panics.

* Review fix.

* Ignore test_spl_transactions.

Co-authored-by: Artem Vitae <email@not.set>
* WIP. Improved smart contract negotiation. Reorganizing tests.

* Docker tests reorg WIP.

* Reorg finished. Some tests fail.

* Fix module name and clippy.

* WIP. Updated toolchain. Clippy fails.

* Fix clippy.

* Fix docker tests compilation.

* Use cargo rustc on building mobile libs.

* Fix tests.

* Fix now_ms import.

* WIP.

* WIP.

* WIP.

* WIP. Porting WASM integration tests from mm2_tests to a separate module.

* WIP. Ported test_qrc20_tx_history to wasm_tests.

* Turn off doctest for all workspace crates.

* Move structs to mm2_test_helpers.

* Add tests.

* Fix clippy.

* Fix review notes.

* Fix one more review note.

Co-authored-by: Artem Vitae <email@not.set>
* changes in bch, eth, slp, tendermint_coin, tendermint_token, test_coin, utxo_standard

* changes in qrc20, qtum, solana, solana/spl

* changes in lightning, z_coin, taker and maker swap

* qrc20_tests, utxo_tests, tendermint_coin_tests

* eth_tests

* qrc20_tests was changed

* docker_tests, maker_swap, taker_swap

* fmt fix

* fix wasm test for eth

* fix merge conflicts

* add other_pubkey and other_payment_tx, create instances in tests

* use &* with dhash160

* resolve conflicts
* use task manager to enable lightning

* Move BackgroundProcessor back into LightningCoin now that it gets dropped when the coin is deactivated

* move start_lightning to coins_activation to use LightningRpcTaskHandle to update the enabling progress

* Edit coin deactivation todos

* add one line break ¯\_(ツ)_/¯
Co-authored-by: Artem Vitae <email@not.set>
* zcash_params_path added in activation params

* remove log

* add async_blocking

* async_blocking sightly changed
* Fix a race condition in `AbortableQueue`

* Make an `AbortableSystem` unusable once `abort_all` is fired

* This allows us to avoid using `SegQueue`

* Fix PR issues

* Move `impl From<EnableSlpError> for InitTokensAsMmCoinsError` to bch_with_tokens_activation.rs
* Return `AbortedError` on `AbortableSimpleMap` operations
# Conflicts:
#	mm2src/mm2_main/tests/mm2_tests/mm2_tests_inner.rs
# Conflicts:
#	mm2src/coins/utxo/utxo_builder/utxo_coin_builder.rs
* remove unnecessary unsafe block

Signed-off-by: ozkanonur <work@onurozkan.dev>

* provide better way to cast number types

Signed-off-by: ozkanonur <work@onurozkan.dev>

* better fmt

Signed-off-by: ozkanonur <work@onurozkan.dev>

* update `impl_safe_number_type_cast` implementations

Signed-off-by: Onur Özkan <work@onurozkan.dev>

* update castings

Signed-off-by: ozkanonur <work@onurozkan.dev>

* implement conditionally depending on the arch

Signed-off-by: ozkanonur <work@onurozkan.dev>

Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: Onur Özkan <work@onurozkan.dev>
* Add `HdAccountCtx` to `CryptoCtx` as an alternative to `IguanaCtx`

* Rename `CryptoCtx::secp256k1_pubkey*` to `CryptoCtx::mm2_internal_pubkey*`

* Remove `MmCtx::secp256k1_key_pair()`

* TODO: remove `MmCtx::secp256k1_key_pair_as_option()` and ``MmCtx::secp256k1_key_pair`

* Fix some TODOs

* Add `PrivKeyBuildPolicy::GlobalHDAccount`

* Add `Secp256k1Secret` and `IguanaPrivKey` aliases, use it everywhere instead of the `[u8]` slice

* Remove `MmCtx::secp256k1_key_pair`

* Add common `InternalError`
* Add `DiscardMmResult`, `SplitMmResult` traits to `mm2_error_handle`
* Move `MmCtx::public_id()` to `CryptoCtx::mm2_internal_public_id()`

* Remove unused dependencies

* Implement `CryptoCtx::init_with_global_hd_account`

* Add `hd_account_id` conf param
* Cover swaps in tests

* Fix TODOs

* Rename `DerivationMethod::Iguana` to `DerivationMethod::SingleAddress`
* Rename `PrivKeyNotAllowed` to `PrivKeyPolicyNotAllowed`

* Cover `hd_account_id` with tests

*

* Fix fmt warnings

* Fix wasm tests

* Fix RICK-MORTY swap

* Use `NegotiationDataMsg::V3` even if maker and taker pubkeys are the same but differ from persistent pub
* Log Swap error event in WASM

* Fix TODOs

* Minor changes

* Remove `PrivKeyBuildPolicy::GlobalHDAccount`

* Rename `PrivKeyBuildPolicy::IguanaPrivKey` to `Secp256k1Secret`

* Fix PR issues

* Fix `CryptoCtx` comments
* Simplify `if` conditions for Negotiation message

* Use `is_my_order` within `request_and_fill_orderbook`

* Remove `IguanaCtx`, move `secp256k1_key_pair` to `CryptoCtx`

* Remove unnecessary methods from `GlobalHDAccountCtx`
* Rename `CryptoCtx::mm2_internal_privkey_bytes` to `mm2_internal_privkey_secret`

* Distinguish the common implementation of `CryptoCtx` initializers

* Remove `mm2_internal_key_pair` from `GlobalHDAccountCtx`

* Return PrivKeyBuildPolicy::GlobalHDAccount

* Fix ZCoin BIP32 derivation

* Allo the user to specify `32`, `44`, `49`, `84` purposes in `derivation_path`
* Rename `Bip44DerivationPath` to `StandardHDPath`

* Add `z_derivation_path` to `ZCoinProtocolInfo`

* Check if `BTC-segwit` derivation works

* Minor fix

* Rename `DiscardMmResult::discard_mm` to `DiscardMmTrace::discard_mm_trace`

* Ignore Tendermint tests

* Fix `test_withdraw_segwit`
@laruh
Copy link
Member

laruh commented Feb 21, 2023

My contributions change-log:

Features:

  • ARRR integration #927:
    • Zcoin native mode support was added #1438
    • multi lightwalletd servers support was added #1472
    • Allow passing Zcash params file path to activation request #1538
    • Checksum verification of Zcash params files was added #1549
  • NFT integration #900
    • under review stage as [r2r] NFT proof of concept implementation #1652

Enhancements/Fixes:

  • Use dev branch as a target branch for Dependabot #1424
  • Fixed Zhtlc orders is_mine bug (orders had "is_mine":false) #1489
  • Grouped SwapOps method arguments into new groups(structures) #1529
  • Handling multiple rpcs optimization #1480
    • Tendermint multiple rpcs optimization #1568
    • Multiple rpcs optimization for z_rpc and http_transport #1653

sergeyboyko0791 and others added 6 commits February 21, 2023 17:55
* fixes to SlpToken::on_disabled()

Signed-off-by: borngraced <samiodev@icloud.com>

* refactor on_disabled for Solana and Tendermint

Signed-off-by: borngraced <samiodev@icloud.com>

---------

Signed-off-by: borngraced <samiodev@icloud.com>
* Incorrect behaviour if Passphrase is enabled
* Don't create new session on each device interaction
* Fix merge conflicts
* improve rpc client rotation of tendermint

Signed-off-by: ozkanonur <work@onurozkan.dev>

* update debug logs of rpc rotation implementation

Signed-off-by: ozkanonur <work@onurozkan.dev>

* fix fmt

Signed-off-by: ozkanonur <work@onurozkan.dev>

---------

Signed-off-by: ozkanonur <work@onurozkan.dev>
…ructions

[doc] update mobile build instructions
@ca333 ca333 changed the base branch from mm2.1 to main February 23, 2023 15:17
ca333 and others added 8 commits February 23, 2023 16:18
[r2r] `disable_coin` should fail if there are tokens dependent on the platform
…en maker and taker (#1677)

* better time difference message

* add dev log, add time diff cap to msg
Bugfix pubkey keepalive overflow and "forever orders"
[r2r] Hardware Wallet enhancements
Add workflow for VirusTotal results
@ca333
Copy link

ca333 commented Feb 26, 2023

@sergeyboyko0791 plz provide your change-log input ^

@ca333 ca333 mentioned this pull request Feb 26, 2023
@onur-ozkan
Copy link
Member

onur-ozkan commented Feb 27, 2023

I have dig and compare my changes with main branch and found the following changes has been applied(as addition to #1576 (comment) changelog)

Features:

  • gui-auth & enable_v2 rpc implementation 6631a20
  • tendermint htlc implementation 5e2dd3d
  • tendermint swap support(p.o.c level) 4de3cf2
  • created safe number type castings 535d6cb
  • complete tendermint support for swaps and tx history implementation 15ff4c5

Enhancements/Fixes:

  • refactor p2p message processing flow(related with one of the security problem) 957fd85
  • Small fixes f552644, b27a9a4, 1745197
  • solana tests are disabled 0c507cc
  • some of vulnerable dependencies(tokio, libp2p) are fixed 7ad3819, 5f83b09
  • bugfix & improvement on tendermint rpc client rotation 95fc67d

Signed-off-by: ozkanonur <work@onurozkan.dev>
@sergeyboyko0791
Copy link

sergeyboyko0791 commented Feb 28, 2023

Features:

  • Implement TX history V2 for UTXO coins activated with a Hardware wallet: 36392fd
  • Improve stop functionality 4a93790
  • Implement Global HD account activation mode a05819d
  • Login with a MetaMask wallet 7ea1436
  • Add max_maker_vol RPC 7201146
  • Add task::get_new_address::* RPCs 6b4ec0f

Enhancements/Fixes:

  • Fix KMD withdraw with Trezor, add mm2_stop WASM FFI 1086720
  • Use futures_timer crate and fix unstable tests 14b145d
  • Fix Timer::sleep_ms in WASM 3618e7f
  • Fix a race condition in AbortableQueue 2c1524d
  • Spawn process_json_request so the RPC requests can be processed asynchronously 90ce38a
  • Fix task::*::cancel if the RPC task is an awaiting status 4f1190b
  • disable_coin should fail if there are tokens dependent on the platform 0f39679
  • implement a repeatable future 9f1f4e9
  • Use a shared DB for HD accounts storage 6f8d35c

ca333
ca333 previously approved these changes Mar 1, 2023
Copy link

@ca333 ca333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

secure code reviewed @ a6f9a0e

DeckerSU and others added 2 commits March 6, 2023 16:59
* update testnet node of atom

* add duplicate crates to deny.toml

* ignore RUSTSEC-2023-0018 for now

* remove added duplicates from deny.toml

---------

Signed-off-by: ozkanonur <work@onurozkan.dev>
Co-authored-by: ozkanonur <work@onurozkan.dev>
@ca333 ca333 merged commit e27396e into main Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.