trufflesuite / truffle-migrate

On-chain migrations management
17 stars 17 forks source link

Error: Could not set `null` as the transaction hash for contract #24

Closed JackPickering closed 6 years ago

JackPickering commented 6 years ago

I would like to migrate a set of truffle contracts, this is a rather large set and therefore, will not allow me to migrate all at once. Therefore, I have split my migration files down into separate stages.

If all of my contracts are stored in the contract folder, and I go to migrate the first file (migration file A), it compiles all of my contracts and successfully migrates the one contract specified in migration file A. If I then go add my second migration file into migrations and go to migrate the next contract, the truffle console reads:

Network up to date.

This is obviously not true however, I found a work-around for this as I discovered truffle was checking the compiled contracts in the build folder, assuming they'd already been migrated and then stated network up to date without migrating migration file B.

So I now have a migration and contract folder with only the contracts necessary for migrations file A, I migrate and it works fine, I then add my contracts necessary for migration B into the contracts folder, and the migration B file into migrations, and I now get the error:

Error: Could not set 'null' as the transaction hash for contractA

When I try to link the two together, for some reason it cant find the transaction hash?

If I then go to the contract abi:

... ...

            },
            "visibility": "public"
          }
        ],
        "scope": 2343,
        "src": "190:138:12"
      }
    ],
    "src": "0:328:12"
  },
  "compiler": {
    "name": "solc",
    "version": "0.4.19+commit.c4cbbb05.Emscripten.clang"
  },
  "networks": {
    "4": {
      "events": {},
      "links": {},
      "address": "0xd3d802cb1eebcfea355f75fe4dc348c5032587d1",
      "transactionHash": "0xfae645ac9806397e491faa70088b1621368714d2a5592004fa682a716808f774"
    }
  },
  "schemaVersion": "2.0.0",
  "updatedAt": "2018-03-21T17:08:44.273Z"
}

The full trace of the error is as follows:

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>

So the transaction hash is definitely there...

Can anyone help?

cgewecke commented 6 years ago

@JackPickering People have been running into this when using the overwrite option in migrations. See this thread. It seems like they found a reasonable workaround - I can't see their entire code in that issue so it's a little difficult to grok exactly why this happens.

If you discover a way to distill it into a clear bug report or a way we could improve error messaging that would be wonderful.

cgewecke commented 6 years ago

This was fixed a while ago, closing for housekeeping.