Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Error encountered, bailing. Network state unknown. Review successful transactions manually. #830

Closed
microdesign opened this issue Mar 2, 2018 · 16 comments

Comments

@microdesign
Copy link


Issue

What the issue is, in broad strokes.

Steps to Reproduce

Please provide the shortest amount of steps to reproduce your issue.

Migrate my contracts

I got error in Ganache, truffle develop and tesrpc when I try to migrate my contracts

Actual Results

Running migration: 2_HashnodeCrowdsale.js Deploying HashnodeCrowdsale... ... 0x83204ac86474f0efd8b8c4d53eaab84db1d7d7753d9368c9b44c59b3c3344b42 Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: VM Exception while processing transaction: revert at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1) at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1 at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-migrate/index.js:225:1 at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1 at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1) at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1) at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1) at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1) at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1) at emitNone (events.js:110:20) at IncomingMessage.emit (events.js:207:7) at endReadableNT (_stream_readable.js:1059:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickDomainCallback (internal/process/next_tick.js:218:9)

debug 0x83204ac86474f0efd8b8c4d53eaab84db1d7d7753d9368c9b44c59b3c3344b42

(node:68219) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'sourcePath' of undefined (node:68219) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Environment

  • Operating System: MAC
  • Ethereum client: Ganache
  • Truffle version Truffle v4.1.0 (core: 4.1.0)
  • node version latest updated today
  • npm version latest updated today
@cgewecke
Copy link
Contributor

cgewecke commented Mar 2, 2018

@microdesign The core of this error is:

Deploying HashnodeCrowdsale... ... Error: VM Exception while processing transaction: revert

To understand what is happening here I suggest writing Javascript tests that verify your contract can be deployed via a simple .new, e.g:

it('should deploy', async function(){
  const instance = await HashNodeCrowdsale();
});

Going to close this because the possible causes of this error when deploying a Crowdsale contract are numerous and it's not clear this issue is migrations specific. Additionally there are no clear reproduction steps. Please feel free to re-open after your tests pass and you can link to your migrations and contract code or give us a simple case to reproduce. Thanks!

@cgewecke cgewecke closed this as completed Mar 2, 2018
@microdesign
Copy link
Author

Sorry I sent the wrong error, here is the right one;

Deploying LeonardianCrowdsale... ... 0xc67431d63e92686ae31c585d9667d2fc22512c3818ec99b7245a0a8d2f839363 Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: The contract code couldn't be stored, please check your gas amount.

@microdesign
Copy link
Author

Also the problem is not with the gas - the migration was working before I just update my truffle installation and this happen

@cgewecke
Copy link
Contributor

cgewecke commented Mar 2, 2018

@microdesign I would check out #660 since you are deploying a Crowdsale (that thread discusses non-ganache clients but worth knowing about) Crowdsales are large contracts that tend to be towards the default block limits. For testing purposes I would define a testing network in truffle.js with a highish gas value and run ganache-cli in a separate terminal with the flag --gasLimit 8000000 (or more!) and see if that helps.

@microdesign
Copy link
Author

I use Ganache app and set the gas there the result is same.

As I already told you all the contract was working and migrating successfully before I update my truffle
npm package today.

So definitely the problem is not in solidity, it is in the migration process

@cgewecke
Copy link
Contributor

cgewecke commented Mar 2, 2018

@microdesign Ok, we need steps to reproduce. That's a precondition for re-opening this, I'm sorry.

@microdesign
Copy link
Author

what steps did you need?

I found on the net today this is known bug and it is fixed in my version but I continue has this error

@cgewecke
Copy link
Contributor

cgewecke commented Mar 2, 2018

@microdesign How about links to a public open-source repo with your code that we can clone, install and run truffle migrate against. If that's not possible produce a minimal case in the same format (GH truffle project) that results in the same error. If you choose the latter make sure everything distinctive about your real project is reflected in the minimal case.

@microdesign
Copy link
Author

OK I updated the OpenZeppeling to the latest version I think the migrate is successfully now, but I continue see this error which I think it is coming from truffle code and nodejs version

(node:79626) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: The contract code couldn't be stored, please check your gas amount. (node:79626) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@microdesign
Copy link
Author

My Gas limit in ganache is set it up as you told me to make it.

@microdesign
Copy link
Author

Also here is my code you can see I only extend zeppelin contracts:

`
pragma solidity ^0.4.18;

import './LeonardianToken.sol';
import 'zeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol';
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';

contract LeonardianCrowdsale is TimedCrowdsale, Ownable {
// ==============================
// Constructor
// ============
function LeonardianCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet, ERC20 _token) TimedCrowdsale(_startTime, _endTime) Crowdsale(_rate, _wallet, _token) public {

}

// Change the current rate
function setCurrentRate(uint256 _rate) private {
	rate = _rate;
}

}

`

here is my migration:

`
var LeonardianCrowdsale = artifacts.require("./LeonardianCrowdsale.sol");
var LeonardianToken = artifacts.require("./LeonardianToken.sol");

module.exports = function(deployer) {

var token = deployer.deploy(LeonardianToken).then(function () {

const startTime = Math.round((new Date(Date.now() - 86400000).getTime())/1000); // Yesterday
const endTime = Math.round((new Date().getTime() + (86400000 * 20))/1000); // Today + 20 days

deployer.deploy(LeonardianCrowdsale, 
    startTime, 
    endTime,
    5, 
    "0x5AEDA56215b167893e80B4fE645BA6d5Bab767DE", // Replace this wallet address with the last one (10th account) from Ganache UI. This will be treated as the beneficiary address. 
    LeonardianToken.address
  );

});

};
`

@cgewecke
Copy link
Contributor

cgewecke commented Mar 3, 2018

@microdesign
Is this correct? Your crowdsale doesn't deploy the token itself?

deployer.deploy(LeonardianToken).then // 

Additionally it's necessary to return all promises to thedeployer so . . .

return deployer.deploy(LeonardianCrowdsale, 

It seems possible that your issues are with your crowdsale code rather than Truffle, although I agree the error messages you're seeing aren't very helpful. Truffle reports back whatever it gets from the Ethereum client and sometimes these errors are unclear. I'd encourage you to seek help at Zeppelin - (sign up on their slack and ask for advice) or from the author of the tutorial you're following.

@cgewecke
Copy link
Contributor

cgewecke commented Mar 5, 2018

Leaving an additional reference here for anyone else running into problems with a similar contract structure: nice discussion at Zeppelin about the mechanics and benefits of deploying the token and crowdsale separately.

@microdesign
Copy link
Author

Thanks for the help - I found the Ganache was old version today I update with the latest avaible but I think the debug is even worse one.

Also, truffle debug hash give me JS errors from the truffle package.

I`ll ask OpenZepellin for the problem, thanks.

@microdesign
Copy link
Author

Also, the last version of Ganache have different behavior on every restart - sometimes work on on the next restart not working.

@sshmaxime
Copy link

Setting the gas to the hexadecimal value of the gas limit in the genesis.json file fixed it for me.

i.e "gasLimit": "0x47b760"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants