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

[BUG] Wallet GUI crashes after multiple offer submissions #2455

Closed
janit opened this issue Aug 22, 2024 · 8 comments · Fixed by #2476
Closed

[BUG] Wallet GUI crashes after multiple offer submissions #2455

janit opened this issue Aug 22, 2024 · 8 comments · Fixed by #2476
Assignees
Labels
bug Something isn't working

Comments

@janit
Copy link

janit commented Aug 22, 2024

What happened?

Playing around with some cats on Dexie lead me to this situation:

image

This happened when I posted multiple offers one after another. The GUI keeps crashing on this error after restarting the app, but after a while the the issue goes away. My guess is this is a problem with the wallet not handling an error from the backend correctly.

See logs below.

Version

2.4.3

What platform are you using?

macOS

What ui mode are you using?

GUI

Relevant log output or stacktrace

Invalid value for 1: null

URL
#/dashboard/wallets/1

Stacktrace
at webpack://@chia-network/gui/src/util/createOfferForIdsToOfferBuilderData.ts:19:12 numericValue.isNaN
at webpack://@chia-network/gui/src/util/createOfferForIdsToOfferBuilderData.ts:15:38 lookupByWalletId
at webpack://@chia-network/gui/src/components/walletConnect/WalletConnectCreateOfferPreview.tsx:29:47 useMemo(
at webpack://node_modules/react-dom/cjs/react-dom.production.min.js:184:188 useLayoutEffect
at webpack://node_modules/react/cjs/react.production.min.js:25:207 useInsertionEffect
at webpack://@chia-network/gui/src/components/walletConnect/WalletConnectCreateOfferPreview.tsx:24:57 WalletConnectCreateOfferPreview
at webpack://node_modules/react-dom/cjs/react-dom.production.min.js:167:136 Xh
at webpack://node_modules/react-dom/cjs/react-dom.production.min.js:290:336 Wk
at webpack://node_modules/react-dom/cjs/react-dom.production.min.js:280:388 uj


—8<————————8<————————8<—————

.chia/mainnet/log/debug.log:

2024-08-21T21:45:58.234 wallet chia.wallet.wallet         : WARNING  TransactionRecord SpendBundle ID: b'xxx' not in mempool. (peer, included, error) list: []
2024-08-21T22:00:10.216 wallet chia.wallet.wallet_node    : WARNING  SpendBundle has been rejected by the FullNode. {'error': 'DOUBLE_SPEND', 'status': 3, 'txid': 'xxx'}
2024-08-22T05:04:15.492 wallet chia.wallet.wallet_node    : WARNING  SpendBundle has been rejected by the FullNode. {'error': 'DOUBLE_SPEND', 'status': 3, 'txid': 'xxx'}
2024-08-22T05:04:15.501 wallet chia.wallet.wallet_node    : WARNING  SpendBundle has been rejected by the FullNode. {'error': 'DOUBLE_SPEND', 'status': 3, 'txid': 'xxx'}
2024-08-22T06:26:11.464 wallet chia.wallet.cat_wallet.cat_wallet: WARNING  Can't select amount higher than our spendable balance.  Amount: 1000000000, spendable: 0
2024-08-22T06:26:11.466 wallet chia.wallet.trade_manager  : ERROR    Error creating trade offer
Traceback (most recent call last):
  File "chia/wallet/trade_manager.py", line 558, in _create_offer_for_ids
  File "chia/wallet/cat_wallet/cat_wallet.py", line 868, in get_coins_to_offer
  File "chia/wallet/cat_wallet/cat_wallet.py", line 530, in select_coins
  File "chia/wallet/coin_selection.py", line 30, in select_coins
ValueError: Can't select amount higher than our spendable balance.  Amount: 1000000000, spendable: 0
2024-08-22T06:26:11.468 wallet chia.rpc.rpc_server        : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia/rpc/rpc_server.py", line 340, in safe_handle
  File "chia/rpc/rpc_server.py", line 331, in ws_api
  File "chia/rpc/util.py", line 160, in rpc_endpoint
  File "chia/rpc/wallet_rpc_api.py", line 1874, in create_offer_for_ids
  File "chia/wallet/trade_manager.py", line 451, in create_offer_for_ids
Exception: Error creating offer: Can't select amount higher than our spendable balance.  Amount: 1000000000, spendable: 0

2024-08-22T06:26:19.535 wallet chia.wallet.cat_wallet.cat_wallet: WARNING  Can't select amount higher than our spendable balance.  Amount: 1000000000, spendable: 0
2024-08-22T06:26:19.535 wallet chia.wallet.trade_manager  : ERROR    Error creating trade offer
Traceback (most recent call last):
  File "chia/wallet/trade_manager.py", line 558, in _create_offer_for_ids
  File "chia/wallet/cat_wallet/cat_wallet.py", line 868, in get_coins_to_offer
  File "chia/wallet/cat_wallet/cat_wallet.py", line 530, in select_coins
  File "chia/wallet/coin_selection.py", line 30, in select_coins
ValueError: Can't select amount higher than our spendable balance.  Amount: 1000000000, spendable: 0
2024-08-22T06:26:19.536 wallet chia.rpc.rpc_server        : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia/rpc/rpc_server.py", line 340, in safe_handle
  File "chia/rpc/rpc_server.py", line 331, in ws_api
  File "chia/rpc/util.py", line 160, in rpc_endpoint
  File "chia/rpc/wallet_rpc_api.py", line 1874, in create_offer_for_ids
  File "chia/wallet/trade_manager.py", line 451, in create_offer_for_ids
Exception: Error creating offer: Can't select amount higher than our spendable balance.  Amount: 1000000000, spendable: 0
@janit janit added the bug Something isn't working label Aug 22, 2024
@wjblanke
Copy link
Contributor

Is there anything displayed additionally in the developer tools console? Izumi can u take a look at this, maybe there is a global or something shared between multiple submissions.

@janit
Copy link
Author

janit commented Aug 29, 2024

I haven’t had this issue repeated, so I don’t have access to the dev tools logs output.

I’ll add them to this ticket if/when the bug surfaces again.

@ChiaMineJP
Copy link
Contributor

I'm investigating the code to reproduce this issue.
If you find more hints, please let me know.

@ChiaMineJP
Copy link
Contributor

I tried to reproduce this issue by intentionally rasing an exception in create_offer_for_ids RPC API.
I activated wallet connect with the Dexie for testnet11 and repeated to create offers on Dexie but the GUI didn't crash at this time.

I'm suspecting that actually GUI crashed with successful create_offer_for_ids RPC API without an exception but the response contains unexpected offer data. (e.g. an offer with a null amount offer item)
Still continuing investigation.

image

image

@ChiaMineJP
Copy link
Contributor

Finally, I managed to reproduce this issue.
This issue happens when you forget to input amount like below

image

@ChiaMineJP
Copy link
Contributor

Fixed this issue by #2476

@janit
Copy link
Author

janit commented Sep 10, 2024

Awesome, never occurred to that my offers may have been invalid. Thank you @ChiaMineJP 💪

@wjblanke
Copy link
Contributor

Thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants