Metamask-extension: Metamask stops working if gas is passed as an object

Created on 11 Jun 2019  路  2Comments  路  Source: MetaMask/metamask-extension

To Reproduce
Steps to reproduce the behavior:

  1. Open https://codepen.io/rstormsf/pen/qzBRBe?editors=1010
  2. Click Click me button
window.ethereum.sendAsync({
                    method: 'eth_sendTransaction',
                    params: [{
                        from: acc,
                        to: "0x0039f22efb07a647557c7c5d17854cfd6d489ef3",
                        gas: {}, // provide Gas as an Object
                        gasPrice: "0x77359400",
                        value: "0x0",
                        data: "0x0"
                    }],
                    jsonrpc: '2.0'
                }, (err, response) => {
                    window.alert(JSON.stringify(err))
                    console.log(response)
                })

Expected behavior
It should not break metamask

Screenshots
image

Browser details (please complete the following information):

  • OS: OSX
  • Browser chrome
  • MetaMask Version 6.6.1

Additional context
metamask_big

T00-bug good first issue

Most helpful comment

Hi
I am new to MetaMask project and would like to work on this.
I already have a local build of MetaMask extension and I am able to reproduce the bug.

After some investigation, I found that this problem is arising because the transaction is being added in the unapprovedTxs without validation of txParams. Validation of txParams in only done in TransactionStateManager.updateTx() and not in TransactionStateManager.addTx().

All 2 comments

I can't even reset the account in metamask, I can't use that account anymore. It's showstopper issue

Hi
I am new to MetaMask project and would like to work on this.
I already have a local build of MetaMask extension and I am able to reproduce the bug.

After some investigation, I found that this problem is arising because the transaction is being added in the unapprovedTxs without validation of txParams. Validation of txParams in only done in TransactionStateManager.updateTx() and not in TransactionStateManager.addTx().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnerfx picture johnerfx  路  4Comments

dpazdan picture dpazdan  路  3Comments

kumavis picture kumavis  路  3Comments

BassBauman picture BassBauman  路  3Comments

MarkOSullivan94 picture MarkOSullivan94  路  3Comments