MetaMask / MetaMask/metamask-extension

Risk of overwriting networkID of a transaction

Open
#6,064 1 comment 0 reactions 0 assignees View on GitHub
needs-design type-enhancement
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

**Describe the bug**

MyEtherWallet.com (MEW) and MetaMask don't alert when they are on different network.

I wanted to [deploy a contract with bytecode](https://www.myetherwallet.com/#contracts) on MEW to the main net. I was on the main net according to the dropdown on the upper right of MEW, and MEW also asked me to confirm the deployment on *ETH main net*. It shows that the `networkID` shall be defined in the transaction.
However, my MetaMask account was initially on *Ropsten test net*. When confirming the transaction, it stays on Ropsten and only asked for tx confirmation. No warning/alert from either side. It's a risk for users of messing up network.
Eventually, the contract was deployed on Ropsten, therefore implying a risk of overwriting the networkID of a transaction and reduces the usability for users.

**To Reproduce**
1. Go to [MEW](https://www.myetherwallet.com/) and select Network 'ETH' of the upper right dropdown
2. Go to 'Contract' section and select 'Deploy Contract'
3. Paste the bytecode of a sample smart contract, enter gasLimit, select 'MetaMask/Mist' and "Connect to MetaMask"
4. Click on 'Sign Transaction' and you can see in the 'Raw Transaction' and 'Signed Transaction', the `chainId = 1`.
5. Make sure that MetaMask is on Ropsten test net. (This can be switched/set at anytime from step 1 till step 4)
6. Click on 'Deploy Contract' and confirm that 'Yes, I'm sure! Make transaction ' (to ETH main net)
7. Confirm tx on MetaMask
8. Track the tx and the deployed contract. They are on Ropsten test net instead of main net.

**Expected behavior**

MetaMask shall follow the transaction prepared by the application and deploy the contract on main net, even though the user forgot to switch the network.

**Browser details:**
- OS: macOS 10.14
- Browser: Chrome
- MetaMask Version: 5.3.1

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the MEW and MetaMask network mismatch using the listed deployment steps, especially the chainId 1 transaction sent while MetaMask is on Ropsten. Determine how the extension handles the selected network during confirmation; done means the user is warned or the transaction cannot be confirmed on the wrong network.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.