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

Created on 6 Mar 2018  Â·  11Comments  Â·  Source: trufflesuite/truffle

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

Most helpful comment

@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.

All 11 comments

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

@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.

@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.

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:

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

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.

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

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.

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

@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.

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Katsu1991 picture Katsu1991  Â·  3Comments

rstormsf picture rstormsf  Â·  3Comments

maximilianh picture maximilianh  Â·  3Comments

oed picture oed  Â·  3Comments

ysfAskri picture ysfAskri  Â·  4Comments