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/WC - handling lost connections in wallet connect #16580

Conversation

alexjba
Copy link
Contributor

@alexjba alexjba commented Oct 23, 2024

What does the PR do

Closes: #16180 #15636

  1. Implementing the session events whenever Status loses connection to chains
  2. Handling the integration when there is no internet connection

Not included:
2. Polished UI - needs design

WC/EIP documentation for the `connect` and `disconnect` events.

Note: This is also covered by EIP documentation https://eips.ethereum.org/EIPS/eip-1193

This event can signal the following events:

connect
The Provider emits connect when it:

first connects to a chain after being initialized.
first connects to a chain, after the disconnect event was emitted.
interface ProviderConnectInfo {
readonly chainId: string;
}
The event emits an object with a hexadecimal string chainId per the eth_chainId Ethereum RPC method, and other properties as determined by the Provider.

disconnect
The Provider emits disconnect when it becomes disconnected from all chains.
This event emits a ProviderRpcError. The error code follows the table of CloseEvent status codes.

In the new flow there are 2 main components involved

  • ui/app/AppLayouts/Wallet/helpers/ChainsAvailibilityWatchdog.qml. Component watching the chains availability and network availability
  • ui/app/AppLayouts/Wallet/services/dapps/plugins/ChainsSupervisorPlugin.qml. Component reacting on chains availability changes by sending the appropriate events to the sdk.

Commits:

  • 000d3c5 - A small fix in nim to optimise the qml signals whenever a chain online state changes. Here we've had a QObject exposed from nim with properties like blockedNetworks. The changed event on the exposed QObject was being sent when the underlying data might or might not have been changed. This was not needed as the underlying property emits proper signals.

  • 3028034 - Exposing emitSessionEvent to qml

  • b552f24 - Add an option to fully disable any button that triggers a WC interaction from the UI

  • 16fc962 - Adding the ChainsAvailibilityWatchdog.qml and ChainsSupervisorPlugin.qml components to handle the network or chain connection loss. These events will send the connect, disconnect session events to WC when needed.

Affected areas

WalletConnect

Architecture compliance

Screenshot of functionality (including design for comparison)

Screen.Recording.2024-10-23.at.16.19.09.mov
Screen.Recording.2024-10-23.at.16.21.06.mov
  • I've checked the design and this PR matches it

There is no need to emit `changed` event for the QObject exposed from nim if only the underlying data changes.
…s SDK

This commit exposes the `emitSessionEvent` function to qml
…able

+ Disable the `Connect` button after the first request
@alexjba alexjba requested review from micieslak, a team and caybro as code owners October 23, 2024 13:44
@alexjba alexjba requested review from Cuteivist and saledjenic and removed request for a team October 23, 2024 13:44
@status-im-auto
Copy link
Member

status-im-auto commented Oct 23, 2024

Jenkins Builds

Click to see older builds (21)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 4b6b0cc #1 2024-10-23 13:51:10 ~6 min tests/nim 📄log
✔️ 4b6b0cc #1 2024-10-23 13:53:48 ~9 min macos/aarch64 🍎dmg
✔️ 4b6b0cc #1 2024-10-23 13:56:51 ~12 min tests/ui 📄log
✔️ 4b6b0cc #1 2024-10-23 13:59:20 ~14 min macos/x86_64 🍎dmg
✔️ 4b6b0cc #1 2024-10-23 14:01:46 ~17 min linux-nix/x86_64 📦tgz
✔️ 4b6b0cc #1 2024-10-23 14:06:20 ~21 min linux/x86_64 📦tgz
✔️ 4b6b0cc #1 2024-10-23 14:06:59 ~22 min windows/x86_64 💿exe
✔️ fb0fe93 #2 2024-10-23 15:03:26 ~6 min macos/aarch64 🍎dmg
✔️ fb0fe93 #2 2024-10-23 15:03:32 ~6 min tests/nim 📄log
✔️ fb0fe93 #2 2024-10-23 15:09:38 ~12 min tests/ui 📄log
✔️ fb0fe93 #2 2024-10-23 15:10:42 ~13 min macos/x86_64 🍎dmg
✔️ fb0fe93 #2 2024-10-23 15:16:30 ~19 min windows/x86_64 💿exe
✔️ fb0fe93 #2 2024-10-23 15:17:42 ~20 min linux/x86_64 📦tgz
✔️ fb0fe93 #2 2024-10-23 15:18:29 ~21 min linux-nix/x86_64 📦tgz
✔️ 8163e95 #3 2024-10-24 09:05:59 ~7 min macos/aarch64 🍎dmg
✔️ 8163e95 #3 2024-10-24 09:06:40 ~8 min tests/nim 📄log
8163e95 #3 2024-10-24 09:10:51 ~12 min tests/ui 📄log
✔️ 8163e95 #3 2024-10-24 09:11:19 ~12 min macos/x86_64 🍎dmg
✔️ 8163e95 #3 2024-10-24 09:17:26 ~18 min linux-nix/x86_64 📦tgz
✔️ 8163e95 #3 2024-10-24 09:18:51 ~20 min windows/x86_64 💿exe
✔️ 8163e95 #3 2024-10-24 09:19:39 ~21 min linux/x86_64 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 2378e3b #4 2024-10-25 10:53:46 ~6 min macos/aarch64 🍎dmg
✔️ 2378e3b #4 2024-10-25 10:54:05 ~6 min tests/nim 📄log
✔️ 2378e3b #4 2024-10-25 10:59:01 ~11 min tests/ui 📄log
✔️ 2378e3b #4 2024-10-25 10:59:36 ~12 min macos/x86_64 🍎dmg
✔️ 2378e3b #4 2024-10-25 11:06:11 ~18 min windows/x86_64 💿exe
✔️ 2378e3b #4 2024-10-25 11:06:23 ~19 min linux-nix/x86_64 📦tgz
✔️ 2378e3b #4 2024-10-25 11:08:22 ~21 min linux/x86_64 📦tgz
✔️ 2f26b43 #5 2024-10-25 11:18:09 ~5 min macos/aarch64 🍎dmg
✔️ 2f26b43 #5 2024-10-25 11:19:12 ~6 min tests/nim 📄log
✔️ 2f26b43 #5 2024-10-25 11:23:24 ~11 min macos/x86_64 🍎dmg
✔️ 2f26b43 #5 2024-10-25 11:24:34 ~12 min tests/ui 📄log
✔️ 2f26b43 #5 2024-10-25 11:30:27 ~18 min linux-nix/x86_64 📦tgz
✔️ 2f26b43 #5 2024-10-25 11:30:38 ~18 min windows/x86_64 💿exe
✔️ 2f26b43 #5 2024-10-25 11:33:17 ~21 min linux/x86_64 📦tgz

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 in general

@alexjba alexjba force-pushed the fix/WC-handling-lost-connections branch from 4b6b0cc to fb0fe93 Compare October 23, 2024 14:56
This commits implements the `connect` `disconnect` session events for WC and also disables primary buttons for WC whenever there is no connection to internet or chains.

+ update tests
…isorPlugin

+ move other tests from the wrong folder
@alexjba alexjba force-pushed the fix/WC-handling-lost-connections branch from fb0fe93 to 8163e95 Compare October 24, 2024 08:58
@alexjba
Copy link
Contributor Author

alexjba commented Oct 24, 2024

Added qml tests as well

@alexjba
Copy link
Contributor Author

alexjba commented Oct 24, 2024

Added qml tests as well

These QML tests are totally broken on linux 5.15.2. Or maybe it's just the CI configuration as I see some SSL warnings on the failing tests

@alexjba
Copy link
Contributor Author

alexjba commented Oct 24, 2024

Works on Mac with 5.15.2. Must be something else

@caybro
Copy link
Member

caybro commented Oct 24, 2024

Works on Mac with 5.15.2. Must be something else

The ui-tests failures seem legit:
image

@alexjba
Copy link
Contributor Author

alexjba commented Oct 25, 2024

Works on Mac with 5.15.2. Must be something else

The ui-tests failures seem legit: image

Yes, it's a linux 5.15.2 thing..Looking into it

@alexjba
Copy link
Contributor Author

alexjba commented Oct 25, 2024

It can't find the openSSL dependency. It works on a local linux when the openssl libs are provided in the LD_LIBRARY_PATH

@alexjba alexjba force-pushed the fix/WC-handling-lost-connections branch from 2378e3b to 2f26b43 Compare October 25, 2024 11:12
@status-im-auto
Copy link
Member

✔️ status-desktop/prs/linux/x86_64/tests-nim/PR-16580#5 🔹 ~6 min 57 sec 🔹 2f26b43 🔹 📦 tests/nim package

@alexjba alexjba merged commit dbda82f into 14996-add-siwe-to-sign-in-via-wallet-connect Nov 7, 2024
9 checks passed
@alexjba alexjba deleted the fix/WC-handling-lost-connections branch November 7, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants