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

Error: Could not set null as the transaction hash (deploying with {overwrite: false} ) #836

Closed
elie222 opened this issue Mar 6, 2018 · 11 comments
Assignees

Comments

@elie222
Copy link

elie222 commented Mar 6, 2018

Any ideas why this is happening in Truffle 4.1.0?

⚡ truffle test
Using network 'development'.

Error: Could not set `null` as the transaction hash for COT

COT inherits from StandardToken and doesn't do much else.

Environment

  • Operating System: OSX
  • Ethereum client:
  • Truffle version (truffle version): Truffle v4.1.0 (core: 4.1.0) Solidity v0.4.19 (solc-js)
  • node version (node --version): v8.4.0
  • npm version (npm --version): 5.7.1
@elie222
Copy link
Author

elie222 commented Mar 6, 2018

This may well be a bug with Truffle. I got things working by removing: overwrite: false from my deploy code.

@cgewecke
Copy link
Contributor

cgewecke commented Mar 7, 2018

@elie222 Could you link to or show the code that results in this error, including the 'deploy code'? It would also be helpful if you provided steps to reproduce it.

@cgewecke
Copy link
Contributor

cgewecke commented Mar 8, 2018

@elie222 I'm going to close this because it's quite difficult from your issue description to tell what state your contracts are in when this error occurs. Feel free to re-open when you can provide more detail.

@cgewecke cgewecke closed this as completed Mar 8, 2018
@elie222
Copy link
Author

elie222 commented Mar 12, 2018

Just ran into this same issue again unfortunately. Funny how when I googled it this was the top response :(

This is a sample of some of the problematic code:

deployer
        .deploy(Token, TokenFactory.address, { overwrite: false })
        .then(function() {
          return Token.deployed()
        })

@elie222
Copy link
Author

elie222 commented Mar 12, 2018

Again the solution was to get rid of { overwrite: false }, but this really wasn't ideal for me. Had to put the code into a single file to do this when I really wanted it in two separate files.

@kriskelly
Copy link

kriskelly commented Mar 16, 2018

I'm also seeing this issue when using {overwrite: false} in my deploy code. I've verified that it deploys fine without that option.

Using Truffle v4.1.3, Solidity v0.4.19

@JackPickering
Copy link

JackPickering commented Mar 23, 2018

Deploying code in separate files is not an option for me, my codebase is too big to deploy at once and therefore, I need to be able to deploy in stages. Is there a valid work around for this?

It is the same error with me, I have {overwrite: false} in my contracts and libraries as like I said, I cant deploy all of my code at once.

Migrations 1:

var BytesDeserializer = artifacts.require("BytesDeserializer");
var StagesLib = artifacts.require("SaleStagesLib");

module.exports = async function(deployer, network, accounts) {
  deployer.deploy(StagesLib, {overwrite: false});
  deployer.deploy(BytesDeserializer, {overwrite: false});
};

Migrations 2:

var PickToken = artifacts.require("PickToken");

module.exports = async function(deployer, network, accounts) {
  deployer.deploy(PickToken, {overwrite: false});
};

Migrations 3 (I've cut the variables out to keep it short):

var BytesDeserializer = artifacts.require("BytesDeserializer");
var StagesLib = artifacts.require("SaleStagesLib");
var KYCCrowdsale = artifacts.require("KYCCrowdsale");
var PickCrowdsale = artifacts.require("PickCrowdsale");
var PickToken = artifacts.require("PickToken");

module.exports = async function(deployer, network, accounts) {
  var sale;

  deployer.deploy(StagesLib, {overwrite: false});
  deployer.link(StagesLib, KYCCrowdsale);
  deployer.deploy(BytesDeserializer, {overwrite: false});
  deployer.link(BytesDeserializer, KYCCrowdsale);

  deployer.deploy(PickToken, {overwrite: false}).then(function() {
    return deployer.deploy(KYCCrowdsale, startTime, endTime, rate, wallet, beneficiary, buyer, founders, bounty, softCap, hardCap, PickToken.address);
  });
};

Full trace of error:

Running migration: 5_deploy_sale.js
  Didn't deploy SaleStagesLib; using 0xa9f811240dd92dab3267855dbe8051743c95b513
  Linking SaleStagesLib to KYCCrowdsale
Error encountered, bailing. Network state unknown. Review successful transactions manually.

Error: Could not set `null` as the transaction hash for SaleStagesLib
    at Function.set (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-contract/contract.js:785:1)
    at Function.setter (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-contract/contract.js:664:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-deployer/src/actions/deploy.js:38:1
    at <anonymous>

However, when I look into SaleStagesLib.json in the build folder, I see this at the bottom of the file:

  },
  "networks": {
    "4447": {
      "events": {},
      "links": {},
      "address": "0xb848ef765e289762e9be66a38006ddc4d23aef24",
      "transactionHash": "0x59568ee46af081be8b969e7e5a8657715cfb718cc19046b2aaaeaa92e2a9d659"
    }
  },
  "schemaVersion": "2.0.0",
  "updatedAt": "2018-03-22T13:56:33.620Z"

Strangely enough, the contents of /usr/local/lib/node_modules/truffle/build/ are:

drwxr-xr-x   9 jackpickering  admin       288 22 Mar 09:50 .
drwxr-xr-x  16 jackpickering  admin       512 22 Mar 09:50 ..
-rw-r--r--   1 jackpickering  admin     45928  8 Mar 02:35 Assert.sol
-rw-r--r--   1 jackpickering  admin       217  8 Mar 02:35 SafeSend.sol
-rw-r--r--   1 jackpickering  admin   4362435  8 Mar 02:35 chain.bundled.js
-rw-r--r--   1 jackpickering  admin   5195071  8 Mar 02:35 chain.bundled.js.map
-rwxr-xr-x   1 jackpickering  admin  12255482 22 Mar 09:50 cli.bundled.js
-rw-r--r--   1 jackpickering  admin  14912833  8 Mar 02:35 cli.bundled.js.map
drwxr-xr-x   6 jackpickering  admin       192 22 Mar 09:50 templates

With no webpack, so I cant find the line of code that throws the error.

@cgewecke
Copy link
Contributor

@JackPickering Thanks, re-opening. Will look into this and see what's going wrong . . .

@cgewecke cgewecke reopened this Mar 23, 2018
@cgewecke cgewecke changed the title Error: Could not set null as the transaction hash for MyToken Error: Could not set null as the transaction hash (deploying with {overwrite: false} ) Mar 23, 2018
@cgewecke cgewecke self-assigned this Mar 23, 2018
@cgewecke
Copy link
Contributor

@elie222 @JackPickering Apologies, it looks we introduced this bug in 4.0.7. Have opened a PR at truffle-contract (ref above) which will hopefully resolve this. Should be included in a patch release scheduled for early next week.

@gnidan
Copy link
Contributor

gnidan commented Apr 16, 2018

Fix for this has been released in Truffle v4.1.6. Closing for issue maintenance. Let us know if the problem persists! Thanks!

@gnidan gnidan closed this as completed Apr 16, 2018
@eepstein
Copy link

That's not a patch. That's a new release with other things changed. Borked.

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

6 participants