[Ethereum] truffle migrate fails with: Error encountered, bailing. Network state unknown

truffle

Could someone point out what is happening with truffle.

"truffle compile" works fine. Please find the below truffle migrate reset output

Ubuntu#truffle version
Truffle v3.1.2
Ubuntu#truffle migrate --reset
Using network 'development'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  Migrations: 0x8ef3810f2dc59ecb37a518d18fab657343d8b281
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying A...
  A: 0x78724b3d9468e1e81e168c4fd3fa7e8c74f41532
Error encountered, bailing. Network state unknown. Review successful transactions manually.
TypeError: Cannot read property 'links' of undefined
    at /usr/lib/node_modules/truffle/node_modules/truffle-migrate/node_modules/truffle-deployer/src/linker.js:30:22
    at Array.forEach (native)
    at Object.link (/usr/lib/node_modules/truffle/node_modules/truffle-migrate/node_modules/truffle-deployer/src/linker.js:28:18)
    at /usr/lib/node_modules/truffle/node_modules/truffle-migrate/node_modules/truffle-deployer/src/actions/link.js:5:12
    at /usr/lib/node_modules/truffle/node_modules/truffle-migrate/node_modules/truffle-deployer/src/deferredchain.js:20:15
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
Ubuntu#

testrpc output while invoking truffle migrate

HD Wallet
==================
Mnemonic:      ring book bridge orange sick announce original they cross such sudden jar
Base HD Path:  m/44'/60'/0'/0/{account_index}

Listening on localhost:8545
net_version
eth_accounts
net_version
net_version
eth_sendTransaction

  Transaction: 0x4ac810d07f93349a0a15607734138610143cc5a6ab2ebf473969f4a9ad8a98dd
  Contract created: 0x0ecffa76b13841a4d1562d68e651fcbdd2a9c27d
  Gas usage: 0x02c504
  Block Number: 0x01
  Block Time: Thu Feb 23 2017 12:59:28 GMT+0530 (IST)

eth_newBlockFilter
eth_getFilterChanges
eth_getTransactionReceipt
eth_getCode
eth_uninstallFilter
net_version
net_version
eth_sendTransaction

  Transaction: 0x1b1eafe1ed1788ced13a4e9706fba24ef2b156c6211d8aa0328bbb35f5a6d1f5
  Contract created: 0x121a3c3285ba61b88de863013c156fecc23f6d00
  Gas usage: 0x01aad6
  Block Number: 0x02
  Block Time: Thu Feb 23 2017 12:59:29 GMT+0530 (IST)

eth_newBlockFilter
eth_getFilterChanges
eth_getTransactionReceipt
eth_getCode

Best Answer

The contract size was crossing more than 24000 bytes . Hence the contract was not getting deployed. ( I had many imports/inheritance)

Solution was to split the contract code by functionality and redeploy.

Vitalik statement on contract size

Related Topic