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

fix!: cache data related to token price and market data locally for GetWalletToken #21272

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

seanstrom
Copy link
Member

@seanstrom seanstrom commented Sep 16, 2024

related to: #20975
related status-go pr: status-im/status-go#5832
related status-desktop pr: status-im/status-desktop#16347
and a continuation of the "balance zero" work group

Summary

  • This PR attempts to resolve some of the issues with the mobile app displaying a balance of zero by updating status-go to cache the related token price and market data.
  • Currently the status-go can occasionally be rate-limited when making too many requests from refreshing the wallet home screen. When the requests are rate-limited

Testing notes

The main areas that should be affected is the wallet home screen, and technically some changes happened for wallet router, so it would be worth double checking that wallet transactions / estimates are still working.

Platforms

  • Android
  • iOS

Areas that maybe impacted

Functional
  • wallet home screen
  • wallet transactions / router

Steps to test

  • Open Status mobile
  • Login as a user
  • Navigate to the wallet home screen
  • Pull to refresh many times quickly (roughly 5 times under 60 seconds)
  • View the wallet balance and token balances

Before and after screenshots comparison

Before Changes

Screen.Recording.2024-09-16.at.18.29.47.mov

After Changes

Screen.Recording.2024-09-16.at.18.19.57.mov

Risk

Described potential risks and worst case scenarios.

Tick one:

  • Low risk: 2 devs MUST perform testing as specified above and attach their results as comments to this PR before merging.
  • High risk: QA team MUST perform additional testing in the specified affected areas before merging.

status: ready

@seanstrom seanstrom self-assigned this Sep 16, 2024
@seanstrom seanstrom changed the title fix!: cache data related token price and market data locally fix!: cache data related token price and market data locally for GetWalletToken Sep 16, 2024
@seanstrom seanstrom changed the title fix!: cache data related token price and market data locally for GetWalletToken fix!: cache data related to token price and market data locally for GetWalletToken Sep 16, 2024
@status-im-auto
Copy link
Member

status-im-auto commented Sep 16, 2024

Jenkins Builds

Click to see older builds (4)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 0218f1f #1 2024-09-16 16:49:06 ~5 min tests 📄log
✔️ 0218f1f #1 2024-09-16 16:50:38 ~7 min android-e2e 🤖apk 📲
✔️ 0218f1f #1 2024-09-16 16:53:15 ~9 min android 🤖apk 📲
✔️ 0218f1f #1 2024-09-16 16:59:00 ~15 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 3cf3787 #2 2024-09-20 11:41:37 ~6 min tests 📄log
✔️ 3cf3787 #2 2024-09-20 11:43:30 ~8 min android-e2e 🤖apk 📲
✔️ 3cf3787 #2 2024-09-20 11:46:52 ~11 min android 🤖apk 📲
✔️ 3cf3787 #2 2024-09-20 12:00:38 ~25 min ios 📱ipa 📲
✔️ da08fd4 #3 2024-09-24 09:18:12 ~4 min tests 📄log
✔️ da08fd4 #3 2024-09-24 09:21:30 ~7 min android-e2e 🤖apk 📲
✔️ da08fd4 #3 2024-09-24 09:21:52 ~8 min android 🤖apk 📲
✔️ da08fd4 #3 2024-09-24 09:30:37 ~16 min ios 📱ipa 📲

@seanstrom seanstrom marked this pull request as ready for review September 16, 2024 17:32
Copy link
Contributor

@ilmotta ilmotta left a comment

Choose a reason for hiding this comment

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

Nice work @seanstrom!

Linking directly with status-go PR status-im/status-go#5832

Pull to refresh many times quickly (roughly 5 times under 10 seconds)

In status-go we're caching for 60s, is there a reason the user can't pull to refresh less frequently and still benefit from caching? I'm just trying to understand the impact to users and I thought the effects would be positive even with just 2 pulls to refresh per 60s.

There's this Figma under construction by @xAlisher that will impact the behavior of pull to refresh and how we inform users about the freshness of balances and token prices https://www.figma.com/design/xLs1KYmF4e6WwRTZVJKeUK/Wallet?node-id=17025-536817&node-type=frame&t=WysUpXeljfC2aaUv-0. In future iterations about caching, we should try to align the technical implementation with this new UX once it's finalized and prioritized. cc @shivekkhurana

@seanstrom
Copy link
Member Author

Nice work @seanstrom!

ty 🙌

Linking directly with status-go PR status-im/status-go#5832

Oops I forgot to link that PR, I'll add that link to the description 🙏

Pull to refresh many times quickly (roughly 5 times under 10 seconds)

In status-go we're caching for 60s, is there a reason the user can't pull to refresh less frequently and still benefit from caching? I'm just trying to understand the impact to users and I thought the effects would be positive even with just 2 pulls to refresh per 60s.

You're absolutely right, users will benefit for the cache for the 60s. Pulling to refresh 5 times is only necessary to show the glitch when the data is not cached.

There's this Figma under construction by @xAlisher that will impact the behavior of pull to refresh and how we inform users about the freshness of balances and token prices. In future iterations about caching, we should try to align the technical implementation with this new UX once it's finalized and prioritized.

Yeah definitely agree that we should try to explain how fresh the data is to the user, and the good news is that we timestamp the data for token-pricing and market-data inside status-go, so we could eventually forward that extra context to the status-mobile client. Although, I'm not sure if we track the timestamps for each network chain.

@status-im-auto
Copy link
Member

96% of end-end tests have passed

Total executed tests: 51
Failed tests: 2
Expected to fail tests: 0
Passed tests: 49
IDs of failed tests: 702838,702850 

Failed tests (2)

Click to expand
  • Rerun failed tests

  • Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_decline, id: 702850

    Device 2: Find `Button` by `accessibility id`: `close-activity-center`
    Device 2: Tap on found: Button

    activity_center/test_activity_center.py:95: in test_activity_center_contact_request_decline
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Pending contact request is not shown on unread notification element on Activity center!
    



    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_send_check_timestamps_sender_username, id: 702838

    Device 2: Verifying that 'new message' is under today
    Device 2: Looking for a message by text: new message

    critical/chats/test_public_chat_browsing.py:363: in test_community_message_send_check_timestamps_sender_username
        self.channel_2.verify_message_is_under_today_text(new_message, self.errors, 60)
    ../views/chat_view.py:971: in verify_message_is_under_today_text
        message_element.wait_for_visibility_of_element(timeout)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: ChatElementByText by xpath:`//*[starts-with(@text,'new message')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Passed tests (49)

    Click to expand

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    2. test_add_contact_field_validation, id: 702777
    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_leave, id: 702845
    Device sessions

    2. test_community_mentions_push_notification, id: 702786
    Device sessions

    3. test_community_markdown_support, id: 702809
    Device sessions

    4. test_community_hashtag_links_to_community_channels, id: 702948
    Device sessions

    5. test_community_join_when_node_owner_offline, id: 703629
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_edit_message, id: 702855
    Device sessions

    2. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    3. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    4. test_1_1_chat_pin_messages, id: 702731
    Device sessions

    5. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    6. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    7. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    8. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:

    1. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    3. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    Class TestWalletMultipleDevice:

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

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    2. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    3. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    4. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    5. test_community_unread_messages_badge, id: 702841
    Device sessions

    6. test_community_message_delete, id: 702839
    Device sessions

    7. test_community_edit_delete_message_when_offline, id: 704615
    Device sessions

    8. test_community_one_image_send_reply, id: 702859
    Device sessions

    9. test_community_message_edit, id: 702843
    Device sessions

    10. test_community_several_images_send_reply, id: 703194
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_reactions, id: 703202
    Device sessions

    2. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    3. test_group_chat_offline_pn, id: 702808
    Device sessions

    4. test_group_chat_pin_messages, id: 702732
    Device sessions

    5. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    6. test_group_chat_mute_chat, id: 703495
    Device sessions

    Class TestActivityMultipleDevicePRTwo:

    1. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    2. test_activity_center_mentions, id: 702957
    Device sessions

    Class TestDeepLinksOneDevice:

    1. test_links_open_universal_links_from_chat, id: 704613
    Device sessions

    2. test_links_deep_links_profile, id: 702775
    Device sessions

    3. test_deep_links_communities, id: 739307
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    3. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    4. test_community_undo_delete_message, id: 702869
    Device sessions

    5. test_community_mute_community_and_channel, id: 703382
    Device sessions

    6. test_community_discovery, id: 703503
    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    Device sessions

    @VolodLytvynenko
    Copy link
    Contributor

    hi @seanstrom thank you for PR. No issues from my side. PR is ready to be merged

    @seanstrom seanstrom force-pushed the seanstrom/fix-rate-limits-for-GetWalletToken branch from 0218f1f to 3cf3787 Compare September 20, 2024 11:35
    @seanstrom
    Copy link
    Member Author

    I've updated the commit in this PR to update status-go to version v2.1.0.
    Do we want to update the status-go version in this PR, or will we do it later?
    Let me know if there's anything else to do before merging please 🙏

    cc @VolodLytvynenko

    @status-im-auto
    Copy link
    Member

    96% of end-end tests have passed

    Total executed tests: 51
    Failed tests: 2
    Expected to fail tests: 0
    Passed tests: 49
    
    IDs of failed tests: 702947,703495 
    

    Failed tests (2)

    Click to expand
  • Rerun failed tests

  • Class TestActivityMultipleDevicePR:

    1. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947

    Device 1: Find `Button` by `xpath`: `//*[@text="Cancel" or @text="CANCEL"]`
    Device 1: Tap on found: Button

    Test setup failed: activity_center/test_activity_center.py:248: in prepare_devices
        self.loop.run_until_complete(
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:52: in run_in_parallel
        returns.append(await k)
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../views/sign_in_view.py:274: in create_user
        self.chats_tab.wait_for_visibility_of_element(30)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: ChatsTab by accessibility id:`chats-stack-tab` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_mute_chat, id: 703495

    Device 2: Click until ChatMessageInput by accessibility id: chat-message-input will be presented
    Device 2: Looking for a message by text: Chat is unmuted now

    critical/chats/test_group_chat.py:520: in test_group_chat_mute_chat
        self.errors.verify_no_errors()
    base_test_case.py:192: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Text 'Muted until 00:40 today' is not shown for muted chat
    



    Device sessions

    Passed tests (49)

    Click to expand

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_leave, id: 702845
    Device sessions

    2. test_community_mentions_push_notification, id: 702786
    Device sessions

    3. test_community_markdown_support, id: 702809
    Device sessions

    4. test_community_hashtag_links_to_community_channels, id: 702948
    Device sessions

    5. test_community_join_when_node_owner_offline, id: 703629
    Device sessions

    Class TestWalletMultipleDevice:

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

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    2. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    3. test_add_contact_field_validation, id: 702777
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:

    1. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    3. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    Class TestActivityMultipleDevicePRTwo:

    1. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    2. test_activity_center_mentions, id: 702957
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_edit_message, id: 702855
    Device sessions

    2. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    3. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    4. test_1_1_chat_pin_messages, id: 702731
    Device sessions

    5. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    6. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    7. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    8. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    3. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    4. test_community_undo_delete_message, id: 702869
    Device sessions

    5. test_community_mute_community_and_channel, id: 703382
    Device sessions

    6. test_community_discovery, id: 703503
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_reactions, id: 703202
    Device sessions

    2. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    3. test_group_chat_offline_pn, id: 702808
    Device sessions

    4. test_group_chat_pin_messages, id: 702732
    Device sessions

    5. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    Class TestDeepLinksOneDevice:

    1. test_links_open_universal_links_from_chat, id: 704613
    Device sessions

    2. test_links_deep_links_profile, id: 702775
    Device sessions

    3. test_deep_links_communities, id: 739307
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    2. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    3. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    4. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    5. test_community_unread_messages_badge, id: 702841
    Device sessions

    6. test_community_message_delete, id: 702839
    Device sessions

    7. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    8. test_community_edit_delete_message_when_offline, id: 704615
    Device sessions

    9. test_community_one_image_send_reply, id: 702859
    Device sessions

    10. test_community_message_edit, id: 702843
    Device sessions

    11. test_community_several_images_send_reply, id: 703194
    Device sessions

    @status-im-auto
    Copy link
    Member

    100% of end-end tests have passed

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

    Passed tests (2)

    Click to expand

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_mute_chat, id: 703495
    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    Device sessions

    @VolodLytvynenko
    Copy link
    Contributor

    VolodLytvynenko commented Sep 23, 2024

    I've updated the commit in this PR to update status-go to version v2.1.0. Do we want to update the status-go version in this PR, or will we do it later? Let me know if there's anything else to do before merging please 🙏

    cc @VolodLytvynenko

    @seanstrom hey. thank you for the update. The PR with updated status go works well. Can be merged. Thank you!

    @seanstrom seanstrom force-pushed the seanstrom/fix-rate-limits-for-GetWalletToken branch from 3cf3787 to da08fd4 Compare September 24, 2024 09:13
    @seanstrom seanstrom merged commit 604ee33 into develop Sep 24, 2024
    6 checks passed
    @seanstrom seanstrom deleted the seanstrom/fix-rate-limits-for-GetWalletToken branch September 24, 2024 09:31
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    5 participants