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

Metamask doesn't work with ganache with typed message #8385

Closed
shahafn opened this issue Apr 22, 2020 · 8 comments · Fixed by #9552
Closed

Metamask doesn't work with ganache with typed message #8385

shahafn opened this issue Apr 22, 2020 · 8 comments · Fixed by #9552
Labels
area-provider Relating to the provider module. type-bug

Comments

@shahafn
Copy link

shahafn commented Apr 22, 2020

NetworkId is compared to chainId in typed-message-manager.

See

chainId && assert.equal(chainId, activeChainId, `Provided chainId (${chainId}) must match the active chainId (${activeChainId})`)

and
this.setNetworkState(network, type)

network is set to be the result of the rpc method "net_version" i.e. networkId, and it is compared to chainId, which on ganache-cli aren't the same.

Edit: The bottom line is that if chainId is provided in the message, Metamask will always throw on Ganache.

@kumavis kumavis added area-provider Relating to the provider module. type-bug labels Apr 23, 2020
@shahafn
Copy link
Author

shahafn commented May 15, 2020

Is there any update on it @kumavis ?
It's currently impossible to work with Ganache with MM and typed message, without intentionally inserting a bug that would pass network id as chain id.

@forshtat
Copy link

@kumavis is anyone here?

@shahafn shahafn changed the title NetworkId is compared to chainId in typed-message-manager Metamask doesn't work with ganache with typed message Sep 6, 2020
drortirosh added a commit to opengsn/gsn that referenced this issue Sep 6, 2020
due to a BUG in metamask
(MetaMask/metamask-extension#8385), it can't
work with any network where
chainId != networkid

Alas, due to a BUG in ganache
(trufflesuite/ganache#515), the chaind is
completely broken.

The solution is using local GETH for tests, and setting the networkid to
the same value of chainid...

use "gsn-with-geth" to bring up a local geth (using docker) on port
8545, and GSN running on top of it.

for completeness, we also have "gsn-with-ganache" - which works fine,
but you can't use it with metamask...
@drortirosh
Copy link

Note that this bug means that getTypedData() method can't be used on network where chainid!=networkid - most notably is local testing on geth/ganache - but also Ethereum Classic

drortirosh added a commit to opengsn/gsn that referenced this issue Sep 23, 2020
due to a BUG in metamask
(MetaMask/metamask-extension#8385), it can't
work with any network where
chainId != networkid

Alas, due to a BUG in ganache
(trufflesuite/ganache#515), the chaind is
completely broken.

The solution is using local GETH for tests, and setting the networkid to
the same value of chainid...

use "gsn-with-geth" to bring up a local geth (using docker) on port
8545, and GSN running on top of it.

for completeness, we also have "gsn-with-ganache" - which works fine,
but you can't use it with metamask...
@rekmarks
Copy link
Member

rekmarks commented Oct 9, 2020

I regret that we haven't been able to address this issue. We are looking into this, and will hopefully be able to ship a fix soon. Until we fix this, you should be able to omit the chainId from your signing parameters for local development work / testing.

@drortirosh
Copy link

Any ETA for the fix?

Its very problematic to create different contracts for local and remote testing

@rekmarks
Copy link
Member

@drortirosh #9552 should land tomorrow, and hopefully be included in a feature release this week.

@drortirosh
Copy link

Is this fix already released? the latest published chrome extension is 8.0.10, dated 22-Sep-2020

@rekmarks
Copy link
Member

It'll be fixed in version >=8.1, which has already shipped on Firefox, and will probably ship on Chrome early next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-provider Relating to the provider module. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants