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(dapps) restoring internet connection for the Wallet Connect SDK #15816

Merged
merged 4 commits into from
Jul 31, 2024

Conversation

stefandunca
Copy link
Contributor

@stefandunca stefandunca commented Jul 25, 2024

Closes #15598, Closes #15806

HEAD fix(dapps) Wallet Connect internet connection reestablishing issue

  • Add a new NetworkChecker QObject to StatusQ to be used in checking internet connection status.
    • This is used by the WebEngineLoader to only allow loading of web pages when there is an active internet to cover for a corner case on MacOS where the internet connection is not reestablished if the WebEngineView was loaded without an active internet connection.

HEAD~1 chore(dapps) remove unused Wallet Connect authentication from the SDK

  • Also add more debug logs for unhandled events

HEAD~2 chore(dapps) update Wallet Connect SDK to latest version 1.13.0

  • Upgrade from 1.11.2 to 1.13.0

HEAD~3 chore(dapps) remove the POC wallet connect

Affected areas

Wallet Connect dapps

StatusQ checklist

Added NetworkChecker used in the WebEngineLoader component

Impact on end user

Dapps availability is restored on internet connection restore without user intervention

@status-im-auto
Copy link
Member

status-im-auto commented Jul 25, 2024

Jenkins Builds

Click to see older builds (21)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 8f99473 #1 2024-07-25 20:14:23 ~7 min tests/nim 📄log
✔️ 8f99473 #1 2024-07-25 20:18:30 ~11 min macos/aarch64 🍎dmg
✔️ 8f99473 #1 2024-07-25 20:19:56 ~12 min macos/x86_64 🍎dmg
✔️ 8f99473 #1 2024-07-25 20:20:17 ~13 min tests/ui 📄log
✔️ 8f99473 #1 2024-07-25 20:22:29 ~15 min linux-nix/x86_64 📦tgz
✔️ 8f99473 #1 2024-07-25 20:24:27 ~17 min linux/x86_64 📦tgz
✔️ 8f99473 #1 2024-07-25 20:38:26 ~31 min windows/x86_64 💿exe
✔️ 3a30386 #2 2024-07-26 13:18:55 ~8 min macos/x86_64 🍎dmg
✔️ 3a30386 #2 2024-07-26 13:22:10 ~12 min macos/aarch64 🍎dmg
✔️ 3a30386 #2 2024-07-26 13:36:43 ~26 min tests/nim 📄log
✔️ 3a30386 #2 2024-07-26 13:42:44 ~32 min windows/x86_64 💿exe
✔️ 3a30386 #2 2024-07-26 13:43:08 ~33 min linux-nix/x86_64 📦tgz
✔️ 3a30386 #2 2024-07-26 13:44:13 ~34 min linux/x86_64 📦tgz
✔️ 3a30386 #2 2024-07-26 13:45:05 ~34 min tests/ui 📄log
✔️ 9b93c82 #3 2024-07-29 14:31:51 ~4 min macos/aarch64 🍎dmg
✔️ 9b93c82 #3 2024-07-29 14:33:44 ~6 min tests/nim 📄log
9b93c82 #3 2024-07-29 14:38:52 ~11 min tests/ui 📄log
✔️ 9b93c82 #3 2024-07-29 14:40:39 ~13 min linux-nix/x86_64 📦tgz
✔️ 9b93c82 #3 2024-07-29 14:41:28 ~14 min macos/x86_64 🍎dmg
✔️ 9b93c82 #3 2024-07-29 14:44:15 ~17 min linux/x86_64 📦tgz
✔️ 9b93c82 #3 2024-07-29 14:57:58 ~30 min windows/x86_64 💿exe
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 3cca3a0 #4 2024-07-29 15:36:03 ~7 min tests/nim 📄log
✔️ 3cca3a0 #4 2024-07-29 15:37:26 ~9 min macos/aarch64 🍎dmg
✔️ 3cca3a0 #4 2024-07-29 15:39:56 ~11 min macos/x86_64 🍎dmg
3cca3a0 #4 2024-07-29 15:42:49 ~14 min tests/ui 📄log
✔️ 3cca3a0 #4 2024-07-29 15:44:01 ~15 min linux/x86_64 📦tgz
✔️ 3cca3a0 #4 2024-07-29 15:44:24 ~16 min linux-nix/x86_64 📦tgz
✔️ 3cca3a0 #4 2024-07-29 16:03:26 ~35 min windows/x86_64 💿exe
✔️ 3cca3a0 #5 2024-07-29 16:19:27 ~14 min tests/ui 📄log
✔️ fce5f41 #5 2024-07-31 08:26:48 ~6 min tests/nim 📄log
✔️ fce5f41 #5 2024-07-31 08:27:29 ~7 min macos/aarch64 🍎dmg
✔️ fce5f41 #5 2024-07-31 08:28:32 ~8 min macos/x86_64 🍎dmg
fce5f41 #6 2024-07-31 08:33:08 ~13 min tests/ui 📄log
✔️ fce5f41 #5 2024-07-31 08:33:50 ~13 min linux-nix/x86_64 📦tgz
✔️ fce5f41 #5 2024-07-31 08:35:39 ~15 min linux/x86_64 📦tgz
✔️ fce5f41 #5 2024-07-31 08:51:34 ~31 min windows/x86_64 💿exe
fce5f41 #7 2024-07-31 10:12:08 ~13 min tests/ui 📄log
✔️ fce5f41 #8 2024-07-31 10:27:44 ~12 min tests/ui 📄log

@stefandunca stefandunca force-pushed the fix_net_dropping-15598 branch 2 times, most recently from 3a30386 to 9b93c82 Compare July 29, 2024 14:26
@stefandunca stefandunca marked this pull request as ready for review July 29, 2024 14:30
@stefandunca stefandunca linked an issue Jul 29, 2024 that may be closed by this pull request
@alexjba
Copy link
Contributor

alexjba commented Jul 30, 2024

I have 2 issues I'm looking on right now on this branch. First would be that I can't disconnect a dapp. The connection was done while being offline.
The second is that the default account is not selected in the connect popup when it's opened. This one looks good on master (ignore the title. There's a different bug for this)

Screenshot 2024-07-30 at 13 07 01

@stefandunca
Copy link
Contributor Author

stefandunca commented Jul 30, 2024

... First would be that I can't disconnect a dapp. The connection was done while being offline.

I'm not sure how would this be possible. Please have a look at the WC logs in debug.

The second is that the default account is not selected in the connect popup when it's opened. This one looks good on master (ignore the title. There's a different bug for this)

I'm looking into this right now. It is intermitent. Sometime works sometime doesn't. We report undefined for the account address when it doesn't work.

@caybro
Copy link
Member

caybro commented Jul 30, 2024

... First would be that I can't disconnect a dapp. The connection was done while being offline.

I'm not sure how would this be possible. Please have a look at the WC logs in debug.

The second is that the default account is not selected in the connect popup when it's opened. This one looks good on master (ignore the title. There's a different bug for this)

I'm looking into this right now. It is intermitent. Sometime works sometime doesn't. We report undefined for the account address when it doesn't work.

I think I know why; saw this in storybook with this popup:

file:///home/ltinkl/git/status/status-desktop/ui/imports/shared/controls/AccountSelector.qml:136:9: QML Binding: Binding loop detected for property "value"

@alexjba
Copy link
Contributor

alexjba commented Jul 30, 2024

The second is that the default account is not selected in the connect popup when it's opened. This one looks good on master (ignore the title. There's a different bug for this)

@Seitseman The issue here is that we're trying to select a watch only account. So when in the left we have a watch only account selected and we open the dApp the preselected account is not working. I think this will be fixed by your current work, right?

@alexjba
Copy link
Contributor

alexjba commented Jul 30, 2024

file:///home/ltinkl/git/status/status-desktop/ui/imports/shared/controls/AccountSelector.qml:136:9: QML Binding: Binding loop detected for property "value"

hmm, maybe we should fix that! Adding a bug

Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

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

LGTM

ui/StatusQ/include/StatusQ/networkchecker.h Outdated Show resolved Hide resolved
ui/StatusQ/src/networkchecker.cpp Outdated Show resolved Hide resolved
@alexjba
Copy link
Contributor

alexjba commented Jul 30, 2024

... First would be that I can't disconnect a dapp. The connection was done while being offline.

Can't reproduce anymore and managed to disconnect one the dapp was properly connected..Was trying out different scenarios with the internet connection on and off

Copy link
Contributor

@alexjba alexjba 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! 👍
Minor concern on the NetworkChecker. I'm wondering if it wouldn't be better to rely on the peers connection to determine the connected status.

name: "Status",
description: "Status Wallet",
url: "http://localhost",
icons: ['https://avatars.githubusercontent.com/u/11767950'],
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO we should use the rounded icon. 😄 @benjthayer WDYT?

This is how it looks like

Screenshot 2024-07-30 at 15 26 26

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is what I found. However, haven't seen in production our icon displayed even though the API to retrieve it is available in the SDK.


void NetworkChecker::checkNetwork()
{
QNetworkRequest request(QUrl("http://example.com"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Quoting from the example.com...

We provide a web service on the example domain hosts to provide basic information on the purpose of the domain. These web services are provided as best effort, but are not designed to support production applications. While incidental traffic for incorrectly configured applications is expected, please do not design applications that require the example domains to have operating HTTP service.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is already this isOnline flag that's based on the number of peers. https://github.com/status-im/status-desktop/blob/master/src/app/modules/main/view.nim#L270

Wouldn't it do the trick?

Copy link
Contributor

Choose a reason for hiding this comment

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

or another idea.. The WC feature depends on the WC services, right? In this case WDYT of pinging their service instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

E.g. Windows OS API has some funcs to check if OS is online. Raymond Chen . Could we use their webservices http://www.msftconnecttest.com/connecttest.txt . If not, then in the comments to that post there are links to identical Fedora services

@Seitseman
Copy link
Contributor

The second is that the default account is not selected in the connect popup when it's opened. This one looks good on master (ignore the title. There's a different bug for this)

@Seitseman The issue here is that we're trying to select a watch only account. So when in the left we have a watch only account selected and we open the dApp the preselected account is not working. I think this will be fixed by your current work, right?

@alexjba , yes, you're right, changes to #15647 should cover discussed case.

@stefandunca
Copy link
Contributor Author

stefandunca commented Jul 30, 2024

Thanks for the review. See answers inline:

... Minor concern on the NetworkChecker. I'm wondering if it wouldn't be better to rely on the peers connection to determine the connected status.

Using connected peers would need some testing given the complexity of waku and previous reports with 0 peers that I also experienced. Therefore I don't want to condition our SDK loading by the availability of waku network.

There is already this isOnline flag that's based on the number of peers. https://github.com/status-im/status-desktop/blob/master/src/app/modules/main/view.nim#L270
Wouldn't it do the trick?

See answer above regarding using waku network for internet connection availability.

or another idea.. The WC feature depends on the WC services, right? In this case WDYT of pinging their service instead?

That is a good idea and could also work, however I don't know which is a stable endpoint to check (something that won't reject the connection in some extreme cases).

Following on your concerns I found that there are other endpoints used for this purpose that I will try http://clients3.google.com/generate_204 or https://fedoraproject.org/static/hotspot.txt

It can take up to 70 sec to receive the signal, depending on the OS timeout. In this time the user will probably have no idea of why the dapps are not working. WDYT of disabling the dapps button until the connection can be established?

That could be an improvement for later and will check with the design but for now when we need a quick fix the timeout error that appears on missing connection should be enough.

Add a new NetworkChecker QObject to StatusQ to be used in checking
internet connection status. This is used by the WebEngineLoader
to only allow loading of web pages when there is an active internet
to cover for a corner case on MacOS where the internet connection is
not reestablished if the WebEngineView was loaded without an active
internet connection.

Closes: #15598, #15806
@alexjba alexjba self-requested a review July 31, 2024 08:31
Copy link
Contributor

@alexjba alexjba left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for this! 👍

@stefandunca stefandunca merged commit 98c1890 into master Jul 31, 2024
9 checks passed
@stefandunca stefandunca deleted the fix_net_dropping-15598 branch July 31, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants