Skip to content

feat: ZHTLC support#3158

Merged
CharlVS merged 29 commits intodevfrom
feat/zhtlc-asset-support
Oct 3, 2025
Merged

feat: ZHTLC support#3158
CharlVS merged 29 commits intodevfrom
feat/zhtlc-asset-support

Conversation

@takenagain
Copy link
Copy Markdown
Contributor

@takenagain takenagain commented Sep 26, 2025

Summary by CodeRabbit

  • New Features

    • Added guided ZHTLC asset activation, including auto-detect/download of Zcash params and a configuration dialog.
    • Introduced a global configuration handler across Wallet, DEX, and Bridge pages.
    • Added an activation status bar showing real-time ZHTLC progress.
    • Enabled activation for previously excluded coins (e.g., ARRR).
  • UI

    • Expanded translations for ZHTLC settings and activation messages.
  • Bug Fixes

    • Improved screenshot-sensitive mode to prevent build-time notification errors.
  • Chores

    • Updated SDK submodule tracking branch.

fixes "setState() or markNeedsBuild() called when widget tree was locked. This ScreenshotSensitivity widget cannot be marked as needing to build because the framework is locked."  and "DartError: setState() or markNeedsBuild() called during build.
This ScreenshotSensitivity widget cannot be marked as needing to build because the framework is already in the process of building widgets. A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase."
@takenagain takenagain self-assigned this Sep 26, 2025
@takenagain takenagain added the enhancement New feature or request label Sep 26, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 26, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds ARRR/ZHTLC activation infrastructure: a new ArrrActivationService with config/result/status types, DI bootstrap, and UI handlers. Updates coins activation flow to route ZHTLC assets through the service. Introduces configuration dialog/handler and an activation status bar. Wraps key pages with the handler. Updates translations and excluded assets. Adjusts screenshot sensitivity notifications. Updates SDK submodule branch.

Changes

Cohort / File(s) Summary of Changes
Submodule config
.gitmodules, sdk
Switch sdk submodule tracking to branch bugfix/zhltc-activation-fixes; update submodule commit pointer.
Translations (ZHTLC strings)
assets/translations/en.json
Remove seedSaveAndRemember; add ZHTLC-related securitySettings keys and pluralized activation messages.
App config & imports
lib/app_config/app_config.dart, lib/bloc/app_bloc_root.dart, lib/main.dart
Remove several assets from excludedAssetList; add ArrrActivationService imports; reorder an import.
Coins activation flow
lib/bloc/coins_bloc/coins_repo.dart
Route ZHTLC assets through new ArrrActivationService; add _activateZhtlcAssets/_activateZhtlcAsset; change _subscribeToBalanceUpdates(Asset) signature and usage.
ARRR activation core
lib/services/arrr_activation/arrr_activation_service.dart, lib/services/arrr_activation/arrr_config.dart
Add ArrrActivationService with config request/submit/cancel, activation status tracking, diagnostics, and dispose. Add result/status union types and related data classes.
Bootstrap/DI
lib/services/initializer/app_bootstrapper.dart
Register ArrrActivationService singleton with GetIt during app startup.
Screenshot sensitivity
lib/shared/screenshot/screenshot_sensitivity.dart
Guard listener notifications post-frame; track enter/exit lifecycle via flag; update constructor signature to required super.child.
ZHTLC UI components
lib/views/wallet/wallet_page/common/zhtlc/zhtlc_configuration_handler.dart, .../zhtlc_configuration_dialog.dart, .../zhtlc_activation_status_bar.dart
Add configuration handler (listens for requests, launches dialog, submits/cancels); add configuration dialog with Zcash params download support; add status bar widget showing activation progress.
Page-level integration
lib/views/bridge/bridge_page.dart, lib/views/dex/dex_page.dart, lib/views/wallet/coins_manager/coins_manager_page.dart, lib/views/wallet/wallet_page/wallet_main/wallet_main.dart, lib/views/wallet/wallet_page/wallet_main/active_coins_list.dart
Wrap pages with ZhtlcConfigurationHandler; pass ArrrActivationService to ActiveCoinsList; update constructors/imports; minor formatting/layout tweaks.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as Wallet/Dex/Bridge UI
  participant CoinsRepo
  participant ArrrSvc as ArrrActivationService
  participant Handler as ZhtlcConfigurationHandler
  participant Dialog as ZhtlcConfigurationDialog
  participant SDK as SDK (ARRR/ZHTLC)

  User->>UI: Activate ZHTLC asset
  UI->>CoinsRepo: activateAssetsSync(assets)
  alt Asset is ZHTLC
    CoinsRepo->>ArrrSvc: activateArrr(asset)
    alt Needs configuration
      ArrrSvc-->>Handler: configurationRequests(asset, requiredSettings)
      Handler->>Dialog: confirmZhtlcConfiguration(asset)
      Dialog-->>Handler: ZhtlcUserConfig or cancel
      alt User provided config
        Handler->>ArrrSvc: submitConfiguration(assetId, config)
      else Cancelled/error
        Handler->>ArrrSvc: cancelConfiguration(assetId)
        ArrrSvc-->>CoinsRepo: error
      end
    end
    ArrrSvc->>SDK: start activation
    SDK-->>ArrrSvc: progress events
    ArrrSvc-->>UI: activationStatuses[asset] updated
    ArrrSvc-->>CoinsRepo: success/error
    CoinsRepo->>CoinsRepo: subscribeToBalanceUpdates(asset[, parent])
    UI-->>UI: ZhtlcActivationStatusBar polls statuses
  else Non-ZHTLC asset
    CoinsRepo->>CoinsRepo: existing activation path
  end
Loading
sequenceDiagram
  participant ArrrSvc as ArrrActivationService
  participant StatusBar as ZhtlcActivationStatusBar
  rect rgba(225,245,254,0.4)
    note over ArrrSvc,StatusBar: Periodic UI refresh
    StatusBar->>StatusBar: Timer tick (1s)
    StatusBar->>ArrrSvc: activationStatuses
    ArrrSvc-->>StatusBar: Map<AssetId, Status>
    StatusBar->>StatusBar: filter recent in-progress/completed/errors
    StatusBar-->>StatusBar: render progress/message
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

QA

Suggested reviewers

  • smk762
  • DeckerSU
  • CharlVS

Poem

Hop hop, I toggle coins with care,
New ZHTLC winds fresh in the air.
Dialogs pop—“configure, please!”—
Params fetched with bunny ease.
Progress glows, a gentle bar,
Wallet stars align—how far! ✨
Thump-thump—deploy! 🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title “feat: ZHTLC support” accurately and concisely summarizes the primary objective of the changeset, which is to introduce comprehensive ZHTLC asset support across configuration, activation services, UI components, and translations. It clearly reflects the main feature addition without extraneous detail or ambiguity.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@takenagain
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 26, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🧹 Nitpick comments (7)
lib/views/wallet/wallet_page/common/zhtlc/zhtlc_activation_status_bar.dart (1)

25-51: Refresh the cached statuses before the first frame

Right now we only populate _cachedStatuses after the first one-second timer tick, so a status bar that should already be visible renders empty momentarily. Grabbing the latest snapshot in initState before starting the timer keeps the UI accurate from the very first frame. Something along these lines would do it:

   void initState() {
     super.initState();
+    _cachedStatuses = widget.activationService.activationStatuses;
     _startPeriodicRefresh();
   }
lib/services/arrr_activation/arrr_activation_service.dart (1)

267-288: Avoid silently losing configuration requests when no listeners are ready

If no UI listener attaches within 10 seconds, we still emit to _configRequestController; broadcast streams drop events when no one is subscribed, so the request disappears and the activation waits 15 minutes before timing out. Consider short‑circuiting with an immediate error (or queueing until a listener arrives) instead of fire‑and‑forget to a listener-less stream.

lib/services/arrr_activation/arrr_config.dart (1)

53-66: Ensure deterministic equality for required settings

Using other.requiredSettings == requiredSettings compares list references, not contents. Two logically identical ArrrActivationResultNeedsConfig instances with different list instances will compare unequal, hurting caching/UI diffing. Apply ListEquality (from package:collection) or wrap with UnmodifiableListView plus value equality.

lib/bloc/app_bloc_root.dart (1)

26-26: Remove unused import (if not needed here)

The ArrrActivationService import appears unused in this file. Consider removing to avoid warnings; it’s already imported in main.dart for the part that registers it.

Based on learnings

-import 'package:web_dex/services/arrr_activation/arrr_activation_service.dart';
lib/services/initializer/app_bootstrapper.dart (1)

44-46: Registering ArrrActivationService: minor cleanup and lifecycle

  • Remove extra whitespace in constructor call.
  • If ArrrActivationService holds resources (streams/timers), register a dispose callback with GetIt.
-    final arrrActivationService = ArrrActivationService( kdfSdk);
-    GetIt.I.registerSingleton<ArrrActivationService>(arrrActivationService);
+    final arrrActivationService = ArrrActivationService(kdfSdk);
+    // If ArrrActivationService exposes dispose/close, wire it here:
+    GetIt.I.registerSingleton<ArrrActivationService>(
+      arrrActivationService,
+      // dispose: (s) => s.dispose(),
+    );

If the service needs async initialization (e.g., preloading Zcash params), consider registerSingletonAsync with dependsOn to avoid race conditions.

.gitmodules (1)

4-4: Pin SDK submodule to specific commit SHA

Branch bugfix/zhltc-activation-fixes exists upstream (HEAD 0d6b12ca533014fb658a07a7f8dbe7db07d6d733). Update the superproject to reference this SHA for reproducibility and optionally remove the branch hint from ​.gitmodules.

lib/views/dex/dex_page.dart (1)

20-21: Decouple ZhtlcConfigurationHandler into a shared module
The handler currently lives in lib/views/wallet/wallet_page/common/zhtlc; move it to lib/views/common/zhtlc or shared/widgets to avoid DEX→wallet coupling. DexPage is only wrapped here—no duplicate dialogs.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc1fe61 and 349baca.

⛔ Files ignored due to path filters (1)
  • lib/generated/codegen_loader.g.dart is excluded by !**/generated/**
📒 Files selected for processing (19)
  • .gitmodules (1 hunks)
  • assets/translations/en.json (1 hunks)
  • lib/app_config/app_config.dart (0 hunks)
  • lib/bloc/app_bloc_root.dart (1 hunks)
  • lib/bloc/coins_bloc/coins_repo.dart (6 hunks)
  • lib/main.dart (1 hunks)
  • lib/services/arrr_activation/arrr_activation_service.dart (1 hunks)
  • lib/services/arrr_activation/arrr_config.dart (1 hunks)
  • lib/services/initializer/app_bootstrapper.dart (1 hunks)
  • lib/shared/screenshot/screenshot_sensitivity.dart (2 hunks)
  • lib/views/bridge/bridge_page.dart (6 hunks)
  • lib/views/dex/dex_page.dart (3 hunks)
  • lib/views/wallet/coins_manager/coins_manager_page.dart (2 hunks)
  • lib/views/wallet/wallet_page/common/zhtlc/zhtlc_activation_status_bar.dart (1 hunks)
  • lib/views/wallet/wallet_page/common/zhtlc/zhtlc_configuration_dialog.dart (1 hunks)
  • lib/views/wallet/wallet_page/common/zhtlc/zhtlc_configuration_handler.dart (1 hunks)
  • lib/views/wallet/wallet_page/wallet_main/active_coins_list.dart (2 hunks)
  • lib/views/wallet/wallet_page/wallet_main/wallet_main.dart (12 hunks)
  • sdk (1 hunks)
💤 Files with no reviewable changes (1)
  • lib/app_config/app_config.dart
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-04-01T15:51:37.060Z
Learnt from: takenagain
PR: KomodoPlatform/komodo-wallet#2566
File: lib/bloc/coins_bloc/coins_bloc.dart:10-10
Timestamp: 2025-04-01T15:51:37.060Z
Learning: In the Komodo Wallet project, part files share imports with their parent files. The import for `app_config.dart` in `coins_bloc.dart` is necessary because the part file `coins_state.dart` uses `excludedAssetList` from that package.

Applied to files:

  • lib/bloc/app_bloc_root.dart
  • lib/views/wallet/coins_manager/coins_manager_page.dart
  • lib/views/wallet/wallet_page/wallet_main/wallet_main.dart
  • lib/bloc/coins_bloc/coins_repo.dart
📚 Learning: 2025-09-02T15:57:12.405Z
Learnt from: takenagain
PR: KomodoPlatform/komodo-wallet#3125
File: lib/views/fiat/fiat_inputs.dart:61-62
Timestamp: 2025-09-02T15:57:12.405Z
Learning: The Debouncer class is available from the 'package:komodo_ui/komodo_ui.dart' import in the Komodo Wallet codebase.

Applied to files:

  • lib/views/wallet/wallet_page/wallet_main/wallet_main.dart
📚 Learning: 2025-08-31T19:24:53.317Z
Learnt from: CR
PR: KomodoPlatform/komodo-wallet#0
File: AGENTS.md:0-0
Timestamp: 2025-08-31T19:24:53.317Z
Learning: Use BLoC where applicable and follow BLoC conventions

Applied to files:

  • lib/views/wallet/wallet_page/wallet_main/wallet_main.dart
📚 Learning: 2025-04-01T15:51:37.060Z
Learnt from: takenagain
PR: KomodoPlatform/komodo-wallet#2566
File: lib/bloc/coins_bloc/coins_bloc.dart:10-10
Timestamp: 2025-04-01T15:51:37.060Z
Learning: The `excludedAssetList` from `app_config.dart` is used in the `_filterExcludedAssets` method in `coins_state.dart`. Since `coins_state.dart` is a part file of `coins_bloc.dart`, the import needs to be in the parent file even though it's not directly used there. In Dart, part files share the namespace and imports of their parent files.

Applied to files:

  • lib/views/wallet/wallet_page/wallet_main/wallet_main.dart
📚 Learning: 2025-08-31T19:24:53.317Z
Learnt from: CR
PR: KomodoPlatform/komodo-wallet#0
File: AGENTS.md:0-0
Timestamp: 2025-08-31T19:24:53.317Z
Learning: For Komodo DeFi Flutter SDK repository, reference `/KDF_API_DOCUMENTATION.md` and applicable RPCs, data structures, and notes when implementing RPC-related features

Applied to files:

  • lib/bloc/coins_bloc/coins_repo.dart
🔇 Additional comments (5)
sdk (1)

1-1: Submodule pointer update looks good.

Thanks for pinning the sdk submodule to the new commit; the ref change is clear and isolated.

lib/main.dart (1)

31-31: LGTM: import ensures part file sees ArrrActivationService

Importing arrr_activation_service at the library level is needed so the part file (app_bootstrapper.dart) can use it. Good.

Based on learnings

Also applies to: 36-36

lib/views/wallet/coins_manager/coins_manager_page.dart (1)

11-13: LGTM: Handler integration and constructor cleanup

  • Good use of ZhtlcConfigurationHandler around the page.
  • super.key constructor style is idiomatic.

Also applies to: 16-20, 34-61

assets/translations/en.json (1)

763-784: Validate ZHTLC i18n keys and placeholders

  • No other locale files under assets/translations — cross-locale coverage N/A.
  • lib/generated/codegen_loader.g.dart already declares all ZHTLC LocaleKeys.
  • Confirm each {} placeholder (e.g. in zhtlcConfigureTitle, zhtlcErrorSettingUpZcash) aligns with code usage.
lib/views/bridge/bridge_page.dart (1)

19-19: Approve ZHTLC handler usage Confirmed a single ZhtlcConfigurationHandler per page—no nested wrappers in Bridge, DEX, Coins Manager, or Wallet.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 26, 2025

Visit the preview URL for this PR (updated for commit c6e7621):

https://walletrc--pull-3158-merge-9wqosmg9.web.app

(expires Thu, 09 Oct 2025 18:47:37 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

- cache heavy operations that aren't expected to change regularly.
- add debounce on search input
@takenagain takenagain marked this pull request as ready for review September 27, 2025 00:12
Copilot AI review requested due to automatic review settings September 27, 2025 00:12
@takenagain takenagain changed the title feat: ZHTLC asset support feat: ZHTLC support Sep 27, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive ZHTLC (zero hash time locked contracts) asset support to the wallet application, enabling users to activate and manage ZHTLC assets like ARRR (Pirate Chain) with guided configuration.

Key changes include:

  • Guided ZHTLC asset activation with automatic Zcash parameter detection and download
  • Global configuration dialog system across Wallet, DEX, and Bridge pages
  • Real-time activation status display for improved user experience

Reviewed Changes

Copilot reviewed 18 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/services/arrr_activation/ New service layer for ZHTLC activation with configuration management
lib/views/wallet/wallet_page/common/zhtlc/ New UI components for ZHTLC configuration dialogs and status display
lib/bloc/coins_bloc/coins_repo.dart Integration of ZHTLC activation service into coin repository
lib/views/wallet/wallet_page/wallet_main/ Integration of ZHTLC handlers and status display
assets/translations/en.json Added ZHTLC-specific translation strings

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@takenagain takenagain added the QA Ready for QA Testing label Sep 27, 2025
@takenagain takenagain requested a review from smk762 September 27, 2025 01:20
@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Sep 27, 2025

In Web, HD mode:

  • ARRR seen in coins list prior to login ✅
  • ARRR activated (after errors noted above) ✅
  • ARRR present in private key export. QR code matches copy test. Upon using z_importkey to import this into the native deamon, z_validateaddress on same address as seen in wallet returns "ismine": true. ✅
image

Can we please add to this warning - transactions and balance prior to the sync date may be missing. Often this can be restored by sending in and out new transactions? The Date & Time text might also benefit from some left padding.

After switching to portfoilio and back into ARRR wallet

image

General request for task based activations - while activation is in progress:

  • disallow toggle flip in coins activation page (user should not be able to turn it off before it is actually finished activating)
  • disallow wallet page entry. It seems that premature wallet page entry may result in the errors above.
  • replace spinner in portfolio page row for coin with "Activating coin...", "Requesting balance..."
  • use get_enabled_coins before attempting activation to avoid misleading error messages and retry only when required.

Minor theme fail - black text under "loading addresses" is hard to see, should be white in dark mode & viceversa.
image
image

User should not have to await loading of addresses here, as ARRR does not allow creation of additional addresses in app. Related (though this applies to HD login also when coins are singular with no option to add more) #2804

I was stuck here for a while after attempting to create a transaction, then having the form drop out due to me opening the dev console, and reentering the form again. Eventually address showed, assuming after background tx generation completed.

image

This is the display while the transaction is being generated. There is no spinner, nor any other indication of an operation in progress. Some links related for context:

Suggest spinner + Generating transaction... status text while task::*::status returns "status": "InProgress"
might also be worth adding a warning that Z coin transactions take a while to generate, and they need to stay on the page or else they will have to start all over.

After some patience and uncertainty of progress, I was rewarded with the confirmation screen:

image

This should include the memo field (among other transaction metadata). This is a global, not z coin specific. Issues for this exist at [1] [2]

After clicking "send", it spins again
image

It is unclear if exiting this screen will result in a failed transaction (it shouldnt, but this is not clear in UI). This is especially confusing with ARRR, where there is no transaction history in wallet page - user must wait and see if balance changes.

It appears that https://komodoplatform.com/en/docs/komodo-defi-framework/api/v20/wallet/tx/zhtlc_tx_history/ has not been implemented.

Eventually, balance change indicates withdrawal was successful, despite the UX requiring faith rather than offering guidance. As suspected, post withdraw, some previously hidden balance was revealed also. Balance grew to 1.9 after it was at 1, and I withdrew 0.1 - the "bonus" would be from tx prior to sync settings being awakened by the withdrawal.

Unable to view orderbook - rpc:154] rpc:195] RPC call failed: orderbook_rpc:105] lp_coins:5601] address_by_coin_conf_and_pubkey_str is not supported for ZHTLC protocol!
image

Despite this, the form was prefilled, and the "Swap now" button active, so it was clicked to see what would happen.
After a 20 second or so wait, watching the button spin, the swap confirmation appeared.

image

Confirm button begins its spin...

I have some concerns that these waits, and the consequences of navigating away, may negatively impact UX when slow actions need to be repeated due to initial impatience or unawareness, and abandoned operations may continue to block subsequent actions until the abandoned is complete.

Still waiting for confirm button to stop spinning spin... lets go get a coffee... and mow the lawn... and it's still spinning after 30 minutes. Being as I am notoriously impatient, this was the moment I gave up, and found out the "back" button wasn't working either.

Summary

Crititcal

High priority, low effort UX fixes

  • Add transactions and balance prior to the sync date may be missing. Often this can be restored by sending in and out new transactions to sync activation page warning
  • fix date & time label position
  • Add note and visual feedback for user to be aware z coin transaction generation will take patience, and the process is in progress.
  • Fix stealth text missing theme color (Fetching your {ticker} addresses)

High priority, medium effort UX fixes with global scope

  • Block toggle while activation in progress
  • Block coin wallet page while activation in progress
  • Defend against TaskFinished errors in coin wallet page (may be resolved by the above)

Medium priority, medium effort UX fixes with global scope (will delegate to issues)

  • replace/supplement spinners with task status text
  • add missing context to withdraw confirmation form
  • Apply "task failed" timeout to spinners threatening immortality

With ZHTLC enabled, the `get_enabled_coins` RPC takes long - not yet sure why - and the taker form calls the validator regularly, resulting in long loading times and input delays
@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Sep 28, 2025

Most recent commit not building, tests below based on b351e11

Confirmed extra warning text on sync params input ✔️
orderbook functional ✔️

image

Can we please reduce the font a little here?

image

Still a bit of stealth text here (balance in black to the right of the blue icon)

@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Sep 28, 2025

Triggered by either attempting orderbook request during ARRR activation loop, or due to other Komodo-Wallet tabs open from previously.
image

image

Retry after tab reload, activation message row, but no ARRR row (previously ARR was seen and clickable during activation).

image

Though its preferable to hide / disable the ARRR row until activation completes (to avoid premature action conflicts), after waiting 5 mins, I came to the conclusion that this activation is likely not progressing. Log files confirm it stuck, with repeating logs for

    at Object.l (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:4004:20)
    at https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:34244:21
    at cAT.a (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:5600:63)
    at cAT.$2 (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:51985:14)
    at cz2.$1 (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:51979:21)
    at Object.cAA (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:5896:19)
    at aJf.<anonymous> (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:147941:10)
    at aSm.vR (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:53321:12)
    at cfV.$0 (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:52525:11)
    at Object.R3 (https://walletrc--pull-3158-merge-9wqosmg9.web.app/main.dart.js:5771:40), app_version: 0.9.2, mm2_version: 2.5.1-beta_a9fbf60, os_language: en-US, screen_size: 3189:1367, timestamp: 1758938187372, date: 2025-09-27 09:56:27.372}__metadata: {appVersion: null, mm2Version: 2.5.1-beta_a9fbf60, appLanguage: , platform: linux chrome 140.0.0.0 , osLanguage: en-US, screenSize: 3189:1367}
2025-9-27: 1:56:31.956T+:0:08:14.497000 [LOG] {message: WARNING: Empty transactions or OHLC data, returning empty chart - null, path: PortfolioGrowthRepository, app_version: 0.9.2, mm2_version: 2.5.1-beta_a9fbf60, os_language: en-US, screen_size: 3189:1367, timestamp: 1758938191956, date: 2025-09-27 09:56:31.956}__metadata: {appVersion: null, mm2Version: 2.5.1-beta_a9fbf60, appLanguage: , platform: linux chrome 140.0.0.0 , osLanguage: en-US, screenSize: 3189:1367}
2025-9-27: 1:56:39.916T+:0:08:22.457000 [LOG] {message: Uncaught exception: GeneralErrorResponse: {"mmrpc":"2.0","error":null,"error_path":null,"error_type":null,"error_data":null,"error_trace":null,"object":{"mmrpc":"2.0","error":"Task is finished already","error_path":"init_standalone_coin.manager","error_trace":"init_standalone_coin:161] manager:138]","error_type":"TaskFinished","error_data":426,"id":null}}.

@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Sep 29, 2025

A swap was initiated (on web), and negotiated successfully. I navigated away while it was "sending taker fee" and the GUI became locked soon after (assuming due to ARRR transaction generation, as ARRR was the taker coin). After around 30 seconds, the gui was unblocked and I was able to resume navigation without further issues.

I tried to also create a ARRR buy with KMD as the taker coin. First attempt failed to negotiate (possibly a maker side issue), but the second started as expected.

Swap where ARRR was taker coin failed at TakerPaymentSent
image
Review of swap json data shows error as

             {
                "timestamp": 1759105015831,
                "event": {
                    "type": "TakerPaymentTransactionFailed",
                    "data": {
                        "error": "taker_swap:1750] mm2src/coins/z_coin.rs:1372] z_coin:505] z_coin:410] GenTxError(TxBuilderError(AnchorMismatch))"
                    }
                }
            },

Swap where ARRR was maker coin successful after 25 min:
image

fetching tx history of activating coins wrecks havok on startup, especially for ARRR
@takenagain takenagain requested a review from CharlVS September 30, 2025 01:04
This logic was mistakenly not copied over from the normal coin activation function
@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Sep 30, 2025

Confirmed critical functionality completed (activation, withdraw, trade, privkey, tx history).
Some UX issues remain, the worst being:

  • UI blocked/frozen at times (e.g. when selecting to selling ARRR on DEX as taker) and possibly during transaction generation.
  • Withdraw errors which I'm unable to resolve
image - ARRR taker sells failing at `TakerPaymentSent` stage (3 fails, no success so far).

@CharlVS
Copy link
Copy Markdown
Collaborator

CharlVS commented Sep 30, 2025

ARRR taker sells failing at TakerPaymentSent stage (3 fails, no success so far).

@smk762 you mention swaps working, so does that mean that maker orders are working?

For critical issues, can you please also test on native build so we can isolate if only wasm or not?

@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Sep 30, 2025

ARRR taker sells failing at TakerPaymentSent stage (3 fails, no success so far).

@smk762 you mention swaps working, so does that mean that maker orders are working?

For critical issues, can you please also test on native build so we can isolate if only wasm or not?

So far only taker tested. Where ARRR is sell coin, it has failed. Where ARRR is buy coin, it succeeds. Desktop tests scheduled for today. So far tests have been in HD also - Iguana tests also scheduled for today.

Initial tests on Iguana / Linux Desktop show much faster operations. Confirmed Memo field now in confirmation summary ✔️

A parallel web instance, using a different seed, was launched in Iguana mode for maker trade counterparty. ARRR once again failed to activate (NoSuchCoin), likely due to user entering ARRR wallet page before activation process was complete. I cant be certain of this, but there appears to be a strong correlation between this action and the resulting error based on prior test runs.

A second activation attempt in web where user remained in portfolio page during the whole (3-5 minute) process was successful.

Suggest:

  • Add This may take from a few minutes to a few hours, depending on your sync params and how long since your last sync. to the "Activating {coin}. Please do not close tab or app until complete` message on portfolio page while ZHTLC activation is in progress, to better manage user expectations.
  • Disable the ARRR portfolio row until it has finished activation, and has balance data, to avoid premature user entry into wallet resulting in activation error state.
  • Where progress starts at 1% but stays there for a while, it might be better to let it start at 20% just for the psyops. Implied slightly closer early on should instill greater patience later

I was unable to proceed with Desktop DEX tests due to unexpected geoblock on the build (via CI, though had same building local yesterday).

image

Assumed due to missing FEEDBACK_API_KEY in secrets, will attempt local resolution and retry.

@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Sep 30, 2025

I almost gave up on it, when a distant ship appeared on the horizon and made it into port.
image

Linux Desktop Iguana Maker -> Brave Web Iguana Taker ✔️

Attempting to select as taker on desktop has led to "swap now" button spinning for a few minutes. Retried in a new session. After selecting KMD (sell) and ARRR (buy) matching my Web Maker, the following error was seen immediately after clicking the "Swap Now" button:

AppBlocObserver -> onError
TakerBloc: Bad state: No element
Trace: #0      SetBase.single (dart:collection/set.dart:127)
#1      KdfAuthMetadataExtension.getWalletAssets.<anonymous closure> (package:web_dex/model/kdf_auth_metadata_extension.dart:59)
#2      MappedIterable.elementAt (dart:_internal/iterable.dart:402)
#3      ListIterator.moveNext (dart:_internal/iterable.dart:371)
#4      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:194)
#5      new _GrowableList.of (dart:core-patch/growable_array.dart:154)
#6      new List.of (dart:core-patch/array_patch.dart:39)
#7      SetBase.toList (dart:collection/set.dart:119)
#8      KdfAuthMetadataExtension.getWalletAssets (package:web_dex/model/kdf_auth_metadata_extension.dart:60)
<asynchronous suspension>
#9      TakerValidator._validateCoinAndParent (package:web_dex/bloc/taker_form/taker_validator.dart:225)
<asynchronous suspension>
#10     TakerValidator.validateForm (package:web_dex/bloc/taker_form/taker_validator.dart:119)
<asynchronous suspension>
#11     TakerValidator.validate (package:web_dex/bloc/taker_form/taker_validator.dart:47)
<asynchronous suspension>
#12     TakerBloc._onFormSubmitClick (package:web_dex/bloc/taker_form/taker_bloc.dart:140)
<asynchronous suspension>
#13     Bloc.on.<anonymous closure>.handleEvent (package:bloc/src/bloc.dart:226)
<asynchronous suspension>

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Bad state: No element
#0      SetBase.single (dart:collection/set.dart:127)
#1      KdfAuthMetadataExtension.getWalletAssets.<anonymous closure> (package:web_dex/model/kdf_auth_metadata_extension.dart:59)
#2      MappedIterable.elementAt (dart:_internal/iterable.dart:402)
#3      ListIterator.moveNext (dart:_internal/iterable.dart:371)
#4      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:194)
#5      new _GrowableList.of (dart:core-patch/growable_array.dart:154)
#6      new List.of (dart:core-patch/array_patch.dart:39)
#7      SetBase.toList (dart:collection/set.dart:119)
#8      KdfAuthMetadataExtension.getWalletAssets (package:web_dex/model/kdf_auth_metadata_extension.dart:60)
<asynchronous suspension>
#9      TakerValidator._validateCoinAndParent (package:web_dex/bloc/taker_form/taker_validator.dart:225)
<asynchronous suspension>
#10     TakerValidator.validateForm (package:web_dex/bloc/taker_form/taker_validator.dart:119)
<asynchronous suspension>
#11     TakerValidator.validate (package:web_dex/bloc/taker_form/taker_validator.dart:47)
<asynchronous suspension>
#12     TakerBloc._onFormSubmitClick (package:web_dex/bloc/taker_form/taker_bloc.dart:140)
<asynchronous suspension>
#13     Bloc.on.<anonymous closure>.handleEvent (package:bloc/src/bloc.dart:226)
<asynchronous suspension>

…hing tx history of unactivated assets (#3162)

* fix(wallet): add resilience to delisted coins for wallet coin metadata

* fix(version-info): ensure that apiversion and commit has persist

* perf(market-metrics): add backoff strategy for periodic updates

TODO: ensure that the portfolio growth event is only fired once to avoid restarting the periodic updates on every user input (likely the case currently)

* refactor(market-metrics): extract common coin filtering for test coin removal

* refactor(market-metrics): extract calculation functions into extension

* perf(coins-bloc): add initialisation status tracking for startup

* refactor: add loop exits, update comments, remove unused event member
@takenagain
Copy link
Copy Markdown
Contributor Author

A parallel web instance, using a different seed, was launched in Iguana mode for maker trade counterparty. ARRR once again failed to activate (NoSuchCoin), likely due to user entering ARRR wallet page before activation process was complete. I cant be certain of this, but there appears to be a strong correlation between this action and the resulting error based on prior test runs.

ARRR should only appear in the wallet page once activation succeeds or fails (5 attempts with exponential backoff), so its appearance indicates a failure of the initial activation attempts. Possible activation race conditions further mitigated in 3537231.

I was unable to proceed with Desktop DEX tests due to unexpected geoblock on the build (via CI, though had same building local yesterday).

API key can be sent in DM and added to the build command, flutter build web --dart-define=FEEDBACK_API_KEY=$FEEDBACK_API_KEY.

Attempting to select as taker on desktop has led to "swap now" button spinning for a few minutes. Retried in a new session. After selecting KMD (sell) and ARRR (buy) matching my Web Maker, the following error was seen immediately after clicking the "Swap Now" button:

I pushed a fix for this alongside the additional text to the sync status banner in b85c889 and a82e022. DEX buy and sell coin selection and filtering are improved in 3537231.

@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Oct 1, 2025

Confirmed no ARRR row in portfolio while activating. ✔️
Confirmed activation text (mins/hrs) added. ✔️

When activation was at 97% I entered the DEX tab and was able to select ARRR from the sell list, before activation had completed. Upon returning to portfolio page, it was back down to 1%, then showed json error in red at bottom of activation status section, then status section disappeared, ARRR row appeared, I entered, and saw red.

image

In same session, after manually "disabling" ARRR, activattion was re-attempted, with status oscillating between 1% and 9% before red json error reappeared - it's a "file already open" error - more detail in video. Seems its attempting to activate while an activation is already in progress.

vokoscreenNG-2025-10-01_20-38-02.mp4

@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Oct 1, 2025

Linux Desktop testing on hold due to login issue reported in internal chat (affects all PRs)

@CharlVS
Copy link
Copy Markdown
Collaborator

CharlVS commented Oct 1, 2025

Linux Desktop testing on hold due to login issue reported in internal chat (affects all PRs)

@smk762 does that mean that web is signed off, or at least that you've completed your full cycle of testing on it?

@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Oct 1, 2025

Linux Desktop testing on hold due to login issue reported in internal chat (affects all PRs)

@smk762 does that mean that web is signed off, or at least that you've completed your full cycle of testing on it?

Unresolved activation issues were still presenting regardless of platform at prior test. Videos in last comment show this in web. Some tests were conducted on desktop before the login issue presented, generally it performs better than web (faster to sync/generate etc).

Retested most recent commits in web:

  • ARRR still in orderbook list prior to activation complete. No error seen, but dots in orderbook implying user placed orders is incorrect. User has no maker orders open.
  • Activation loop for ARRR appears to be working without encountering activation errors when prematurely navigating. Though video shows no such coin, it did eventually activate without an error being shown.
vokoscreenNG-2025-10-01_23-59-48.mp4

Recommend:

  • Translate No such COIN errors to COIN is not activated.

Web has wasm related issue for withdrawals which might also be cause of swap fails. Linked fix did not resolve issue, but is KDF bug, not wallet.

getWalletAssets was used to improve form validation speed to fix hitching and lengthy delays, but it is not correct and allowed for form submissions with inactive coins, resulting in unexpected error messages
@smk762
Copy link
Copy Markdown
Collaborator

smk762 commented Oct 2, 2025

  • confirmed no such coin translation update ✔️
    APK testing so far successful
  • activation ✔️
  • taker swap selling ARRR ✔️
  • withdraw (with memo) ✔️
  • taker swap buying ARRR ✔️
  • maker swap selling ARRR (pending, first failed with old KDF taker)
  • maker swap buying ARRR (pending, first failed with old KDF taker)

Some minor UI overflows in mobile, will open separate issues for these.

Also encountered freeze/crash on android mobile during swaps. If user relaunch/login fast enough, the swap will complete. Logs offer no insight, they just stop.

@CharlVS CharlVS merged commit c91431e into dev Oct 3, 2025
9 of 15 checks passed
@CharlVS CharlVS deleted the feat/zhtlc-asset-support branch October 3, 2025 10:36
@CharlVS CharlVS linked an issue Oct 5, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request QA Ready for QA Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: ZHTLC (Pirate)

4 participants