Skip to content

Conversation

@shamardy
Copy link
Collaborator

@shamardy shamardy commented Jun 16, 2025

v2.5.0-beta - 2025-07-04

Features:

WalletConnect Integration:

  • WalletConnect v2 support for EVM and Cosmos coins was implemented, enabling wallet connection and transaction signing via the WalletConnect protocol. #2223 #2485 #2508

Work in Progress (WIP) Features:

Cosmos Network and IBC Swaps:

  • Pre-swap validation logic was implemented for maker order creation, requiring HTLC assets and healthy IBC channels on the Cosmos network, with all changes gated behind the ibc-routing-for-swaps feature. #2459
  • The taker and maker order types were extended with an order_metadata field to carry protocol/IBC details, and cross-checks for IBC channels were added (also feature-gated), enabling both parties to validate IBC routing before a swap. #2476

TRON Integration:

  • Initial groundwork for TRON integration was started, including the addition of basic structures and boilerplate code; no end-to-end functionality is yet available. #2425

Enhancements/Fixes:

Event Streaming:

  • Streamer IDs in the event-streaming system were strongly typed to improve type safety and code clarity. #2441

Peer-to-Peer Network:

  • Hardcoded seed node IP addresses were removed from the peer-to-peer network configuration to improve maintainability. #2439

Orders and Trading Protocol:

  • The minimum trading volume logic was revised to remove BTC-specific volume behavior, standardizing the calculation across all coins. #2483

Tendermint / Cosmos:

  • A helper for generating internal transaction IDs for Tendermint transactions was introduced. #2438
  • The IBC channel handler was improved to enhance safety and reliability when interacting with IBC channels. #2298

Wallet:

  • Unconfirmed z-coin notes are now correctly tracked. #2331
  • HD multi-address support for message signing was implemented, allowing message signatures from multiple derived addresses. #2432 #2474
  • A delete_wallet RPC was introduced to securely remove wallets after password confirmation, while preventing the deletion of the currently active wallet. #2497
  • A race condition during the initialization of Trezor-based hardware wallets was resolved by ensuring the correct account and address are loaded before fetching the enabled address, preventing startup errors. #2504

UTXO:

  • Validation of expected public keys for p2pk inputs was corrected, resolving an error in p2pk transaction processing. #2408
  • Transaction fee calculation and minimum relay fee handling for UTXO coins were improved for accurate fee estimation. #2316

EVM / ERC20:

  • ETH address serialization in event streaming was updated to use the AddrToString trait for consistency. #2440

Pubkey Banning:

  • Expirable bans for pubkeys were introduced, allowing temporary exclusion of certain public keys. #2455

RPC Interface:

  • A unified interface was implemented for legacy and current RPC methods. #2450

DNS Resolution:

  • IP resolution logic was improved to fail only if no IPv4 address is found. #2487

Database and File System:

  • More replacements of dbdir with address_dir were made as part of an ongoing improvement to database architecture. #2398

Build and Dependency Management:

  • Duplicated mm2 build artifacts were removed from the build process to reduce clutter. #2448
  • Static CRT linking was enabled for MSVC builds, improving the portability of Windows binaries. #2464
  • The timed-map dependency was bumped to version 1.4.1 for improved performance and stability. #2413 #2481
  • The base58 crate was removed and replaced with bs58 throughout the codebase for consistency and security. #2427
  • Dependencies were reorganized using the workspace.dependencies feature for centralized management. #2449

Other Changes:

Documentation:

  • Old URLs referencing atomicDEX or previous documentation pages were updated throughout the documentation. #2428
  • A DeepWiki badge was added to the README to highlight documentation resources. #2463

Core Maintenance:

  • Workspace dependencies were organized for consistent dependency management across the project. #2449
  • A unit test was added to validate DEX fee handling for ZCoin. #2460
  • Improved ERC20 token lookup to use platform ticker alongside contract address for proper token identification across platforms. #2445

NB - Backwards compatibility breaking changes:

WalletConnect/EVM Coin Activation Policy:

  • The priv_key_policy field for EVM coin activation now requires the new enum variant format: "priv_key_policy": { "type": "ContextPrivKey" }. #2223

TRON/EVM Chain Specification:

  • EVM coin configurations must now include chain_id inside the protocol_data field. Legacy chain_id fields are deprecated. #2425

mm2 Build Artifacts:

  • The mm2 binaries have been removed from build outputs. Users must reference new artifact locations. #2448

Seednode Configuration:

  • Hardcoded seed nodes were removed. KDF will no longer connect to 8762 mainnet by default without proper seednodes configuration. #2439

IBC/Cosmos Changes:

  • The ibc_chains and ibc_transfer_channels RPC endpoints have been removed. #2459
  • The ibc_source_channel field now requires numeric values only (e.g., 12 instead of channel-12). #2459

onur-ozkan and others added 30 commits May 5, 2025 19:15
Replaces chain-registry parsing with embedded IBC channels in coins file
This commit fundamentally restructures the UTXO transaction building algorithm to fix issues with fee calculation and to address minimum relay fee requirements. The core change replaces the previous single-pass transaction assembly with an iterative approach that properly accounts for fee-output dependencies.
This commit establishes the foundation for native TRON (TRX) support alongside EVM chains using EthCoin implementation. It adds `EthCoin` `ChainSpec` and tron address handling.
Implements expirable public key banning. For swaps public keys will be banned for one hour, which should be a sufficient penalty (and can be easily increased if needed). Manual bans will default to permanent but this can be changed by including the duration_min parameter in the request.
* remove duplicated mm2 artifacts

Signed-off-by: onur-ozkan <[email protected]>

* create `$SAFE_DIR_NAME` before moving artifacts

Signed-off-by: onur-ozkan <[email protected]>

---------

Signed-off-by: onur-ozkan <[email protected]>
address_dir() will now default to dbdir() if the new-db-arch feature is disabled. That won't affect dev environment while this feature is in progress.
This commit organize multiple packages under a single workspace, share dependencies, etc. It also led to some compile time improvements.
This renames the function `get_enabled_erc20_by_contract` to `get_enabled_erc20_by_platform_and_contract` and adds a new parameter, namely the platform ticker.

The platform ticker is used to distinguish which erc20 token we are interested in, as erc20 tokens share the same contract address over different platforms, which means contract address alone isn't enough to identify the erc20 token.
- Removes all hardcoded seed nodes from KDF. Users must now supply their own seed node addresses in the `seednodes` config field; KDF will no longer auto-connect to 8762 mainnet by default.
- Adds two explicit boolean config fields: `is_bootstrap_node` and `disable_p2p`.
- Implements a P2P precheck flow that validates the combination of `i_am_seed`, `disable_p2p`, `is_bootstrap_node`, `seednodes`, `p2p_in_memory`, etc, and prevents misconfiguration.

**BREAKING:**  
KDF will not connect to any seed nodes by default. If `seednodes` is not properly set, mainnet connections will fail.

Fixes #2409
For p2pk inputs, the pubkey isn't included in the scriptSig. The scriptSig only includes the signature and that's it. This commit verifies the signature in the scriptSig using the expected pubkey.
…2432)

This commit allows users with HD wallets to sign messages from any derived address using `sign_message` RPC.
fixes two tests that were introduced in #2432.

1- fixes `test_sign_verify_message_eth_with_derivation_path` by including a json parameter that was missing.
2- fixes `test_hd_address_conflict_across_derivation_paths` as it was not functioning correctly because it never re-used the same DB path, which is a critical step to show that the bug exists. this makes it so we reuse the same DB path for the second mm2 instance. the test was also simplified to omit message signing as it was not critical part of the test.
…2459)

* add new feature `ibc-routing-for-swaps` to coins crate

* re-implement `fn wallet_only` behind ibc-routing-for-swaps feature

* add pre-check function `create_maker_order_pre_checks` to `MmCoins`

* add default logic to `tendermint_coin::pre_check_for_order_creation`

* enable conditional compilation

* use single generic IBC error in `WithdrawError`
…2223)

- Adds WalletConnect v2 integration for Ethereum (ETH, ERC20) and Cosmos-based coins, supporting both mobile and web wallets.
- Activation requests for these coins now use `"priv_key_policy": { "type": "WalletConnect", "session_topic": ... }` to delegate signing and transaction broadcasting to the connected wallet. No local private key is stored.
- New public APIs for session management: `wc_new_connection`, `wc_get_sessions`, `wc_get_session`, `wc_ping_session`, `wc_delete_session`.
- BREAKING: Coin activation for EVM and Cosmos coins now requires `"priv_key_policy"` to be an object with a `"type"` field (e.g. `{ "type": "ContextPrivKey" }`). Using a plain string is no longer accepted.
- BREAKING: Activation requests/responses for these coins are not backward compatible with previous formats.
- NFT coins are **not** yet supported via WalletConnect.
- UTXO coins remain unchanged; WalletConnect is not supported for them.
- All swap and transaction signing for WalletConnect-activated coins requires user approval in the external wallet.

This update enables secure, external signing with WalletConnect-compatible wallets and introduces new APIs for session lifecycle management.
* remove tendermint logics from `my_tx_history_v2` and create common function

Signed-off-by: onur-ozkan <[email protected]>

* use tx hash instead of hex

Signed-off-by: onur-ozkan <[email protected]>

---------

Signed-off-by: onur-ozkan <[email protected]>
…aces (#2450)

* re-write legacy `process_single_request`

Signed-off-by: onur-ozkan <[email protected]>

* provide unified RPC interface for clients

Signed-off-by: onur-ozkan <[email protected]>

* remove `mmrpc` from various tests to have a coverage on recent change

Signed-off-by: onur-ozkan <[email protected]>

* use `ERR` macro instead of `ERRL`

Signed-off-by: onur-ozkan <[email protected]>

* remove unknown method test for legacy dispatcher

Signed-off-by: onur-ozkan <[email protected]>

* add info log

Signed-off-by: onur-ozkan <[email protected]>

* nit

Signed-off-by: onur-ozkan <[email protected]>

---------

Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
* refactor(event-streaming): having a strong type for streamer id #2207

used enumeration to represent the IDs of the different types of
streamers that are currently supported.

* refactor(event-streaming): wrap StreamerId into an Arc #2207

* Revert "refactor(event-streaming): wrap StreamerId into an Arc #2207"

This reverts commit 702befe.

* fix(event-streaming): having derive_streamer_id returns only StreamerId

`derive_streamer_id` was returning `StreamerId` in some places and
`&'static StreamerId` in others, so it's now fixed to return
`StreamerId` in every place.

* fix(event-streaming): reorder derived traits for StreamerId #2207

* refactor(event-streaming): move StreamerId from streamer.rs to streamer_ids.rs

- move StreamerId from streamer.rs to streamer_ids.rs
- use the default Debug implementation for StreamerId
- use custom serialization and deserialization for StreamerId
  e.g. StreamerId::Balance(String::from("ETH")) will look like BALANCE:ETH instead of {"Balance":"ETH"}

* refactor(event-streaming): centralize StreamerId string constants and fix OrderbookUpdate format

- Moved all StreamerId string constants to module-level scope for reuse across Display and Deserialize implementations.
- Fixed inconsistency in OrderbookUpdate variant string format (was using "/" instead of ":").
- Improved test variant handling using FOR_TESTING_PREFIX under #[cfg(test)].

* refactor(event-streaming): use struct-like enums for StreamerId variants for better clarity

* chore(event-streaming): change XXX to TODO for clarity

* fix(event-streaming): enable StreamerId::ForTesting for wasm32 builds

Replaces `#[cfg(test)]` with `#[cfg(any(test, target_arch = "wasm32"))]`
so that the ForTesting variant is compiled when targeting WebAssembly.
* resolve hostnames better

Signed-off-by: onur-ozkan <[email protected]>

* re-org errors

Signed-off-by: onur-ozkan <[email protected]>

---------

Signed-off-by: onur-ozkan <[email protected]>
WalletConnectCtx is now initialized lazily in the `new_connection` RPC handler instead of during startup, preventing WalletConnect-related errors from affecting node initialization and avoiding unnecessary setup for users not using WalletConnect; this may slightly delay the first WalletConnect RPC call but has no functional impact.
…2476)

### Adds pre-swap checks and order metadata

This change is the second part of implementing IBC-routed swaps for the Cosmos ecosystem. It introduces pre-swap validation mechanisms to prevent users from entering swaps that are likely to fail due to misconfigured or unhealthy IBC channels.

The key additions include:

*   **Pre-Swap Validation:** A new `pre_check_for_order_creation` method has been integrated into the `buy` and `sell` workflows. For non-HTLC Tendermint coins, this check verifies:
    *   The existence of a healthy IBC channel to an HTLC-enabled chain (e.g., IRIS, NUCLEUS).
    *   A sufficient balance on the HTLC chain to cover potential routing fees, configured via `min_balance_for_ibc_routing`.

*   **Order Metadata:** A new `order_metadata` field has been added to `MakerOrder` and `TakerRequest`. For non-HTLC swaps, this field carries the `channel_id`, allowing the counterparty to validate the proposed swap route before proceeding.

*   **Tendermint Refactoring:** To support these features, the Tendermint coin implementation has been significantly refactored:
    *   Protocol-specific fields (`denom`, `chain_id`, `account_prefix`, etc.) have been consolidated into a `TendermintProtocolInfo` struct for better organization.
    *   Type safety has been improved by using `cosmrs::Denom` and `cosmrs::ChainId` instead of generic `String` types.
    *   Hardcoded prefixes like "iaa" and "nuc" have been replaced with shared constants (`IRIS_PREFIX`, `NUCLEUS_PREFIX`).

All changes are gated behind the `ibc-routing-for-swaps` feature flag and do not affect existing functionality in default builds.
…logic (#2483)

The removed logic is quite unnecessary today. With this patch, the minimum trading volume becomes 0.0001, which is around the equivalent of 10 USD and is roughly 10 times the average transaction fee on the BTC network.
Previously, when a Z-coin transaction with a change output was created, the change note was not properly accounted for before the transaction was confirmed. This resulted in an inaccurate spendable balance, often leading to subsequent transactions failing due to a perceived lack of funds.

This commit introduces `LockedNotesStorage`, a new persistence layer to track notes involved in pending (unconfirmed) transactions.

- When a transaction is created, its change output is now recorded as a `Change` note in this storage.
- The `my_balance` function has been updated to subtract the value of these locked notes, ensuring the spendable balance is accurate.
- Notes used as inputs are also locked as `Spent` to prevent double-spending.
- Once the transaction is confirmed, `scan_cached_block` removes the corresponding entries from `LockedNotesStorage`, making the change notes available for use.

This ensures that the wallet's state is consistent even with pending transactions, preventing incorrect balance calculations and transaction failures.
This commit introduces a framework for creating zcoin unit tests and makes the following key changes:
- A new unit test has been added to validate the address-checking logic within the `validate_dex_fee_output` function.
- The multicore feature has been removed from the zcash_proofs dependency for the wasm32 target to resolve test errors.
This commit does the following:
- Introduces a `delete_wallet` RPC to securely remove any wallet after password confirmation; it also prevents deletion of the active wallet.
- It add a requirement for `CryptoCtx` to be initialized with a passphrase if a seednodes is being initialized, preventing startup without persistant p2p keypair.
- It also improves WASM test documentation and removes/deactivates outdated QRC20 tests.
mariocynicys and others added 2 commits June 28, 2025 05:26
…oin init (#2504)

This commit makes it so we don't call get_enabled_address before initializing the coin, but rather after we made sure we initialized the account and address that the enabled address belongs to.
This commit fixes a critical race condition in the WalletConnect module that causes Client(WebsocketClient(NotConnected)) errors during initialization, particularly for the wc_new_connection RPC call. It's done by refactoring the connection management logic into a robust, centralized state machine. The scattered, per-function retry loops have been removed in favor of a more reliable architecture.
@smk762
Copy link

smk762 commented Jul 1, 2025

A quick report from this morning's trezor testing:
TREZOR ACTIVATION REPORT.md

tl;dr

  • task::enable_eth::init returns errors upon trezor activation attempt regardless of priv_key_policy structure.
  • z coin and tendermint task activation succeeds for trezor regardless of priv_key_policy structure or its presence/absence, and returns the same address either way. add_new_address is not supported, so this is assumed expected behavior.
  • qtum and utxo task activation on trezor successful using priv_key_policy": "Trezor", but not priv_key_policy": {"type": "Trezor"}.

The breaking change in #2223 implies an object (not string) should be used for priv_key_policy, though it is currently inconsistently applied in the API, which is a little confusing.

The failing ETH activation in Trezor, unless expected and WIP, I'd consider a blocker.
The param inconsistency I can delegate to an issue for future polishing.

ETH Trezor activation atttempt gave me:

{
    "mmrpc": "2.0",
    "result": {
        "status": "Error",
        "details": {
            "error": "Coin does not support Trezor wallet",
            "error_path": "lib.platform_coin_with_tokens.v2_activation",
            "error_trace": "lib:104] platform_coin_with_tokens:457] v2_activation:792]",
            "error_type": "Internal",
            "error_data": "Coin does not support Trezor wallet"
        }
    },
    "id": null
}

This is likely due to ETH not having a trezor_coin value in the coins repo. I'll aim to fix that.

MATIC/BNB return ActivatingCoin and then

{
    "mmrpc": "2.0",
    "result": {
        "status": "Error",
        "details": {
            "error": "DataError",
            "error_path": "lib.platform_coin_with_tokens.eth_with_token_activation.coin_balance.mod.pubkey.client",
            "error_trace": "lib:104] platform_coin_with_tokens:474] eth_with_token_activation:438] coin_balance:493] mod:417] pubkey:180] client:93]",
            "error_type": "Internal",
            "error_data": "DataError"
        }
    },
    "id": null
}

Not much in console logs, just 01 05:40:00, coins::coin_balance::common_impl:486] INFO BNB HD wallet hasn't been enabled before. Create default HD account then nothing else related.

smk762
smk762 previously approved these changes Jul 2, 2025
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.

Though some issues remain unresolved with Trezor and WalletConnect, none are blocking for next Wallet release - and changes required for next wallet release in this PR appear to be functional (in CLI at least).
On that basis, I'll approve for the sake of not delaying the next Wallet release, and await retesting the remnants in 2.6.0

DeckerSU
DeckerSU previously approved these changes Jul 3, 2025
Copy link

@DeckerSU DeckerSU left a comment

Choose a reason for hiding this comment

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

LGTM. All third-party dependencies in this project were scanned manually, and no malicious code was found. However, this review covered only intentional inclusions; logic errors, non-functional code, or similar issues in third-party libraries were not assessed during this review.

@shamardy shamardy dismissed stale reviews from DeckerSU and smk762 via 895ac4a July 4, 2025 03:00
@shamardy shamardy merged commit fbab8ec into main Jul 4, 2025
21 of 36 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.

10 participants