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

chore(release): v2.1.0-beta #2043

Merged
merged 82 commits into from
Aug 1, 2024
Merged

chore(release): v2.1.0-beta #2043

merged 82 commits into from
Aug 1, 2024

Conversation

shamardy
Copy link
Collaborator

@shamardy shamardy commented Dec 21, 2023

Features:

  • Seed Management #1939
    • Seed generation, encryption, and storage features were introduced, including a new get_mnemonic API. #2014
  • A new sign_raw_transaction rpc was added for UTXO and EVM coins, this will facilitate air-gapped wallet implementation in the future. #1930

Enhancements/Fixes:

  • Event Streaming #1901
    • Balance event streaming for Electrum clients was implemented. #2013
      • Balance events for UTXOs were introduced.
      • Electrum notification receiving bug was fixed.
    • Balance event streaming for EVM was added. #2041
    • Error events were introduced. #2041
    • Heartbeats were introduced to notify about streaming channel health. #2058
    • Balance event streaming for ARRR/Pirate was added. #2076
  • Trading Protocol Upgrade #1895
    • Important note: Seednodes update is needed to support and rebroadcast new swap protocol messages. #2015
    • WASM storage for upgraded swaps introduced. #2015
    • Migration of old swaps data was added. #2015
    • Swaps now automatically kickstart on MM2 reload. #2015
    • File lock for swaps added, preventing the same swap from starting in different processes. #2015
    • my_swap_status, my_recent_swaps V2 RPCs introduced. #2015
    • Upgraded swaps data now accessible through V1 RPCs. #2015
    • Locked amount handling for UTXO swaps implemented. #2046
    • Conditional wait for maker payment confirmation was added before signing funding tx spend preimage on taker's side. #2046
    • active_swaps V2 RPC introduced. #2046
    • Handling accept_only_from for swap messages (validation of the sender) was implemented. #2046
    • swap_uuid for swap v2 messages was added to avoid reuse of the messages generated for other swaps. #2046
    • Maker payment immediate refund path handling was implemented. #2046
  • KMD Burn #2010
    • KMD dex fee burn for upgraded swaps was added. #2046
  • Hardware Wallet #964
    • Trezor now supports SegWit for withdrawals. #1984
    • Trezor support was added for EVM coins/tokens using task manager activation methods. #1962
    • Support for unsigned Tendermint transactions using Ledger's Keplr extension was added, excluding HTLC transactions and swap operations. #2148
  • NFT integration #900
    • A new clear_nft_db RPC for NFT data management was added. This enables selective (based on a chain) or complete NFT DB data clearance. #2039
    • NFT can now be enabled using enable_eth_with_tokens or enable_nft, similar to enable_erc20. #2049
    • NFT swaps V2 POC was shown, which includes a NFT maker payment test using the dockerized Geth dev node. #2084
    • komodo-defi-proxy support for NFT feature was added. #2100
    • Additional checks were added for malicious token_uri links. #2100
    • clear_all parameter in clear_nft_db RPC is now optional (default: false). #2100
  • WASM Worker
    • Improved environment detection to ensure the correct method is used for accessing the IndexedDB factory, accommodating both window and worker contexts. #1953, #2131
    • SharedWorker support was added, allowing any worker path in event_stream_configuration with a default to event_streaming_worker.js. #2080
  • Simple Maker Bot #1065
    • Maker bot was updated to support multiple price URLs. #2027
    • testcoin was added to provider options to allow testing the maker bot using test chains assets. #2161
  • IndexedDB
    • Cursor implementation was fixed, ensuring stable iteration over items. #2028
    • Advanced cursor filtering features were added, including limit, offset, and a fix for where_ condition/option. #2066
  • Swap Stats DB
    • stats_swaps table now includes GUI and MM2 version data used for a swap. #2061
  • P2P Layer
    • Added max_concurrent_connections to MM2 config to control the maximum number of concurrent connections for Gossipsub. #2063
  • ARRR/Pirate #927
    • ARRR/Pirate wallet and Dex operations now work in browser environments / WASM. #1957, #2077
    • Syncing and activation improvements were made, including stopping sync status after main sync and refining first_sync_block handling. #2089
  • EVM Transport
    • ETH websocket transport was introduced. komodo-defi-proxy signed messages were also supported for websocket transport. #2058
  • Tendermint integration #1432
    • Nucleus chain support was introduced as an alternative HTLC backend to Iris. #2079
    • Tendermint fee calculation was fixed to use get_receiver_trade_fee in platform coin. #2106
    • Pubkey-only mode for Tendermint protocol was introduced, allowing use of any external wallet for wallet and swap operations. #2088
    • ibc_withdraw RPC was removed, and withdraw was refactored to support IBC transfers by automatically finding IBC channels. #2088
    • Transaction history handling was enhanced to support base64 encoded transaction values for Cosmos-based networks, preventing missing transactions in the history table. #2133
    • The precision of max amount handling was improved for Tendermint withdraw operations by simulating the transaction and removing the estimated fee. #2155
    • Account sequence numbers are now resolved locally, incorrect sequence numbers from cached responses are also avoided. #2164
  • HD Wallet #1838
    • Full UTXO and EVM HD wallet functionalities were implemented. #1962
  • Swap watchers #1431
    • UTXO swaps were fixed to apply events that occurred while the taker was offline, such as maker spending or watcher refunding the taker payment. #2114
  • Fees Improvements #1848
    • EIP-1559 gas fee estimator and RPCs were added for ETH, including priority fee support for withdrawals and swaps, and improved gas limit for swap transactions. #2051
    • gas_limit parameter can be used in coins config to override default gas limit values. #2137
    • Default gas_limit values now ensure that Proxied ERC20 tokens have sufficient gas. #2137
  • Rust Toolchain #1972
    • Toolchain was upgraded to Rust toolchain version 1.72 nightly (nightly-2023-06-01). #2149
    • rust-analyzer was added into the workspace toolchain. #2179
  • CI Builds
    • MacOS builds for Apple Silicon are now provided through the CI pipeline. #2163
  • Miscellaneous
    • BCH block header deserialization was fixed to match BTC's handling of KAWPOW version headers. #2099
    • Implemented root application directory .kdf under $HOME to consolidate all runtime files, enhancing user experience by following standard UNIX practices. #2102
    • Memory usage was improved a bit through preallocation optimizations. #2098
    • Swaps and orders file handling was enhanced to use .tmp files to avoid concurrent reading/writing issues. #2118
    • UTXO P2PK balance is now shown as part of the P2PKH/Legacy address balance and can be spent in withdrawals and swaps. #2053
    • wallet-only restriction was removed from max_maker_vol RPC, enabling its use for wallet-only mode assets. #2153

NB - Backwards compatibility breaking changes:

  • Renamed mm2 binaries to kdf, while providing backward-compatible copies with mm2 naming; WASM binaries use kdf naming only, which is a breaking change. #2126

dimxy and others added 4 commits December 19, 2023 22:02
This commit implements balance events for UTXOs and fixes an electrum notification receiving bug.
…Cs (#2015)

This commit does the following:
- Implements WASM storage for upgraded swaps.
- Implements old swaps data migration.
- Swaps kickstart on MM2 reload.
- Swaps file lock, preventing the same swap from starting from different processes.
- my_swap_status, my_recent_swaps V2 RPCs.
- V1 RPCs can also return upgraded swaps data.
- Adds BoolAsInt struct because boolean can be used as IndexedDb indexes.
- Implements refund states for both swap types.

*Important note:
- Seednodes should be updated to support/rebroadcast new swap protocol messages.
@shamardy shamardy added the in progress Changes will be made from the author label Dec 21, 2023
dimxy and others added 14 commits December 21, 2023 17:03
This commit adds support for witness inputs and outputs for withdraw tx to sign it with trezor device. It also adds a test tool to sign withdraw tx with witness inputs/outputs with trezor and emulator.
This commit implements balance events for ETH plus error events.
This commit does the following:
* Adds address builder pattern
* Adds `script_type` field to Address structure
* Refactors output script creation
* Replaces use of u8 addr prefixes to a strict type `NetworkAddressPrefixes`
This commit does the following:
* It introduces two new functions, erc1155_balance and erc721_owner, to the EthCoin structure. These enhancements streamline the NFT withdrawal process in the withdraw_nft RPC by directly interacting with smart contracts for validation, eliminating the need to access database information.
* It adds a new clear_nft_db RPC for NFT data management. This new method allows users to selectively clear NFT data for specified blockchain networks, or to completely wipe it across all supported chains.
This commit adds the ability to detect the current execution environment (window or worker) and follows the appropriate way of getting `web_sys::IdbFactory` instance depending on it.
Signed-off-by: onur-ozkan <work@onurozkan.dev>
…2046)

What's done:
- Locked amount handling for UTXO swaps (more work will be needed for ETH/ERC20)
- Implemented conditional wait for maker payment confirmation before signing funding tx spend preimage on taker's side.
- active_swaps V2 RPC
- Handling accept_only_from for swap messages (validation of the sender)
- Added swap_uuid for swap v2 messages to avoid reusage of the messages generated for other swaps
- Implemented maker payment immediate refund path handling
- Implemented KMD dex fee burn for upgraded swaps
- Added dockerized Geth node for ETH-related integration tests (more to be done in the next sprints)
- Fixed ETH watcher tests

Updated deps:
- test-containers (other Cargo.lock updates are triggered by it). The purpose is to rely on the official version instead of using the fork. The fork also didn't allow passing additional arguments to the image (only `docker run` options were available).
@shamardy shamardy added under review and removed in progress Changes will be made from the author labels Feb 23, 2024
@shamardy shamardy marked this pull request as ready for review February 23, 2024 16:47
@cipig
Copy link
Member

cipig commented Feb 23, 2024

What effects does the DB changes have? If seed nodes don't save JSON files of swaps any more, then i can't use this on my seeds, else i will destroy all stats.
What about the "normal" maker nodes? will updating those will have an effect on swap JSON files on the seeds?

Other question: is there a way to tell mm2 to continue saving swap infos in files, like with a startup param?
That would help a lot, since i have other workflows that require the presence of those files, eg failed swap recovering.

@shamardy
Copy link
Collaborator Author

What effects does the DB changes have? If seed nodes don't save JSON files of swaps any more, then i can't use this on my seeds, else i will destroy all stats.
What about the "normal" maker nodes? will updating those will have an effect on swap JSON files on the seeds?

JSON files are not used for v2 swaps only which to be activated currently "use_trading_proto_v2": true has to be added to MM2.conf

Other question: is there a way to tell mm2 to continue saving swap infos in files, like with a startup param?
That would help a lot, since i have other workflows that require the presence of those files, eg failed swap recovering.

We can look into that for v2 swaps before activating it or you can use my_swap_status to get the data and save it in files yourself (adding another workflow).

@cipig
Copy link
Member

cipig commented Feb 23, 2024

so for v1 swaps, nothing changes? the files will still be there on makers and seeds?

i use the files on the seeds to add the swaps to MySQL which feeds different things

and on the makers i need them to refund... i need to call this manually from time to time

## maker
for i in `grep -l '"type":"MakerPaymentRefundFailed"' DB/*/SWAPS/MY/* | cut -d "/" -f 5 | cut -d "." -f 1`; do echo $i && curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"recover_funds_of_swap\",\"params\":{\"uuid\":\"$i\"}}" | json_pp; done
for i in `grep -l '"type":"TakerPaymentSpendFailed"' DB/*/SWAPS/MY/* | cut -d "/" -f 5 | cut -d "." -f 1`; do echo $i && curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"recover_funds_of_swap\",\"params\":{\"uuid\":\"$i\"}}" | json_pp; done

it looks in all files for "MakerPaymentRefundFailed" and "TakerPaymentSpendFailed" and calls recover_funds_of_swap with the uuid. this is needed because the automatic refund sometimes fails with "non-final" error, so only a manual call will refund those swaps

btw, what will we do with the users whose swap files need to be manually edited before refund? will it be possible to edit the stuff in the DB?

This commit implements the following:
- ETH websocket transport.
   - komodo-defi-proxy signed messages.
   - expirable hashmap, so that request contexts can be cleaned after timeout.
- Refactor web3 contexts, connection rotation and remove singular `web3` field from ETH coin.
- Heartbeats implementation for streaming channels.
- Refactored node rotation (moved from transport to protocol level, so it can be rotated across different transports)
- RPC abstraction for ETH
shamardy and others added 9 commits July 3, 2024 22:49
This commit renames mm2 binaries to kdf while also producing a copy that uses mm2 naming for backward compatibility. For wasm, only kdf named binaries are provided.
)

- Run local ATOM testnet in container for integration tests
- Run local NUCLEUS testnet in container for integration tests
- Add IBC relayer node in container connected to both testnets
- Include test coverage for Tendermint - ETH swap
- Use .docker/container-state for consistent testnet initial state
* install `paramiko` in CI container

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

* create artifact uploader python script

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

* use in-tree script for uploading artifacts

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

* extend deps-install composite pipeline

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

* apply review notes

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

* apply review note

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

---------

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
…2155)

This commit makes tendermint to use more precise max amount for withdraw operations by removing the estimated fee (by simulating the transaction) from it.
This commit introduces containers runtime directories for dockerized tests to ensure files consistency with each run and prevent local file changes with each test execution.
onur-ozkan and others added 6 commits July 16, 2024 14:51
Extends `common::http_uri_to_ws_address` helper to include address path.
This commit adds macOS target on Apple Silicon. Komodo wallet GUI has a new dependency that is incompatible with x86 architecture on macOS, breaking the current solution of building for x86 and running on Rosetta.
* resolve the expected sequence number locally

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

* drop SWAP locks for tendermint tests

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

* bless clippy

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

* chain regex options

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

* update account sequence error message

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

---------

Signed-off-by: onur-ozkan <work@onurozkan.dev>
)

This commit does the following:
- Increases the default consts for erc20 ops (to the old value actually) to ensure proxied erc20 would have enough gas.
- adds `gas_limit` param that can be set in coins config to allow setting lower (or higher) gas limits for selected tokens.
This commit introduces the following key changes related to issue #900:

- Implement standalone NFT maker swap contract (EtomicSwapMakerNftV2)
- Add komodefi-proxy support for NFT feature, enabling HTTP GET requests

Additional changes include:
- Implement Multi Standalone Etomic Swap contracts approach
- Add support for EtomicSwapTakerV2 contract
- Enhance security with checks for malicious token_uri links
- Make clear_all parameter optional in clear_nft_db RPC (default: false)
- Implement Sepolia testnet support for testing

This change adopts the new Etomic swap implementation approach as discussed in KomodoPlatform/etomic-swap#7 (comment)
@shamardy
Copy link
Collaborator Author

and on the makers i need them to refund... i need to call this manually from time to time

## maker
for i in `grep -l '"type":"MakerPaymentRefundFailed"' DB/*/SWAPS/MY/* | cut -d "/" -f 5 | cut -d "." -f 1`; do echo $i && curl > -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"recover_funds_of_swap\",\"params\":{\"uuid\":\"$i\"}}" | json_pp; done
for i in `grep -l '"type":"TakerPaymentSpendFailed"' DB/*/SWAPS/MY/* | cut -d "/" -f 5 | cut -d "." -f 1`; do echo $i && curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"recover_funds_of_swap\",\"params\":{\"uuid\":\"$i\"}}" | json_pp; done

it looks in all files for "MakerPaymentRefundFailed" and "TakerPaymentSpendFailed" and calls recover_funds_of_swap with the uuid. this is needed because the automatic refund sometimes fails with "non-final" error, so only a manual call will refund those swaps

Sorry for the late response @cipig, For v2, you can call my_recent_swaps and do the same.

btw, what will we do with the users whose swap files need to be manually edited before refund? will it be possible to edit the stuff in the DB?

Will add it to the trading protocol upgrade checklist #1895 (comment) Maybe we can add an rpc to let you edit swap data / events in DB. We shouldn't need to manually edit swap data but sometimes it's inevitable.

@shamardy shamardy mentioned this pull request Jul 25, 2024
21 tasks
@cipig
Copy link
Member

cipig commented Jul 25, 2024

Sorry for the late response @cipig, For v2, you can call my_recent_swaps and do the same.

Only if my_recent_swaps contain the error messages/events that happened during the swap. I search for MakerPaymentRefundFailed and TakerPaymentSpendFailed in the JSONs and then call recover_funds_of_swap for all swap uuids that had this errors. I can't do that for all swaps, that would be way too much.

@shamardy
Copy link
Collaborator Author

shamardy commented Jul 25, 2024

Only if my_recent_swaps contain the error messages/events that happened during the swap

It does for both v1 and v2 swaps https://komodoplatform.com/en/docs/komodo-defi-framework/api/legacy/my_recent_swaps/#response-success , we can even add filters for specific events in the future to make life easier.

smk762
smk762 previously approved these changes Jul 31, 2024
Copy link

@smk762 smk762 left a comment

Choose a reason for hiding this comment

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

No critical defects found in testing. Docs updates in progress, should be aligned by end of week

ca333
ca333 previously approved these changes Jul 31, 2024
…in (#2184)

This commit creates new `sign_low_r` function and keeps using regular sign for `derive_htlc_key_pair` of zcoin
@shamardy shamardy dismissed stale reviews from ca333 and smk762 via 1c94bf5 August 1, 2024 01:55
@shamardy shamardy merged commit 35e9239 into main Aug 1, 2024
20 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.