status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
303 stars 79 forks source link

Wallet Connect - SIWE authentication only shows Mainnet when dApp to connect is using Optimism #16746

Closed virginiabalducci closed 1 week ago

virginiabalducci commented 2 weeks ago

Bug Report

Description

The SIWE Sign Request only shows Mainnet as the Network, even if the URI has set a different network

Steps to reproduce

  1. Go to https://appkit-lab.reown.com/library/ethers-siwe/
  2. Choose network Optimism
  3. Copy the Wallet Connect link
  4. In the Deskop App, go to Wallet, dApps, Wallet Connect and copy the URI link
  5. On the 'Connection request' pop up, cick on 'Connect'

Expected behavior

SIWE Sign request on the desktop app to have the correct Network selected (Optimism)

Actual behavior

SIWE Sign request on the desktop app shows Mainnet as the network selected instead of Optimism.

Image

Image

Image

Console log app_20241111_145345.log

Additional Information

cc @alexjba for visibility

virginiabalducci commented 2 weeks ago

Editing again, the connection is established correctly but it seems to still show Mainnet instead of Optimism. Mainnet and Arbitrum work good. Image

https://github.com/user-attachments/assets/4e7e61d7-9f7e-48e0-ba4d-4f62b1f0ac74

alexjba commented 1 week ago

@virginiabalducci Not sure it's expected, but this is how the dApp is implemented. I think there's a bug on their end. What we receive is a SIWE message and the list of chains ("eip155:1\",\"eip155:10\",\"eip155:137\",\"eip155:324\",\"eip155:42161\",\"eip155:8453\",\"eip155:84532\",\"eip155:1301\",\"eip155:11155111\",\"eip155:100\",\"eip155:295\",\"eip155:1313161554\"). Even though the dApp is configured on Optimism the SIWE can be established on any supported chain. Now from these chains we pick the chains we support to configure the session, but we sign only the first dApp choice (this time is Mainnet due to dApp message config). The signing is chain agnostic and the purpose of this is just to prove the account ownership. So from this perspective it doesn't really matter the chain we sign with.

The second part where the sign typed data sends Mainnet instead on Optimism is a bug in the dApp. If the dApp is configured to work with Optimism it should request the signing on Optimism. You'll see that it works fine if you'll switch chains after establishing the session.

alexjba commented 1 week ago

Just tested with the WC test wallet (https://react-web3wallet.vercel.app/walletconnect). Has the same behavior.

virginiabalducci commented 1 week ago

Since this is something coming from the dApp side, closing this issue as working as expected