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

Only show the Wallet Connect requests for the logged in user #20815

Merged
merged 4 commits into from
Jul 22, 2024
Merged

Conversation

alwx
Copy link
Contributor

@alwx alwx commented Jul 19, 2024

fixes #20155
fixes #20800 (but that needs verification from QA)

The issue was the incorrect filtering of sessions that we get from Wallet Connect SDK.

Platforms

  • Android
  • iOS

status: ready

@alwx alwx self-assigned this Jul 19, 2024
@status-im-auto
Copy link
Member

status-im-auto commented Jul 19, 2024

Jenkins Builds

Click to see older builds (4)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 7b670e8 #2 2024-07-19 08:41:46 ~7 min tests 📄log
✔️ 7b670e8 #2 2024-07-19 08:42:05 ~8 min android-e2e 🤖apk 📲
✔️ 7b670e8 #2 2024-07-19 08:43:55 ~10 min android 🤖apk 📲
✔️ 7b670e8 #2 2024-07-19 08:47:33 ~13 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 5a8f023 #3 2024-07-19 11:24:17 ~4 min tests 📄log
✔️ 5a8f023 #3 2024-07-19 11:25:53 ~6 min android-e2e 🤖apk 📲
✔️ 5a8f023 #3 2024-07-19 11:27:06 ~7 min android 🤖apk 📲
✔️ 5a8f023 #3 2024-07-19 11:29:20 ~9 min ios 📱ipa 📲
✔️ ef90f29 #4 2024-07-22 12:36:05 ~4 min tests 📄log
✔️ ef90f29 #4 2024-07-22 12:40:16 ~9 min android-e2e 🤖apk 📲
✔️ ef90f29 #4 2024-07-22 12:41:04 ~9 min android 🤖apk 📲
✔️ ef90f29 #4 2024-07-22 12:42:10 ~11 min ios 📱ipa 📲

@shivekkhurana
Copy link
Contributor

How will this play with my PR that filter's sessions based on testnet or mainnet mode ?
https://github.com/status-im/status-mobile/pull/20799/files

@alwx
Copy link
Contributor Author

alwx commented Jul 19, 2024

@shivekkhurana it has nothing to do with that, it's only about the issue that is described in #20155 where you might observe getting requests that are for another user.

Copy link
Member

@clauxx clauxx left a comment

Choose a reason for hiding this comment

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

didn't test, but looks good.

Comment on lines +120 to +134
(defn filter-operable-accounts
[accounts]
(filter #(and (:operable? %)
(not (:watch-only? %)))
accounts))

(defn filter-sessions-for-account-addresses
[account-addresses sessions]
(filter (fn [{:keys [accounts]}]
(some (fn [account]
(some (fn [account-address]
(clojure.string/includes? account account-address))
account-addresses))
accounts))
sessions))
Copy link
Member

Choose a reason for hiding this comment

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

are these helpers available elsewhere as well? Like in a sub or smth. Could be extracted into a helper maybe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's more like a function designed to help with processing sessions we've just got from SDK, that's why it's not a sub.
But isn't it already like a helper? I moved it to here because it can potentially be useful in other places as well.

Copy link
Member

Choose a reason for hiding this comment

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

ah no, I though you copied it from a sub or smth and this logic exists elsewhere as well. If that's not the case, then it's all good!

@status-im-auto
Copy link
Member

86% of end-end tests have passed

Total executed tests: 7
Failed tests: 0
Expected to fail tests: 1
Passed tests: 6
IDs of expected to fail tests: 727232 

Expected to fail tests (1)

Click to expand

Class TestWalletOneDevice:

1. test_wallet_add_remove_watch_only_account, id: 727232

Device 1: Find `EditBox` by `accessibility id`: `add-address-to-watch`
Device 1: Type `0x8d2413447ff297d30bdc475f6d5cb00254685aae` to `EditBox`

critical/test_wallet.py:249: in test_wallet_add_remove_watch_only_account
    self.wallet_view.add_watch_only_account(address=address_to_watch, account_name=new_account_name)
../views/wallet_view.py:163: in add_watch_only_account
    self.account_has_activity_label.wait_for_visibility_of_element()
../views/base_element.py:147: in wait_for_visibility_of_element
    raise TimeoutException(
 Device 1: Text by accessibility id:`account-has-activity` is not found on the screen after wait_for_visibility_of_element 

[[Missing networks in account address, https://github.com//issues/20166]]

Device sessions

Passed tests (6)

Click to expand

Class TestWalletOneDevice:

1. test_wallet_add_remove_regular_account, id: 727231
Device sessions

Class TestOneToOneChatMultipleSharedDevicesNewUi:

1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
Device sessions

Class TestCommunityOneDeviceMerged:

1. test_community_copy_and_paste_message_in_chat_input, id: 702742
Device sessions

2. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
Device sessions

Class TestWalletMultipleDevice:

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

@@ -127,3 +127,19 @@
:url (get-in session [:peer :metadata :url])
:accounts (get-in session [:namespaces :eip155 :accounts])
:disconnected false})

(defn filter-operable-accounts
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a good idea to keep this logic somewhere it can be reused. There's this function status-im.contexts.communities.utils/sorted-operable-non-watch-only-accounts that could reuse it for example. Maybe a good place to move it is in wallet.data-store?

@pavloburykh pavloburykh self-assigned this Jul 22, 2024
@pavloburykh
Copy link
Contributor

@alwx thanks for the fix. Tested and ready for merge.

@alwx alwx merged commit d623cc8 into develop Jul 22, 2024
6 checks passed
@alwx alwx deleted the bugfix/20155 branch July 22, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: DONE
6 participants