Metamask-extension: No gas limit set when creating a new instance of a contract

Created on 12 Mar 2018  路  12Comments  路  Source: MetaMask/metamask-extension

MetaMask does not set a gas limit when creating a new instance of a deployed contract.

This used to work without issue until yesterday, when it suddenly started setting the gas limit to 0 instead. Gas price is still set accurately and this issue only appears when creating a new instance of a contract, not when calling a function on a deployed contract.

This caught me off guard since it worked perfectly on Saturday and no changes to my code have been made from Saturday to Sunday, so I have no reason to suspect my code as the culprit at the moment.

Additionally I've tested my code on version 3.10.0 of the extension and everything works perfectly.

I'm using Truffle (Version 4.1.3) and Ganache (Version 1.0.2) as my development environment.

  • Expected Behavior
    MetaMask should correctly estimate gas usage when creating a new instance of a deployed contract and it should set the gas limit and gas price accordingly.

  • Actual Behavior
    MetaMask fails to estimate the gas usage correctly and sets the gas limit to 0 instead. Gas price ist set accurately.

  • Browser Used
    Chrome (Version 65.0.3325.146) with MetaMask extension (Version 4.2.0)

  • Operating System Used
    macOS High Sierra (Version 10.13.3)

N02-needsReproduction P2-sooner T00-bug

Most helpful comment

@bdresser @jennypollack I'll be able to put something together to reproduce the issue this upcoming weekend, earliest this Friday - hope that works for you.

All 12 comments

I'm also facing the same issue since yesterday. Metamask chrome extension is unable to calculate the gas price and set it to 0 and not allow to deploy contract on ethereum Ropsten test network.
MetaMark Version: 4.5.5
Test network: Ropsten
Browser: Chrome
Chrome Version 65.0.3325.181 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit)

Having the same issue in both Firefox and Chrome. So far I have had to tell the user to set the gas limit manually - not ideal.

Can you provide an instance of your contract where you see this issue?

@nhbrown or anyone else here - would love some reproduction steps to help us dig in!

@bdresser @jennypollack I'll be able to put something together to reproduce the issue this upcoming weekend, earliest this Friday - hope that works for you.

Looks like this happens with any contract deploy, e.g. through remix.ethereum.org.

The old UI still allows gas customization on contract deploy, so I'd recommend using it to deploy new contracts until we're able to get this in.

I confirm. The problem is present in the new UI. I think it's necessary to leave the possibility to set the gas price manually in the new UI. This is critical in my opinion

We're adding those manual controls back to new UI very soon.

Are you also experiencing this issue in old UI, or only new UI?

@danfinlay In the old version, too, the price of gas is always 0 for deploy new contract, but there are controls that could be assigned manually. I use Remix as an IDE and a ropsten network

thanks @tmashuang for the repro steps:

1) OldUI, Start Ganache Server
2) Connect Metamask ganache
3) Send Tx with Ether Amount: 1
4) Tx Data : some random string.
5) gas Limit will be set to 0

its a combination of issues with Ganache since there is no current block, and we are estimating a default of 0 gas limit

  • we think that the old ui should still be setting a gas limit and i have observed some different behaviors depending on the value used in tx data

works fine with remix.ethereum.org

The other issue mentioned in this thread is related to adding the ability to edit the gas limit and gas price in the new ui.

On a chain with no blocks, I guess we should just assume some baseline high limit?

The no current block thing was a red herring, it's an issue with how we handle failures from estimateGas.
Another manifestation of the issue is https://github.com/MetaMask/metamask-extension/issues/2898

Was this page helpful?
0 / 5 - 0 ratings