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

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

Open
2 tasks
loonggamma opened this issue Sep 19, 2023 · 4 comments
Open
2 tasks

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

loonggamma opened this issue Sep 19, 2023 · 4 comments
Labels
enhancement New feature or request meta issue

Comments

@loonggamma
Copy link
Contributor

loonggamma commented Sep 19, 2023

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:

  • To avoid user confusion with selected network of the Station, therefore his Wallet, the selected network should be always displayed on the module pages. This applies to:

  • Wallet module pages

  • 'Sign' pop up windows

  • DApps (such as Bridge, Dusa, etc.) should be able to request the change of network to Wallet.
    Here is to be discussed about the change of network to whole Station, or to allow modules to run different version (which I am not sure it's possible). cc @gregLibert @peterjah

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
Copy link
Contributor

Thykof commented Sep 19, 2023

  • problem: Station API allow anyone to switch network, user isn't notified, no confirmation asked
  • 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
  • in the context of write operation, does Station is the right place to handle the property "network"? Shouldn't be the wallet that handle that? If wallet handle network, we can easily ask user confirmation (wails) for changing the network.

@loonggamma
Copy link
Contributor Author

loonggamma commented Sep 19, 2023

  • 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
Copy link
Contributor Author

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

@Thykof
Copy link
Contributor

Thykof commented Sep 22, 2023

  • 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:

    1. prevention: recommend to user to use an account only for a dedicated network (account: thykof_buildnet, thykof_mainnet)
    1. restrict the use of an account to a dedicated network on wallet side: when creating a new account in the wallet plugin, user chose for which network this account will be use and wallet will ensure that.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request meta issue
Projects
None yet
Development

No branches or pull requests

2 participants