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

[#21483] fix: update collectible amounts after sending #21867

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

mohsen-ghafouri
Copy link
Contributor

@mohsen-ghafouri mohsen-ghafouri commented Dec 25, 2024

fixes #21483

Summary

Multicollectible amount is not updated after transaction until relogin

Areas that maybe impacted

  • Send collectible

Steps to test

  1. Send multicollectible from Account A to internal Account B
  2. See if collectible amount has been updated after pull to refresh

Note for Test

As you can see in the video, receiving the updated balance may take some time (in my case, approximately 50 seconds). Once a signal confirming the ownership transfer is received, the balance will be updated accordingly

Result

Simulator.Screen.Recording.-.iPhone.13.-.2025-01-07.at.21.38.45.mp4

status: ready

@mohsen-ghafouri mohsen-ghafouri self-assigned this Dec 25, 2024
@status-im-auto
Copy link
Member

status-im-auto commented Dec 25, 2024

Jenkins Builds

Click to see older builds (40)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ ddde37e #1 2024-12-25 10:46:29 ~5 min tests 📄log
✔️ ddde37e #1 2024-12-25 10:47:51 ~6 min ios 📱ipa 📲
✔️ ddde37e #1 2024-12-25 10:50:16 ~9 min android-e2e 🤖apk 📲
✔️ ddde37e #1 2024-12-25 10:50:45 ~9 min android 🤖apk 📲
✔️ c1cb39d #2 2025-01-07 15:32:33 ~4 min tests 📄log
✔️ c1cb39d #2 2025-01-07 15:34:43 ~7 min ios 📱ipa 📲
✔️ c1cb39d #2 2025-01-07 15:36:26 ~8 min android-e2e 🤖apk 📲
✔️ c1cb39d #2 2025-01-07 15:36:53 ~9 min android 🤖apk 📲
✔️ 8bcdc45 #4 2025-01-07 18:49:14 ~5 min tests 📄log
✔️ 8bcdc45 #4 2025-01-07 18:51:49 ~7 min ios 📱ipa 📲
✔️ 8bcdc45 #4 2025-01-07 18:52:42 ~8 min android-e2e 🤖apk 📲
✔️ 8bcdc45 #4 2025-01-07 18:53:16 ~9 min android 🤖apk 📲
b321c72 #5 2025-01-08 09:02:21 ~3 min tests 📄log
✔️ b321c72 #5 2025-01-08 09:05:48 ~6 min ios 📱ipa 📲
✔️ b321c72 #5 2025-01-08 09:07:45 ~8 min android-e2e 🤖apk 📲
✔️ b321c72 #5 2025-01-08 09:08:13 ~9 min android 🤖apk 📲
✔️ 1bac99f #6 2025-01-08 09:31:13 ~4 min tests 📄log
✔️ 1bac99f #6 2025-01-08 09:34:18 ~7 min ios 📱ipa 📲
✔️ 1bac99f #6 2025-01-08 09:35:15 ~8 min android-e2e 🤖apk 📲
✔️ 1bac99f #6 2025-01-08 09:35:46 ~9 min android 🤖apk 📲
✔️ 466083d #7 2025-02-03 12:07:09 ~5 min tests 📄log
✔️ 466083d #7 2025-02-03 12:11:21 ~9 min android-e2e 🤖apk 📲
✔️ 466083d #7 2025-02-03 12:13:32 ~11 min android 🤖apk 📲
✔️ 466083d #7 2025-02-03 12:15:07 ~13 min ios 📱ipa 📲
✔️ a3e5655 #8 2025-02-04 16:40:29 ~4 min tests 📄log
✔️ a3e5655 #8 2025-02-04 16:43:17 ~7 min android-e2e 🤖apk 📲
✔️ a3e5655 #8 2025-02-04 16:44:15 ~8 min android 🤖apk 📲
✔️ a3e5655 #8 2025-02-04 16:47:20 ~11 min ios 📱ipa 📲
✔️ a364057 #9 2025-02-05 15:57:40 ~4 min tests 📄log
✔️ a364057 #9 2025-02-05 16:01:48 ~9 min android-e2e 🤖apk 📲
✔️ a364057 #9 2025-02-05 16:02:08 ~9 min android 🤖apk 📲
✔️ a364057 #9 2025-02-05 16:04:13 ~11 min ios 📱ipa 📲
3f448b8 #10 2025-02-05 17:47:43 ~2 min tests 📄log
✔️ 3f448b8 #10 2025-02-05 17:52:57 ~8 min android-e2e 🤖apk 📲
✔️ 3f448b8 #10 2025-02-05 17:53:37 ~8 min android 🤖apk 📲
✔️ 3f448b8 #10 2025-02-05 17:55:39 ~10 min ios 📱ipa 📲
✔️ 80083b1 #11 2025-02-05 20:30:17 ~4 min tests 📄log
✔️ 80083b1 #11 2025-02-05 20:34:31 ~9 min android-e2e 🤖apk 📲
✔️ 80083b1 #11 2025-02-05 20:34:55 ~9 min android 🤖apk 📲
✔️ 80083b1 #11 2025-02-05 20:36:14 ~10 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ e3fd46d #12 2025-02-06 10:24:12 ~4 min tests 📄log
✔️ e3fd46d #12 2025-02-06 10:28:08 ~8 min android-e2e 🤖apk 📲
✔️ e3fd46d #12 2025-02-06 10:28:40 ~9 min android 🤖apk 📲
✔️ e3fd46d #12 2025-02-06 10:30:55 ~11 min ios 📱ipa 📲
✔️ 38fbbd1 #13 2025-02-11 12:45:04 ~5 min tests 📄log
✔️ 38fbbd1 #13 2025-02-11 12:47:02 ~7 min android 🤖apk 📲
✔️ 38fbbd1 #13 2025-02-11 12:48:41 ~9 min android-e2e 🤖apk 📲
✔️ 38fbbd1 #13 2025-02-11 12:50:54 ~11 min ios 📱ipa 📲

@mohsen-ghafouri mohsen-ghafouri force-pushed the fix/collectible-amount-update branch from ddde37e to c1cb39d Compare January 7, 2025 15:27
@shivekkhurana shivekkhurana added the wallet-core Issues for mobile wallet team label Jan 7, 2025
@mohsen-ghafouri mohsen-ghafouri force-pushed the fix/collectible-amount-update branch 4 times, most recently from b321c72 to 1bac99f Compare January 8, 2025 09:26
@mohsen-ghafouri mohsen-ghafouri marked this pull request as ready for review January 8, 2025 09:44
@shivekkhurana shivekkhurana added wallet-core Issues for mobile wallet team and removed wallet-core Issues for mobile wallet team labels Jan 29, 2025
@churik
Copy link
Member

churik commented Jan 30, 2025

Thank you for work!
@mohsen-ghafouri can we resolve conflicts here?

@mohsen-ghafouri
Copy link
Contributor Author

Hi @churik, I will do it today

@mohsen-ghafouri mohsen-ghafouri force-pushed the fix/collectible-amount-update branch 2 times, most recently from 466083d to a3e5655 Compare February 4, 2025 16:35
@mohsen-ghafouri
Copy link
Contributor Author

@smohamedjavid could you please review when you can?

@mohsen-ghafouri mohsen-ghafouri force-pushed the fix/collectible-amount-update branch from a3e5655 to a364057 Compare February 5, 2025 15:52
Copy link
Member

@smohamedjavid smohamedjavid left a comment

Choose a reason for hiding this comment

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

Looks good overall. Just some minor comments.

src/status_im/contexts/wallet/collectible/utils.cljs Outdated Show resolved Hide resolved
Comment on lines 399 to +406
:wallet/build-transaction-for-collectible-route
(fn [{:keys [db]}]
(let [last-request-uuid (get-in db [:wallet :ui :send :last-request-uuid])]
{:db (update-in db [:wallet :ui :send] dissoc :transaction-for-signing)
(let [last-request-uuid (get-in db [:wallet :ui :send :last-request-uuid])
collectible-unique-id (get-in db [:wallet :ui :send :collectible :unique-id])]
{:db (->
db
(update-in [:wallet :ui :send] dissoc :transaction-for-signing)
(assoc-in [:wallet :ui :collectibles :pending collectible-unique-id] true))
Copy link
Member

Choose a reason for hiding this comment

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

IMO wallet/transaction-success or wallet/transactions-sent-signal-received would be a better place to add this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smohamedjavid i wanted to add it in better place but as we do cleanup after closing the modal, we don't have access to this data after that. here it was the only option IMO.

Copy link
Member

Choose a reason for hiding this comment

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

If I'm not mistaken, the transaction clean-up events are dispatched inside the wallet/transaction-success event. We could get this same information on that event and update the app-db.

One other reason to move this assoc-in to one of those events is that we build the transaction as soon as the user is on the TX confirmation/summary screen. If the user somehow decides to leave the flow, then this app-db update is misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can see :wallet/clean-selected-collectible being called in places like closing the send view or selecting another account. IMO, storing the pending collectible here carries less risk, and since we store very light data in the pending section, any misleadings wouldn’t cause critical issues. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I'm sorry. The word misleading misleads 😅 . I meant to say that updating the app-db even before the transaction is placed is overhead, as this update is done when the user goes to the TX summary/confirmation screen, and the user can go back to wallet home from there (w/o submitting the TX). So, the app-db update without the actual transaction getting placed is something we can avoid.

I agree that the :wallet/clean-selected-collectible event is called as part of page (TX flow screens) unmounts. But, the TX flow screen is dismissed in wallet/end-transaction-flow event, which is dispatched part of wallet/transaction-success event where we will have access to collectible sent. That's why I was suggesting that place. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smohamedjavid :wallet/clean-selected-collectible it's not only called in TX flow screen, it can be called from other places, please check the usage, it triggers if user close some views (like select asset view, send from view, etc).
so having some no really pending transaction in app-db has less burden than missing an update IMO. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My point is if user while waiting to get transaction-success event, try to navigate around and it will cause that collectible data being missed.

Copy link
Member

Choose a reason for hiding this comment

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

so having some no really pending transaction in app-db has less burden than missing an update IMO. wdyt?

I was concerned if the user leaves the send flow without placing the TX. Then, this will trigger fetching that particular collectible data by ID, which we will update the app-db (in the accounts collectible list and the detailed collectible data for the detail screen) with the same data. It's fine, we will explore this later to make it efficient.

My point is if user while waiting to get transaction-success event, try to navigate around and it will cause that collectible data being missed.

I agree. It's something we should not allow until we get the TX response (success/failed).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes i agree, this is not the perfect solution but the only workaround i found for now. we can definitely improve it. thank for all your feedbacks 🙏

@mohsen-ghafouri
Copy link
Contributor Author

@briansztamfater @smohamedjavid Could you please check it again?

@mohsen-ghafouri mohsen-ghafouri requested a review from alwx February 10, 2025 09:00
Comment on lines 399 to +406
:wallet/build-transaction-for-collectible-route
(fn [{:keys [db]}]
(let [last-request-uuid (get-in db [:wallet :ui :send :last-request-uuid])]
{:db (update-in db [:wallet :ui :send] dissoc :transaction-for-signing)
(let [last-request-uuid (get-in db [:wallet :ui :send :last-request-uuid])
collectible-unique-id (get-in db [:wallet :ui :send :collectible :unique-id])]
{:db (->
db
(update-in [:wallet :ui :send] dissoc :transaction-for-signing)
(assoc-in [:wallet :ui :collectibles :pending collectible-unique-id] true))
Copy link
Member

Choose a reason for hiding this comment

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

so having some no really pending transaction in app-db has less burden than missing an update IMO. wdyt?

I was concerned if the user leaves the send flow without placing the TX. Then, this will trigger fetching that particular collectible data by ID, which we will update the app-db (in the accounts collectible list and the detailed collectible data for the detail screen) with the same data. It's fine, we will explore this later to make it efficient.

My point is if user while waiting to get transaction-success event, try to navigate around and it will cause that collectible data being missed.

I agree. It's something we should not allow until we get the TX response (success/failed).

@status-im-auto
Copy link
Member

100% of end-end tests have passed

Total executed tests: 11
Failed tests: 0
Expected to fail tests: 0
Passed tests: 11

Passed tests (11)

Click to expand

Class TestCommunityMultipleDeviceMerged:

1. test_community_message_edit, id: 702843
Device sessions

Class TestOneToOneChatMultipleSharedDevicesNewUi:

1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
Device sessions

Class TestWalletOneDevice:

1. test_wallet_add_remove_regular_account, id: 727231
2. test_wallet_swap_flow_mainnet, id: 741555
3. test_wallet_balance_mainnet, id: 740490
4. test_wallet_bridge_flow_mainnet, id: 741612
5. test_wallet_send_flow_mainnet, id: 741554

Class TestWalletMultipleDevice:

1. test_wallet_send_asset_from_drawer, id: 727230
2. test_wallet_send_eth, id: 727229

Class TestCommunityOneDeviceMerged:

1. test_restore_multiaccount_with_waku_backup_remove_profile_switch, id: 703133
Device sessions

2. test_community_copy_and_paste_message_in_chat_input, id: 702742
Device sessions

@VolodLytvynenko VolodLytvynenko self-assigned this Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request-manual-qa wallet-core Issues for mobile wallet team
Projects
Status: IN TESTING
Development

Successfully merging this pull request may close these issues.

Multicollectible amount is not updated after transaction until relogin
7 participants