Skip to content

decred: Run libwallet in isolate. #2077

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

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

JoeGruffins
Copy link
Contributor

Attempting to solve the problem pointed out in #2067 but this also seems to make the app more responsive. Still testing.

@JoeGruffins
Copy link
Contributor Author

Still panicking, noticing this in logcat:

03-11 09:52:56.157  1784  3466 D FreecessController: com.cakewallet.cake_wallet(state: Freezeable -> Frozen, Reason: uidIdle)
03-11 09:52:56.162  1784  3466 E FreecessController: FZ error : com.cakewallet.cake_wallet(0)
03-11 09:52:56.163  1784  3466 D FreecessController: UFZ : com.cakewallet.cake_wallet(0) because failed to freeze, success : false
03-11 09:52:56.264  1784  1914 D MARsPolicyManager: triggerAction called!
03-11 09:52:56.264  1784  1914 I NSLocationMonitor: getGPSUsingApps() called
03-11 09:52:56.274  3465  3494 I NSLocationManager_FLP: getGPSUsingApps, NO_FREEZE={5013, 10300} / FREEZE={10244}
03-11 09:52:56.309  1784  1914 E FreecessController: FZ error : com.cakewallet.cake_wallet(0)
03-11 09:52:56.311  1784  1914 D FreecessController: UFZ : com.cakewallet.cake_wallet(0) because failed to freeze, success : false

@JoeGruffins
Copy link
Contributor Author

That logcat seems to be a one off...

@MrCyjaneK
Copy link
Collaborator

MrCyjaneK commented Mar 11, 2025

@JoeGruffins that FreecessController is most likely some sort of OEM (samung?) battery optimization (nothing that we should debug). What would be helpful is to get actual stacktrace of the go calls and see what is crashing there. I was able to reproduce that issue on OnePlus 9 Pro and it crashed after resuming the app - so the bug is universal.

This change overall is good (even if it doesn't fix the issue) as FFI calls are blocking by default so calling them in isolate will improve UX and app framerate.

@JoeGruffins
Copy link
Contributor Author

@MrCyjaneK I think I found the bug and this is the fix but still testing decred/libwallet#18

The app is much more responsive with this change so I do want to get this in too if possible.

@JoeGruffins JoeGruffins force-pushed the fixthepanic branch 2 times, most recently from 29ce0d8 to f60dd7f Compare March 12, 2025 05:23
@JoeGruffins JoeGruffins marked this pull request as ready for review March 12, 2025 05:44
@JoeGruffins
Copy link
Contributor Author

Again, this does not solve the panic but seems to be a good change regardless.

@OmarHatem28 OmarHatem28 merged commit b2c1246 into cake-tech:decred-updated-main Mar 13, 2025
3 checks passed
OmarHatem28 added a commit that referenced this pull request Mar 21, 2025
* decred: Add decred. (#1322)

* multi: Add initial decred screens. (#1165)

Use a mock libwallet for now.

* cw_decred: add libdcrwallet dependency and link library for android, ios and macos (#1240)

* change cw_decred from package to plugin

* add libdcrwallet dependency and link library for android, ios and macos

* remove spvwallet, make some libdcrwallet fns async, light refactor

* libdcrwallet: use json payload returns

* use specific libwallet commit hash

* decred: fix Rename wallet.

---------

Co-authored-by: JoeGruff <[email protected]>

* decred: Add sync.

* decred: Add send transaction.

* decred: Fix fee estimation.

* decred: List transactions.

* decred: Add rescan.

* decred: Sign message.

* decred: Add new addr and addrs.

* decred: Add change wallet pass.

* decred: Add restore from seed.

* decred: Add watching only wallets.

* decred: Enable mainnet.

* decred: Allow using blank node address.

This allows a persistent peer to be unset, falling back to decred
seeders.

* decred: Rescan from wallet birthday.

* add and update macos build scripts, update build readme, gitignore macos project.pbxproj

Signed-off-by: Philemon Ukane <[email protected]>

* multi: hide decred rescan page if it's not ready

-  move hasRescan method to WalletBase and implement for decred

Signed-off-by: Philemon Ukane <[email protected]>

* cw_decred: fix bug where decred wallets are not loaded after app restart

Signed-off-by: Philemon Ukane <[email protected]>

* add buy and sell for decred via onramp

Signed-off-by: Philemon Ukane <[email protected]>

* bug-fix: account for other send outputs that are part of the same tx

Signed-off-by: Philemon Ukane <[email protected]>

* decred: Return address with no peers.

* decred: Update pubspec.

* decred: Add verify message.

* upgrade hive_generator dep in cw_decred

* decred: Clean up code.

---------

Signed-off-by: Philemon Ukane <[email protected]>
Co-authored-by: Wisdom Arerosuoghene <[email protected]>
Co-authored-by: Philemon Ukane <[email protected]>

* fix extracted addresses not used
fix conflicts with main

* remove print [skip ci]

* minor formatting

* fix initial migration version

* add build decred script to workflow

* install go before build decred
fix switch cases

* trial 2 to fix decred build

* re-install go

* revert build script change

* refactor/clean nodes functions

* Fix address book issue
Fix send ALL (to be continued with the fees point)

* Fix transactions display issues
Add missing file

* Fix unconfirmed balance not displayed
Change Wallet order
Minor cleanup

* Fix workflow

* Fix workflow

* Fix workflow

* test

* hardcode path for now

* fix + cleanup decred build script to work on mac and linux

* Update decred build script

* Run actions on pull requests, extract commit message

* run after checkout

* add safe directory

* Get commit message from base.sha instead of last commit

* base -> head

* Do not merge main branch into pr

* [skip slack] [run tests] clone by sha

* Proper name for decred library in the build script

* Throw an error when ANDROID_HOME or ANDROID_NDK_VERSION is missing

* Fix conflicts with main

* minor code enhancement

* decred: Add used address history.  (#1941)

* decred: Update pubspec.

* decred testnet

* decred: Add used address history.

* decred: Remove default node list.

* populate transaction history before sync begins

* decred: Add some awaits.

* decred: Fix send all.

* decred: Add clang export to build script.

* decred: Update logo colors.

* cleanup cw_decred.dart

* make decred wallet addresses selectable in receive page

* decred: Always set default addr when used.

* decred: Add back default node list.

* decred: Allow creating addresses manually.

---------

Co-authored-by: Wisdom Arerosuoghene <[email protected]>
Co-authored-by: Omar Hatem <[email protected]>

* minor fixes and cleanup

* minor fix, feel free to test now

* - Fix transaction details
- Fix Nodes
- Add processing sync status

* Add decred info card

* push missing file

* Add missing text for decred info card

* minor: change docs link [skip ci]

* decred: Update derivation info. (#2013)

* decred: Update derivation info.

* decred: Allow unsynced unused addresses.

* decred: Update dcrwallet dep to 4.3.0.

* Merge main and fix conflicts

* Merge main and fix conflicts

* decred: Fix background sync panic. (#2080)

* decred: Run libwallet in isolate. (#2077)

* decred: Fix contact save inquiry. (#2083)

Also fix tx time and the fee shown on pending transactions.

* Disable send button in view only decred wallets

* - Fix frozen coins
- Add URI support
- Fix fees in tx details
- Handle empty coins send
- Handle wallets in address book

* Merge main

* remove print [skip ci]

* Fix restore from QR

* minor improvement for QR restore

* minor fixes [skip ci]

* decred: Get slip44 addrs before sync completes. (#2092)

* - Fix loading wallet more than one time
- Fix minor UI issue

---------

Signed-off-by: Philemon Ukane <[email protected]>
Co-authored-by: JoeGruffins <[email protected]>
Co-authored-by: Wisdom Arerosuoghene <[email protected]>
Co-authored-by: Philemon Ukane <[email protected]>
Co-authored-by: Czarek Nakamoto <[email protected]>
OmarHatem28 added a commit that referenced this pull request Mar 21, 2025
* decred: Add decred. (#1322)

* multi: Add initial decred screens. (#1165)

Use a mock libwallet for now.

* cw_decred: add libdcrwallet dependency and link library for android, ios and macos (#1240)

* change cw_decred from package to plugin

* add libdcrwallet dependency and link library for android, ios and macos

* remove spvwallet, make some libdcrwallet fns async, light refactor

* libdcrwallet: use json payload returns

* use specific libwallet commit hash

* decred: fix Rename wallet.

---------

Co-authored-by: JoeGruff <[email protected]>

* decred: Add sync.

* decred: Add send transaction.

* decred: Fix fee estimation.

* decred: List transactions.

* decred: Add rescan.

* decred: Sign message.

* decred: Add new addr and addrs.

* decred: Add change wallet pass.

* decred: Add restore from seed.

* decred: Add watching only wallets.

* decred: Enable mainnet.

* decred: Allow using blank node address.

This allows a persistent peer to be unset, falling back to decred
seeders.

* decred: Rescan from wallet birthday.

* add and update macos build scripts, update build readme, gitignore macos project.pbxproj

Signed-off-by: Philemon Ukane <[email protected]>

* multi: hide decred rescan page if it's not ready

-  move hasRescan method to WalletBase and implement for decred

Signed-off-by: Philemon Ukane <[email protected]>

* cw_decred: fix bug where decred wallets are not loaded after app restart

Signed-off-by: Philemon Ukane <[email protected]>

* add buy and sell for decred via onramp

Signed-off-by: Philemon Ukane <[email protected]>

* bug-fix: account for other send outputs that are part of the same tx

Signed-off-by: Philemon Ukane <[email protected]>

* decred: Return address with no peers.

* decred: Update pubspec.

* decred: Add verify message.

* upgrade hive_generator dep in cw_decred

* decred: Clean up code.

---------

Signed-off-by: Philemon Ukane <[email protected]>
Co-authored-by: Wisdom Arerosuoghene <[email protected]>
Co-authored-by: Philemon Ukane <[email protected]>

* fix extracted addresses not used
fix conflicts with main

* remove print [skip ci]

* minor formatting

* fix initial migration version

* add build decred script to workflow

* install go before build decred
fix switch cases

* trial 2 to fix decred build

* re-install go

* revert build script change

* refactor/clean nodes functions

* Fix address book issue
Fix send ALL (to be continued with the fees point)

* Fix transactions display issues
Add missing file

* Fix unconfirmed balance not displayed
Change Wallet order
Minor cleanup

* Fix workflow

* Fix workflow

* Fix workflow

* test

* hardcode path for now

* fix + cleanup decred build script to work on mac and linux

* Update decred build script

* Run actions on pull requests, extract commit message

* run after checkout

* add safe directory

* Get commit message from base.sha instead of last commit

* base -> head

* Do not merge main branch into pr

* [skip slack] [run tests] clone by sha

* Proper name for decred library in the build script

* Throw an error when ANDROID_HOME or ANDROID_NDK_VERSION is missing

* Fix conflicts with main

* minor code enhancement

* decred: Add used address history.  (#1941)

* decred: Update pubspec.

* decred testnet

* decred: Add used address history.

* decred: Remove default node list.

* populate transaction history before sync begins

* decred: Add some awaits.

* decred: Fix send all.

* decred: Add clang export to build script.

* decred: Update logo colors.

* cleanup cw_decred.dart

* make decred wallet addresses selectable in receive page

* decred: Always set default addr when used.

* decred: Add back default node list.

* decred: Allow creating addresses manually.

---------

Co-authored-by: Wisdom Arerosuoghene <[email protected]>
Co-authored-by: Omar Hatem <[email protected]>

* minor fixes and cleanup

* minor fix, feel free to test now

* - Fix transaction details
- Fix Nodes
- Add processing sync status

* Add decred info card

* push missing file

* Add missing text for decred info card

* minor: change docs link [skip ci]

* decred: Update derivation info. (#2013)

* decred: Update derivation info.

* decred: Allow unsynced unused addresses.

* decred: Update dcrwallet dep to 4.3.0.

* Merge main and fix conflicts

* Merge main and fix conflicts

* decred: Fix background sync panic. (#2080)

* decred: Run libwallet in isolate. (#2077)

* decred: Fix contact save inquiry. (#2083)

Also fix tx time and the fee shown on pending transactions.

* Disable send button in view only decred wallets

* - Fix frozen coins
- Add URI support
- Fix fees in tx details
- Handle empty coins send
- Handle wallets in address book

* Merge main

* remove print [skip ci]

* Fix restore from QR

* minor improvement for QR restore

* Remove Haven Wallet

* Remove haven scripts

* minor fixes [skip ci]

* decred: Get slip44 addrs before sync completes. (#2092)

* - Fix loading wallet more than one time
- Fix minor UI issue

* fix merge issue

* fix merge issue

---------

Signed-off-by: Philemon Ukane <[email protected]>
Co-authored-by: JoeGruffins <[email protected]>
Co-authored-by: Wisdom Arerosuoghene <[email protected]>
Co-authored-by: Philemon Ukane <[email protected]>
Co-authored-by: Czarek Nakamoto <[email protected]>
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.

3 participants