Truffle: gasPrice is being ignored

Created on 13 Nov 2017  Â·  10Comments  Â·  Source: trufflesuite/truffle

  • [x] I've asked for help in the Truffle Gitter before filing this issue.

Issue

Setting the "gasPrice" field in truffle.js is being ignore

Steps to Reproduce

Ideally done on testRPC:

  • Start testRPC
  • Drain the default wallet of most of your Ether
  • Change the "gasPrice" to something like "10" or "10000" or anything
  • truffle migrate --dry-run
  • You'll receive an error saying The upfront cost is: 471238800000000000 and the senders account only has: (some amount or 0)

Expected Behavior

Updating gasPrice should change the amount of Ether needed to run the transaction

Actual Results

Requires 471238800000000000 wei no matter what

Environment

  • Operating System: Mac
  • Truffle version: 4.0.0 and 4.0.1
  • Ethereum client: testRPC
  • node version: 6.0.0
  • npm version: 4.0.03

Most helpful comment

Turns out the problem was the unclear truffle documentation.

gasPrice should be given as a string , not an integer
The same goes for any other variable given in the config
They should be passed as strings, yet the documentation shows integers being passed as value.

All 10 comments

Update: this seems to only be happening with --dry-run

__This issue now has a funding of 0.1 ETH (32.8 USDT) attached to it.__ To view or claim this funding, click here.

Hi,

The pull request trufflesuite/truffle-core#81 resolves this issue. The value for gasPrice and gasLimit were not copied over when the network was forked in the environment (when using --dry-run).

That seems to have fixed it @scboffspring thanks!

hey @scboffspring im remitting the bounty now :)

__The funding of 0.1 ETH attached to this issue has been approved & issued.__

Learn more at: https://gitcoin.co/funding/details?url=https://github.com/trufflesuite/truffle/issues/680

Dope

On Mon, Dec 11, 2017 at 6:27 PM Gitcoin.co Bot notifications@github.com
wrote:

The funding of 0.1 ETH attached to this issue has been approved & issued.

Learn more at:
https://gitcoin.co/funding/details?url=https://github.com/trufflesuite/truffle/issues/680

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/truffle/issues/680#issuecomment-350892641,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUT9x76DzH4L4jN72Nj8hy2PE0roAhQks5s_bphgaJpZM4QcRV2
.

Hi, has this been merged already?

I'm still getting this issue (in my case with gasPrice 0 and using PoA on Azure).

Works fine without --dry-run

Truffle v4.1.8 (core: 4.1.9)
Solidity v0.4.24 (solc-js)

Cheers!

Turns out the problem was the unclear truffle documentation.

gasPrice should be given as a string , not an integer
The same goes for any other variable given in the config
They should be passed as strings, yet the documentation shows integers being passed as value.

Thanks @kyriediculous !

That was indeed my problem

Was this page helpful?
0 / 5 - 0 ratings