0

Booted up ganache with this command: ganache-cli --gasLimit=0x1fffffffffffff --allowUnlimitedContractSize -e 1000000000

because I was running into this error on truffle migrate in my development environment:

"ContractName" ran out of gas. Something in the constructor (ex: infinite loop) caused gas estimation to fail. Try:
   * Making your contract constructor more efficient
   * Setting the gas manually in your config or as a deployment parameter
   * Using the solc optimizer settings in 'truffle-config.js'
   * Setting a higher network block limit if you are on a
     private network or test client (like ganache).

Was my contract failing because it's too big or is it just an issue with Truffle? Said another way, by running this ganache command am I just kicking the can down the road?

  • Does it work now? If it does work then your contract was too large. If it doesn't work then perhaps there's an error in the constructor or it is too large. – Ismael Apr 7 at 21:44
  • 1
    Works now @Ismael. Why does this feature exist in truffle if it would never work on mainnet? – Michael C Apr 7 at 22:06
  • There are several reason: block gas limit is dynamic and it might increase in the future; there are other blockchains that have larger limit; faster development cycle and leave optimization for later. – Ismael Apr 7 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.