-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Error encountered, bailing. Network state unknown. Gas is 4700000 #660
Comments
The problem is likely that the optimizer is now disabled by default in Truffle 4, and I believe Ropsten's block gas limit may be too low. You can find background on why we disabled the optimizer in trufflesuite/truffle-compile#5, and instructions for re-enabling it in the docs. Let me know if you try that and if it works. Thanks! |
I enabled the optimizer according your the description in the docs. Here is my truffle.js file:
If I run: I get the following error: Using network 'development'. Running migration: 1_initial_migration.js
Do you have any idea what is going wrong there? |
I got the same problem as @Bowfish |
From this issue, you may need to split up your contracts into smaller contracts so they get easily deployed with a gas amount that is within the block limit, as enabling solc optimizer may not be exactly what you want to do [you may begin to have bytecodes that behave differently from your source code]. Visit the truffle release page to see security concerns associated with enabling solc optimizer. Hope this helps. |
Unfortunately this doesn't help. I tested it with the default Metacoin.sol contract which is created with truffle init. Therefore the bug must be somewhere else. |
Oh! Then the bug must be somewhere else for sure. I'll keep checking for a working solution and inform here if possible. |
There's an issue with this version of truffle for sure. Did a clean ubuntu install with latest node, truffle, testrpc and I get out of gas in any situation. So having optimization flag enabled in truffle.js does not help. I've used for this test some really simple contracts. For example https://github.com/LindaHealthcareICO/linda-crowdsale used to work with previous truffle version. Please note if you test those contracts there's a typo in their package.json file (a trailing coma in the scripts section) so you should fix that before installing. |
I installed truffle 4.0.0-beta.0 and everything is working fine. |
Worked for me too. Downgrading fixed the issue! |
Hi everyone. Thanks for the feedback. Are you all using the TestRPC? If so, try using |
@tcoulter Hi, yes, I'm on testrpc. As previously mentioned truffle develop works fine but I've chosen testrpc because I couldn't get the created accounts private keys nor set a custom balance for each account. |
I'm on testrpc too. |
I tested it on Is it possible to create more than 10 accounts in truffle develop in the same way as with |
It seems that |
Just to reinforce the thread, I was facing the same issue. Downgrading truffle to 4.0.0-beta.0 fixed the issue. |
Ubuntu 16.04 |
I had the same error, but with |
What about migrating to a remote test network. Are you sure the issue won't be there? Truffle develop works for me too but when I try to migrate the code to rinkeby I get the same out of gas error. |
Same problem, I solve it by forcing |
Same error on Ubuntu with Truffle 4.0.1, using testrpc setting downgrading to @beta works fine. |
Having the same issue, downgrading did'nt help. Everything works on local TestRpc, but if I try to publish it to Ropsten or Rinkeby via Geth it wont work. |
I second sorccu, used testrpc -p 8546 --gasLimit 6721975 --gasPrice 100000000000 and contract migrations worked with [email protected] |
Had the same issue with truffle 4.0.1 and testrpc and had to set gas limit and price as advised. Just updated testrpc to latest version (EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)) and it works for me without setting gas. Haven't tried deploying on test networks yet. If it still doesn't work on those, does anyone in truffle support have an idea when it will be fixed please? |
same issue:I use truffle+infura |
Same issue: Everything works using the solution provided by sorccu |
Same issue: Sorccu's suggestion above also resolved this issue for me |
Try adding the max gas while deploying in 2_deploy_contracts.js |
How does your migration file look like? |
truffle deploy --network live is failing for me with:
|
Ok, but what about the file that deploys the actual contracts? (e.g. 2_deploy_contracts.js) I got the error "The contract code couldn't be stored, please check your gas amount" when this file was not correct. |
I ran into the same issue with truffle 4.1.0 using ganache. I downgraded to 4.0.7 => no improvement |
@chevdor Apologies, could you provide any additional context or information - for example your There was quite a bit added in the 4.0.6 release - if you've managed to isolate that as a source of problems it would be nice to resolve them. |
I updated geth & truffle today. Now I'm getting "Transaction not found after 50 blocks" when trying to deploy to mainnet. I tried setting my gas higher than anything on http://ethgasstation.info/ , still with no publication of the contract. truffle.js:
(I also tried with gasPrice: 1, 2 and 3) and here's the log from
eth.getBalance(eth.accounts[1]) which is plenty more than gas * gasPrice.
and to the end..
|
@quantumproducer the |
Ah I read ina blog post that gas was done in GWei, I see now that's just how it's referred to but the vlaues are in |
@mradkov edit, nvm re: gas |
@quantumproducer The strange thing is the contract is working just fine when published by web3 or in remix. (Tested on Ropsten). |
I'm still getting this issue on mainnet. Btw Mradkov how did you calculate the gas usage exactly for your contract deployment? (Something in truffle?) |
I'm having a similar issue, though specifically with mainnet: I'm trying to only deploy the
I've tried lots of combinations of
geth version 1.8.2 It works swimmingly on rinkeby and testrpc. Any suggestions? |
@mradkov I'm able to deploy to |
BTW, my issue here wound up being that my node was not fully synced. I should probably create a new issue, "When trying to deploy to a node that is not fully synced, an error about gas limit is given, rather than something that makes sense" |
Agreed, the same error confused me to. It wasn't clear from the error that you had to sync to deploy. Here's my
"Contract couldn't be found after 50 blocks" Why? I'm offering 9 GWEI for gas. Why does this happen? I've tried without the optimizer, too.
I'm unable to deploy my smart contract while this is happening. |
|
I am experiencing the same issue... Truffle v4.1.3 (core: 4.1.3) The contract deploys just fine to Ganache development network. My truffle.js source: module.exports = {
}; |
Following up from my post yesterday... was able to deploy successfully using the GAS Limit specified in Ropsten Etherscan. How I did it...
output:
='s Success :) |
What worked for me is: |
Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem. |
There has been no new activity on this issue since it was marked as stale 7 days ago, so it is being automatically closed. If you'd like help with this or a different problem, please open a new issue. Thanks! |
Error 'The contract code couldn't be stored, please check your gas amount.' As I just learned - if you get this error while deploing to private network - it could signal, that remote node have wrong evm version |
Also truffle could try to compile and deploy contracts for petersburg at byzantine network and give only You can check difference your local ganache evm version and version of other chain you want to deploy to |
Issue
What the issue is, in broad strokes.
Error encountered, bailing. Network state unknown.
Running migration: 2_deploy_contracts.js
Deploying NEXTTokenCrowdsale...
... 0x3b22b5c2795c0a9f53a5295cca84af1ddcaafd363120738fa126af8be0b256fa
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
at Object.callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:329221:46)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:39618:25
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:331159:9
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:175492:11
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:314196:9
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
at IncomingMessage. (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
Steps to Reproduce
Please provide the shortest amount of steps to reproduce your issue.
With every contract deployment on Ropsten or private blockchain we get this error after running the command:
truffle deploy --network='ropsten' --reset
Yesterday everything worked!
Expected Behavior
What you expected to happen.
No deployments of contracts possible.
Actual Results
What actually happened. Please give examples and support it with screenshots, copied output or error messages.
Environment
The text was updated successfully, but these errors were encountered: