MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
12.05k stars 4.92k forks source link

Detect when TestRPC changes & restart provider #2373

Open danfinlay opened 7 years ago

danfinlay commented 7 years ago

Here at EthWaterloo, I just saw a pair of hackers get stuck to the point of desperation because:

Both of those problems were actually related to restarting their TestRPC server, and MetaMask now being in a "wrong" state.

We could solve this by doing some kind of provider detection, for when the provider server (even if just localhost:8545) suddenly changes to a different blockchain. This could be as simple as periodically (every 5 minutes) checking if the genesis block has the same hash. Or recognizing if an old block no longer exists. I don't know, this issue is for solving the problem, let the solution PR have the solution.

saneletm commented 6 years ago

I have this problem when using truffle develop testrpc. and it doesn't resolve when I switch network on metamask. I think this is probably a truffle issue though. it works fine with any other network, including with just running testrpc from node_modules manually at port 8545

bmmpxf commented 6 years ago

I think this would be a great idea. It doesn't need to be an automatic/periodic check or anything; there could be a button somewhere that says "Reset network" or "Forget history" or something. Right now the only solution I've found is to uninstall/reinstall the extension.

I don't know how feasible any of this would be, but it would be appreciated!

danfinlay commented 6 years ago

Solutions discussed in #1999, which is a bug that would be fixed by this.

danfinlay commented 6 years ago

A starting point PR for this fix is: https://github.com/MetaMask/metamask-extension/pull/2623

bdresser commented 6 years ago

can we bounty this to get it over the finish line?

bdresser commented 6 years ago

blocked by #4279

kumavis commented 6 years ago

now that we have a special configuration for localhost, we can add that behavior just there

Gudahtt commented 3 years ago

Related: #4254, #5067, #6559, #8081

sriharikapu commented 2 years ago
timolson commented 10 months ago

now that we have a special configuration for localhost, we can add that behavior just there

My test network is not on localhost. Wouldn't help.