Skip to content

Fix SWBs with view-only wallets - #1273

Draft
sneurlax wants to merge 5 commits into
stagingfrom
fix/swb
Draft

sneurlax wants to merge 5 commits into
stagingfrom
fix/swb

Conversation

@sneurlax

@sneurlax sneurlax commented Mar 4, 2026

Copy link
Copy Markdown
Member

Need to repro this issue:
"""
creating a Stack Wallet Backup puts you into a softlock on Linux, where clicking "Ok" on the "Stack backup saved to:" dialog throws:

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PanicException(Unable to send event data through stream: Fail to post message to Dart. (If happen during Flutter hot restart, this may not be a problem.))
#0      SimpleDecoder.decode (package:flutter_rust_bridge/src/codec/base.dart:35)
#1      DcoCodec.decodeObject (package:flutter_rust_bridge/src/codec/dco.dart:25)
#2      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:948)
#3      Future._propagateToListeners (dart:async/future_impl.dart:977)
#4      Future._completeWithValue (dart:async/future_impl.dart:720)
#5      Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:804)
#6      _microtaskLoop (dart:async/schedule_microtask.dart:40)
#7      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

BUILD: _BackupRestoreSettings
didChangeAppLifecycleState: inactive
didChangeAppLifecycleState: resumed
Bad state: No element
#0      Iterable.lastWhere (dart:core/iterable.dart:753)
#1      NavigatorState.pop (package:flutter/src/widgets/navigator.dart:5579)
#2      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1222)
#3      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345)
#4      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758)
#5      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383)
#6      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353)
#7      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173)
#8      GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:532)
#9      GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:498)
#10     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:473)
#11     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:437)
#12     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:394)
#13     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:341)
#14     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:308)
#15     _invoke1 (dart:ui/hooks.dart:372)
#16     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:467)
#17     _dispatchPointerDataPacket (dart:ui/hooks.dart:307)
Another exception was thrown: Instance of 'DiagnosticsProperty<void>'

"""
This should be reproduced and the conditions under which it manifests described better. I stumbled across this with a view-only Monero wallet. The current change attempts to fix an underlying race condition and touches all cryptonote wallets... just need to go thru the steps on this again to 1) reproduce it, 2) confirm the specific conditions in which it can happen, 3) verify the fix is safe (touches all wallets... no bueno...) THEN decide if the SWB process really needs fixing at all

imo it does, not just for cosmetic issues (the fade is contained to the subview/main panel on the right on desktop)

@sneurlax
sneurlax changed the base branch from main to staging March 4, 2026 01:58
@codecov

codecov Bot commented May 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.84685% with 59 lines in your changes missing coverage. Please review.
✅ Project coverage is 9.70%. Comparing base (1e2e4d9) to head (17b946f).
⚠️ Report is 26 commits behind head on staging.

Files with missing lines Patch % Lines
...gs_view/stack_backup_views/create_backup_view.dart 0.00% 30 Missing ⚠️
...ck_backup_views/helpers/restore_create_backup.dart 0.00% 22 Missing ⚠️
...kup_views/helpers/swb_view_only_recovery_data.dart 85.36% 6 Missing ⚠️
lib/utilities/show_loading.dart 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #1273      +/-   ##
===========================================
+ Coverage     7.85%    9.70%   +1.84%     
===========================================
  Files         1125     1130       +5     
  Lines       112820   113590     +770     
===========================================
+ Hits          8866    11019    +2153     
+ Misses      103954   102571    -1383     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sneurlax

sneurlax commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

87eed85 in #1355 from May 26 fixes the desktop softlock aspect of this issue. But some other parts of this PR remain valid: the failure-dialog pop, showLoading closing the wrong route, the view-only backup/restore validation, and releasing the wakelock. Could retitle this re: view-only correctness?

…oute

The overlay was pushed on the root navigator but popped from the caller's
navigator, so callers inside a nested navigator (desktop) popped one of
their own pages and left the overlay up. Track the pushed route and remove
exactly that one.
Back up view-only data straight from secure storage, repair a missing
isViewOnly flag in otherData, and refuse to create or restore a backup
whose view-only data is missing, unparseable or incomplete instead of
silently producing a broken wallet.
Cancellation and errors returned or threw before WakelockPlus.disable(),
leaving the screen wakelock held after a failed or cancelled restore.
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.

1 participant