massalabs / station-massa-wallet

Massa Station Wallet Module
MIT License
12 stars 8 forks source link

Select Station's network from modules, by requests from dApps #748

Open loonggamma opened 1 year ago

loonggamma commented 1 year ago

Context

  1. The need discovered during Bridge testing. User was on the Testnet network in his Station (therefore the Wallet). He didn't know it as his Wallet page was opened in browser, not Station where he can actually see the network.
    A dApp is unable to make request to switch the wallet network of Station at the moment -> to verify this by dev.
  2. DApps can usually make requests to switch the Wallet's network when connecting to dApps, or signing transactions/messages initiated by a dApp.

Example Metamask's window when Bridge requests to connect the Sepolia testnet wallet:

image

Needs:

User flow

  1. User's station is running Network 1
  2. User is connecting to a dApp that is available on Network 2
  3. To connect Massa wallet account to the dApp, user should be prompted to switch the network of his Station (wallet module).
  4. User can also change the network from his Wallet module page.

How to tbd by dev

Technical details Give the technical insights so anyone in the team can tackle the tasks - Dev

QA testing Does this task require some QA tests ? If yes, explain how to validate it

Thykof commented 1 year ago
loonggamma commented 1 year ago
  • need clarification: a signed operation for a specified network can be submitted to another network? if yes, user can sign for testnet and the operation can be submitted to mainnet

The case you mention here mustn't be allowed to happen. If user is requested to connect a wallet, or sign operation on a specific network in a DApp, the operation signature request must occur on that network in Massa wallet. It can't go though on another network.

loonggamma commented 1 year ago

@LucasF243 let's work on designs. If the need is unclear let's sync about it.

Thykof commented 1 year ago
  • need clarification: a signed operation for a specified network can be submitted to another network? if yes, user can sign for testnet and the operation can be submitted to mainnet

The case you mention here mustn't be allowed to happen. If user is requested to connect a wallet, or sign operation on a specific network in a DApp, the operation signature request must occur on that network in Massa wallet. It can't go though on another network.

The Massa blockchain doesn't have this limitation. So we must handle this limitation another way:

Solution 2 requires the wallet to submit all operation it signs. This is not the case today, but this is the direction we want to take now.