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

Truffle Migration Failing Although Transaction Succeeds #2257

Open
1 task done
apbendi opened this issue Jul 26, 2019 · 19 comments
Open
1 task done

Truffle Migration Failing Although Transaction Succeeds #2257

apbendi opened this issue Jul 26, 2019 · 19 comments

Comments

@apbendi
Copy link

apbendi commented Jul 26, 2019


Issue

I'm trying to deploy a contract to mainnet. I have deployed it to Ropsten without issue. When I attempt to deploy to mainnet with truffle, I get the following error:

Starting migrations...

======================

> Network name: 'mainnet'

> Network id: 1

> Block gas limit: 0x7a121d

2_deploy_contracts.js

=====================

Deploying 'Bankshot'

--------------------

> transaction hash: 0x2d6284efba19ce96740d471eb25fc8a2e87ae1ec3d4b6e77876ab90fae584ef9

Error: Error: Error: *** Deployment Failed ***

"Bankshot" -- The contract code couldn't be stored, please check your gas limit..

at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)

at process._tickCallback (internal/process/next_tick.js:68:7)

Truffle v5.0.25 (core: 5.0.25)

Node v10.16.0

However, on etherscan, it seems the transaction has succeeded:

https://etherscan.io/tx/0x2d6284efba19ce96740d471eb25fc8a2e87ae1ec3d4b6e77876ab90fae584ef9

Steps to Reproduce

Expected Behavior

Truffle to recognize the deployment succeeded and update the migration contract

Actual Results

Contract deployed successfully, but Truffle reported it failed and errors out.

Environment

  • Operating System: macOS 10.13.6
  • Ethereum client: Infura 🙃
  • Truffle version (truffle version): v5.0.25
  • node version (node --version): 10.16.0
  • npm version (npm --version): 6.9.0
@cgewecke
Copy link
Contributor

@apbendi Out of curiosity, did you get a tx failure msg immediately or were you in pending state for a long time first? Is it possible that the tx timed out after 50 blocks per your config?

@apbendi
Copy link
Author

apbendi commented Jul 29, 2019

Hey @cgewecke, it did not fail immediately and was pending for some time, but it was definitely not the ~10 minutes needed for 50 blocks. I'd guess it failed within 3-4 minutes, and that the transaction itself was mined within 5-6.

@Vasiliy-Bondarenko
Copy link

Same issue here. Sometimes it happens, sometimes - not (with absolutely no changes, just rerun the same command). Very unstable.

lr-eth-deployment |
lr-eth-deployment | Starting migrations...
lr-eth-deployment | ======================
lr-eth-deployment | > Network name:    'goerli'
lr-eth-deployment | > Network id:      5
lr-eth-deployment | > Block gas limit: 0x7a1200
lr-eth-deployment |
lr-eth-deployment |
lr-eth-deployment | 1_initial_migration.js
lr-eth-deployment | ======================
lr-eth-deployment |
lr-eth-deployment |    Deploying 'Migrations'
lr-eth-deployment |    ----------------------
lr-eth-deployment |    > transaction hash:    0xf42b864701208f1ae10608ca750288198f87867723793b6173e2ab8934ee9d25
lr-eth-deployment | - Blocks: 0            Seconds: 0
lr-eth-deployment | Error: Error: Error:  *** Deployment Failed ***
lr-eth-deployment |
lr-eth-deployment | "Migrations" -- The contract code couldn't be stored, please check your gas limit..
lr-eth-deployment |
lr-eth-deployment |     at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
lr-eth-deployment |     at processTicksAndRejections (internal/process/task_queues.js:85:5)
lr-eth-deployment | Truffle v5.0.26 (core: 5.0.26)
lr-eth-deployment | Node v12.8.1
lr-eth-deployment | npm ERR! code ELIFECYCLE
lr-eth-deployment | npm ERR! errno 1
lr-eth-deployment | npm ERR! lr-eth

i've got this error quite fast, without any long wait.
transaction was a success: https://goerli.etherscan.io/tx/0xf42b864701208f1ae10608ca750288198f87867723793b6173e2ab8934ee9d25

on the next run a minute later...

...
lr-eth-deployment | 1_initial_migration.js
lr-eth-deployment | ======================
lr-eth-deployment |
lr-eth-deployment |    Deploying 'Migrations'
lr-eth-deployment |    ----------------------
lr-eth-deployment |    > transaction hash:    0x9bdc4e3712708d7cf659c47c1044aa135ecaf6d79ef1774b3939499d301cbe05
lr-eth-deployment | - Blocks: 0            Seconds: 0
lr-eth-deployment |    > Blocks: 1            Seconds: 13
lr-eth-deployment |    > contract address:    0x58817C3089AE7943B548f0B3a0dB28DC56E7341f
lr-eth-deployment |    > block number:        1514196
lr-eth-deployment |    > block timestamp:     1571731733
lr-eth-deployment |    > account:             0xb99840f8572189153C3c3F23c586Ee2a962D7163
lr-eth-deployment |    > balance:             9.26040288
lr-eth-deployment |    > gas used:            261393
lr-eth-deployment |    > gas price:           10 gwei
lr-eth-deployment |    > value sent:          0 ETH
lr-eth-deployment |    > total cost:          0.00261393 ETH
lr-eth-deployment |
lr-eth-deployment |
lr-eth-deployment | - Saving migration to chain.
lr-eth-deployment |    > Saving migration to chain.
lr-eth-deployment |    > Saving artifacts
lr-eth-deployment |    -------------------------------------
lr-eth-deployment |    > Total cost:          0.00261393 ETH
...

@Vasiliy-Bondarenko
Copy link

Also i get the same issue with other contracts deployment. Not only Migrations. So it's not specific to the contract.

@eggplantzzz
Copy link
Contributor

Can anyone reliably reproduce this error? This would be a great help if anyone can provide repro steps.

@Vasiliy-Bondarenko
Copy link

@eggplantzzz this IS the problem itself! it is not reliable and that's why it is a problem :) so i guess - it's impossible to reliable reproduce it.

@kartojal
Copy link

kartojal commented Nov 20, 2019

Happened same bug with v5.0.30, Infura, mnemonic and node 10, migrations are not very stable right now. Will try to see if i have any logs.

edit: dont have the error log, but is the same as the top

@Vasiliy-Bondarenko
Copy link

@eggplantzzz
how to reproduce the issue:

  • git clone https://github.com/atato/eth-deployment-error.git

  • cd eth-deployment-error/

  • cp .env.example .env

  • update .env with infura api key

  • docker-compose up

  • it will build Migration smart contract and try to deploy it 500 times in a row. it is expected to fail pretty fast. i am not sure what can speed up this process. some particular time of day, infura or internet slowness or some other random stuff.

My latest run log:

$ docker-compose up
Starting truffle-issue-repro ... done
Attaching to truffle-issue-repro
truffle-issue-repro | /usr/local/bin/truffle -> /usr/local/lib/node_modules/truffle/build/cli.bundled.js
truffle-issue-repro |
truffle-issue-repro | > truffle@5.0.26 postinstall /usr/local/lib/node_modules/truffle
truffle-issue-repro | > node ./scripts/postinstall.js
truffle-issue-repro |
truffle-issue-repro | - Fetching solc version list from solc-bin. Attempt #1
truffle-issue-repro | + truffle@5.0.26
truffle-issue-repro | updated 1 package in 8.214s
truffle-issue-repro | npm WARN eth-deployment-issue@0.2.0 No description
truffle-issue-repro | npm WARN eth-deployment-issue@0.2.0 No repository field.
truffle-issue-repro | npm WARN eth-deployment-issue@0.2.0 No license field.
truffle-issue-repro |
truffle-issue-repro | audited 20673 packages in 3.642s
truffle-issue-repro | found 1 low severity vulnerability
truffle-issue-repro |   run `npm audit fix` to fix them, or `npm audit` for details
truffle-issue-repro |
truffle-issue-repro | > eth-deployment-issue@0.2.0 migrate-goerli /usr/src/app
truffle-issue-repro | > truffle migrate --network goerli --reset
truffle-issue-repro |
truffle-issue-repro |
truffle-issue-repro | Compiling your contracts...
truffle-issue-repro | ===========================
truffle-issue-repro | > Compiling ./contracts/Migrations.sol
truffle-issue-repro | > Artifacts written to /usr/src/app/build/contracts
truffle-issue-repro | > Compiled successfully using:
truffle-issue-repro |    - solc: 0.5.6+commit.b259423e.Emscripten.clang
truffle-issue-repro |
truffle-issue-repro |
truffle-issue-repro | Starting migrations...
truffle-issue-repro | ======================
truffle-issue-repro | > Network name:    'goerli'
truffle-issue-repro | > Network id:      5
truffle-issue-repro | > Block gas limit: 0x7a1200
truffle-issue-repro |
truffle-issue-repro |
truffle-issue-repro | 1_initial_migration.js
truffle-issue-repro | ======================
truffle-issue-repro |
truffle-issue-repro |    Deploying 'Migrations'
truffle-issue-repro |    ----------------------
truffle-issue-repro |    > transaction hash:    0xb10be99812428882881e0b59afc72134831bb21bac55ec2908edc79e1666e200
truffle-issue-repro | - Blocks: 0            Seconds: 0
truffle-issue-repro |    > Blocks: 1            Seconds: 17
truffle-issue-repro |    > contract address:    0x6FDD222B1E4ce85F258f2988113F3ABE4ff84d02
truffle-issue-repro |    > block number:        1720521
truffle-issue-repro |    > block timestamp:     1574827581
truffle-issue-repro |    > account:             0x46777C79238bddbbD417E585ed2CC99b554d0934
truffle-issue-repro |    > balance:             1.06831367
truffle-issue-repro |    > gas used:            223305
truffle-issue-repro |    > gas price:           10 gwei
truffle-issue-repro |    > value sent:          0 ETH
truffle-issue-repro |    > total cost:          0.00223305 ETH
truffle-issue-repro |
truffle-issue-repro | Migrations contract deployed
truffle-issue-repro |
truffle-issue-repro |    Replacing 'Migrations'
truffle-issue-repro |    ----------------------
truffle-issue-repro | - Blocks: 0            Seconds: 0
truffle-issue-repro |    > transaction hash:    0x60a235d91c1778dcc16066ad20a1013ed6988e8e872bef7744e468ad6c6eba3d
truffle-issue-repro |    > Blocks: 2            Seconds: 25
truffle-issue-repro |    > contract address:    0x3a003334a998Bb6fa683884b6CbDe970D4679Cbd
truffle-issue-repro |    > block number:        1720523
truffle-issue-repro |    > block timestamp:     1574827611
truffle-issue-repro |    > account:             0x46777C79238bddbbD417E585ed2CC99b554d0934
truffle-issue-repro |    > balance:             1.06608062
truffle-issue-repro |    > gas used:            223305
truffle-issue-repro |    > gas price:           10 gwei
truffle-issue-repro |    > value sent:          0 ETH
truffle-issue-repro |    > total cost:          0.00223305 ETH
truffle-issue-repro |
truffle-issue-repro | Migrations contract deployed
truffle-issue-repro |
truffle-issue-repro |    Replacing 'Migrations'
truffle-issue-repro |    ----------------------
truffle-issue-repro |    > transaction hash:    0xb4660e356dede0bf0c2b0115326ad812690bf7ab291097ca79e0df7e1b22f7f1
truffle-issue-repro | - Blocks: 0            Seconds: 0
truffle-issue-repro |    > Blocks: 0            Seconds: 5
truffle-issue-repro |    > contract address:    0xF5B2253B50F9171e319188466e48ABCbEc6a7241
truffle-issue-repro |    > block number:        1720524
truffle-issue-repro |    > block timestamp:     1574827626
truffle-issue-repro |    > account:             0x46777C79238bddbbD417E585ed2CC99b554d0934
truffle-issue-repro |    > balance:             1.06384757
truffle-issue-repro |    > gas used:            223305
truffle-issue-repro |    > gas price:           10 gwei
truffle-issue-repro |    > value sent:          0 ETH
truffle-issue-repro |    > total cost:          0.00223305 ETH
truffle-issue-repro |
truffle-issue-repro | Migrations contract deployed
truffle-issue-repro |
truffle-issue-repro |    Replacing 'Migrations'
truffle-issue-repro |    ----------------------
truffle-issue-repro | - Blocks: 0            Seconds: 0
truffle-issue-repro |    > transaction hash:    0xf796c76d506472b53b5da9bb35b035392f5f5e016b7bc1f90eccf3bdea6dadb4
truffle-issue-repro |    > Blocks: 1            Seconds: 10
truffle-issue-repro |    > contract address:    0x55983E4BDcA7957b41fb73Eb34a01B045f4223fD
truffle-issue-repro |    > block number:        1720525
truffle-issue-repro |    > block timestamp:     1574827641
truffle-issue-repro |    > account:             0x46777C79238bddbbD417E585ed2CC99b554d0934
truffle-issue-repro |    > balance:             1.06384757
truffle-issue-repro |    > gas used:            223305
truffle-issue-repro |    > gas price:           10 gwei
truffle-issue-repro |    > value sent:          0 ETH
truffle-issue-repro |    > total cost:          0.00223305 ETH
truffle-issue-repro |
truffle-issue-repro | Migrations contract deployed
truffle-issue-repro |
truffle-issue-repro |    Replacing 'Migrations'
truffle-issue-repro |    ----------------------
truffle-issue-repro |    > transaction hash:    0x1d94429cd8914d483105cf5ae6b469d97d3c75acc70aaa9df05742a3d0ffe1d9
truffle-issue-repro | - Blocks: 0            Seconds: 0
truffle-issue-repro |    > Blocks: 2            Seconds: 22
truffle-issue-repro |    > contract address:    0x5f9De34FA225817D3A9B285f1431F667b492715b
truffle-issue-repro |    > block number:        1720527
truffle-issue-repro |    > block timestamp:     1574827671
truffle-issue-repro |    > account:             0x46777C79238bddbbD417E585ed2CC99b554d0934
truffle-issue-repro |    > balance:             1.05938147
truffle-issue-repro |    > gas used:            223305
truffle-issue-repro |    > gas price:           10 gwei
truffle-issue-repro |    > value sent:          0 ETH
truffle-issue-repro |    > total cost:          0.00223305 ETH
truffle-issue-repro |
truffle-issue-repro | Migrations contract deployed
truffle-issue-repro |
truffle-issue-repro |    Replacing 'Migrations'
truffle-issue-repro |    ----------------------
truffle-issue-repro |    > transaction hash:    0x41272e29876ef9e24fc2cfa0b93571dfffcad2b204d477a6705697585e0e000b
truffle-issue-repro | - Blocks: 0            Seconds: 0
truffle-issue-repro |    > Blocks: 1            Seconds: 9
truffle-issue-repro |    > contract address:    0x37f6C293e672d32DDb4EC04E62E17D3C9db81521
truffle-issue-repro |    > block number:        1720528
truffle-issue-repro |    > block timestamp:     1574827686
truffle-issue-repro |    > account:             0x46777C79238bddbbD417E585ed2CC99b554d0934
truffle-issue-repro |    > balance:             1.05938147
truffle-issue-repro |    > gas used:            223305
truffle-issue-repro |    > gas price:           10 gwei
truffle-issue-repro |    > value sent:          0 ETH
truffle-issue-repro |    > total cost:          0.00223305 ETH
truffle-issue-repro |
truffle-issue-repro | Migrations contract deployed
truffle-issue-repro |
truffle-issue-repro |    Replacing 'Migrations'
truffle-issue-repro |    ----------------------
truffle-issue-repro |    > transaction hash:    0x56c860a99434223ea4963c688544cda6009ae6e8e074c9c72a7eee029383e121
truffle-issue-repro | - Blocks: 0            Seconds: 0
truffle-issue-repro | Migrations contract deployed
truffle-issue-repro | Error: Error: Error:  *** Deployment Failed ***
truffle-issue-repro |
truffle-issue-repro | "Migrations" -- The contract code couldn't be stored, please check your gas limit..
truffle-issue-repro |
truffle-issue-repro |     at Object.run (/usr/src/app/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
truffle-issue-repro |     at processTicksAndRejections (internal/process/task_queues.js:86:5)
truffle-issue-repro | Truffle v5.0.26 (core: 5.0.26)
truffle-issue-repro | Node v11.15.0
truffle-issue-repro | npm ERR! code ELIFECYCLE
truffle-issue-repro | npm ERR! errno 1
truffle-issue-repro | npm ERR! eth-deployment-issue@0.2.0 migrate-goerli: `truffle migrate --network goerli --reset`
truffle-issue-repro | npm ERR! Exit status 1
truffle-issue-repro | npm ERR!
truffle-issue-repro | npm ERR! Failed at the eth-deployment-issue@0.2.0 migrate-goerli script.
truffle-issue-repro | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
truffle-issue-repro |
truffle-issue-repro | npm ERR! A complete log of this run can be found in:
truffle-issue-repro | npm ERR!     /root/.npm/_logs/2019-11-27T04_08_25_425Z-debug.log
truffle-issue-repro exited with code 1

@Vasiliy-Bondarenko
Copy link

repeated deployment with latest truffle 5.1.2 - same error.

@CruzMolina
Copy link
Contributor

#763 appears to be related.

@CruzMolina
Copy link
Contributor

CruzMolina commented Dec 12, 2019

I was going to suggest that we add some configurable polling logic possibly in here, but it looks like we may already have this as either a poorly documented or mostly undocumented feature (see the bullet point about websockets & confirmations in a truffle config).

According to those above docs, something like the below should work and might resolve this issue 🤞 :

module.exports = {
  ropsten: {
    network_id: "3",
    gas: 4000000,
    websockets: true, // (default: false)
    confirmations: 2, // (default: 0)
    provider: () => {
      return new HDWalletProvider(
        testnet.mneumonic,
        "https://ropsten.infura.io/v3/" + testnet.infura_id
      );
    }
  }
};

Side note: I've found evidence that websockets: true does not need to be specified.

There is also possibly another solution that might be something we could add to @truffle/hdwallet-provider (assuming this solution is actually related to this issue).

Please let us know if any of the above helps resolve this!

@Vasiliy-Bondarenko
Copy link

@CruzMolina, thanks for ideas... let's try...
some time passes by...
hm... not really helps :(

demo repo updated: git clone https://github.com/atato/eth-deployment-error.git
also i tried to use nonce tracker locally to avoid relying on infura nonces.
plus log level increased.

this time failed after 21 contracts deployed - i added counter.

log tail here: https://github.com/atato/eth-deployment-error/blob/master/latest.log

@CruzMolina
Copy link
Contributor

Thanks for giving those suggestions a shot @Vasiliy-Bondarenko ! It looks like the possible solution will be to add some polling logic to the getCode call on Migrations. I don't have the bandwidth to work on this in the short-term, but PRs are definitely welcome!

@Vasiliy-Bondarenko
Copy link

@CruzMolina well... i have tried to dig the code...
i have found where we error originates (sorry, in compiled bundle only)
in my truffle/build/cli.bundled.js it's line 76779, screenshot:
pycharm64_8JIHiZBMcJ
i collapsed some blocks to have a bigger picture on screen.
also i added throw new Error("HERE"); on the same line to get stack trace
here is what i got:

truffle-issue-repro |  <   {
truffle-issue-repro |  <     "id": 1190,
truffle-issue-repro |  <     "jsonrpc": "2.0",
truffle-issue-repro |  <     "result": "0x"
truffle-issue-repro |  <   }
truffle-issue-repro |
truffle-issue-repro | /usr/src/app/node_modules/truffle/build/webpack:/~/web3-eth/~/web3-core-method/src/index.js:333
truffle-issue-repro |                             utils._fireError(new Error('The contract code couldn\'t be stored, please check your gas limit.'), defer.eventEmitter,
 defer.reject);
truffle-issue-repro | ^
truffle-issue-repro | Error: HERE
truffle-issue-repro |     at Object.callback (/usr/src/app/node_modules/truffle/build/webpack:/~/web3-eth/~/web3-core-method/src/index.js:333:1)
truffle-issue-repro |     at sendTxCallback (/usr/src/app/node_modules/truffle/build/webpack:/~/web3-eth/~/web3-core-method/src/index.js:484:1)
truffle-issue-repro |     at /usr/src/app/node_modules/truffle/build/webpack:/~/web3-core-requestmanager/src/index.js:167:1
truffle-issue-repro |     at /usr/src/app/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:164:1
truffle-issue-repro |     at /usr/src/app/node_modules/truffle/build/webpack:/packages/truffle-resolver/~/async/internal/slice.js:9:1
truffle-issue-repro |     at finished (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_mo
dules/web3-provider-engine/index.js:159:1)
truffle-issue-repro |     at default (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_mod
ules/async/internal/once.js:6:1)
truffle-issue-repro |     at d (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_modules/a
sync/internal/eachOfLimit.js:56:1)
truffle-issue-repro |     at /usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_modules/asyn
c/internal/eachOfLimit.js:59:1
truffle-issue-repro |     at t.default (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_m
odules/async/eachLimit.js:43:1)
truffle-issue-repro |     at value (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_modul
es/async/internal/doLimit.js:4:1)
truffle-issue-repro |     at eachSeries (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_
modules/web3-provider-engine/index.js:134:1)
truffle-issue-repro |     at end (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_modules
/web3-provider-engine/subproviders/provider.js:19:1)
truffle-issue-repro |     at t.callback [as onreadystatechange] (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnida
n/src/work/truffle/node_modules/web3/node_modules/web3-providers-http/src/index.js:96:1)
truffle-issue-repro |     at t._a [as dispatchEvent] (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/
truffle/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:27:61)
truffle-issue-repro |     at t.dispatchEvent [as _setReadyState] (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnid
an/src/work/truffle/node_modules/xhr2-cookies/dist/xml-http-request.js:208:1)
truffle-issue-repro |     at t._setReadyState [as _onHttpResponseEnd] (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users
/gnidan/src/work/truffle/node_modules/xhr2-cookies/dist/xml-http-request.js:318:1)
truffle-issue-repro |     at IncomingMessage._onHttpResponseEnd (/usr/src/app/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnida
n/src/work/truffle/node_modules/xhr2-cookies/dist/xml-http-request.js:289:47)
truffle-issue-repro |     at IncomingMessage.emit (events.js:198:15)
truffle-issue-repro |     at endReadableNT (_stream_readable.js:1139:12)
truffle-issue-repro |     at processTicksAndRejections (internal/process/task_queues.js:81:17)
truffle-issue-repro | npm ERR! code ELIFECYCLE
truffle-issue-repro | npm ERR! errno 1
truffle-issue-repro | npm ERR! eth-deployment-issue@0.2.0 migrate-goerli: `truffle migrate --network goerli --reset --verbose-rpc`
truffle-issue-repro | npm ERR! Exit status 1
truffle-issue-repro | npm ERR!
truffle-issue-repro | npm ERR! Failed at the eth-deployment-issue@0.2.0 migrate-goerli script.
truffle-issue-repro | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
truffle-issue-repro |
truffle-issue-repro | npm ERR! A complete log of this run can be found in:
truffle-issue-repro | npm ERR!     /root/.npm/_logs/2019-12-14T15_04_16_303Z-debug.log

so the error comes from web3: web3-core-method/src/index.js:333
which means to me that you this code is called from https://github.com/trufflesuite/truffle/blob/develop/packages/migrate/index.js#L187-L191
there is an error here... you can't check the success by comparing to "0x". it will never be returned - it will be error thrown instead.
probably it's not how it really works. as i said, this code is a bit too much for me. :) but may be it gives you a bit more information about the issue.

@hrishikeshio
Copy link

hrishikeshio commented Dec 16, 2019

Having same issues. This is slowing down us a lot. We have to try around 12 times to finally complete the migration succesfully.

`% truffle migrate --reset --network goerli

Compiling your contracts...

Everything is up to date, there is nothing to compile.

Starting migrations...

Network name: 'goerli'
Network id: 5
Block gas limit: 0x7a1200

1_initial_migration.js

Replacing 'Migrations'

transaction hash: 0x63d532a010cfcde8e8b86fdb82ddcb0141c2c1a0b23c615239a3116fde0209bc
Blocks: 2 Seconds: 33
contract address: 0xD82fDD2d8dC4AfFE7608c852350D427962ECfc25
block number: 1829861
block timestamp: 1576467994
account: 0xe092b1fa25DF5786D151246E492Eed3d15EA4dAA
balance: 20.485095783
gas used: 225237
gas price: 20 gwei
value sent: 0 ETH
total cost: 0.00450474 ETH

Saving migration to chain.
Saving artifacts


Total cost: 0.00450474 ETH

2_deploy.js

Replacing 'SchellingCoin'

transaction hash: 0xf308d2083bd80dd7a7a11130505035d0257210ca9a793ef0b6ec5943a35074a0

Error: *** Deployment Failed ***

"SchellingCoin" -- The contract code couldn't be stored, please check your gas limit..

at /Users/hrishi/.nvm/versions/node/v11.15.0/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:362:1
at processTicksAndRejections (internal/process/task_queues.js:86:5)

Truffle v5.1.2 (core: 5.1.2)
Node v11.15.0

Update: changing confirmation blocks to 1 worked. Deployed in a single try. Might have got lucky.

@Vasiliy-Bondarenko
Copy link

@hrishikeshio, which Ethereum node are you using? private node or infura or something else?

@hrishikeshio
Copy link

@Vasiliy-Bondarenko private geth node for görli

@Vasiliy-Bondarenko
Copy link

thanks, @hrishikeshio.
this means the issue IS NOT specific to infura and load balancing. it should be only related to truffle/web3.

@0x234
Copy link

0x234 commented Dec 20, 2019

We're experiencing similar behaviour on mainnet. The migration fails with

   Deploying 'PaymentStartInFlightExit'
   ------------------------------------
   > transaction hash:    0x5f3fa29a35623e7f8e1e3a8724acc1856d2248eb1eb9cd441d6114af8d22c0a7

Error: Error: Error:  *** Deployment Failed ***

"PaymentStartInFlightExit" -- The contract code couldn't be stored, please check your gas limit..

And the transaction is successful: https://etherscan.io/tx/0x5f3fa29a35623e7f8e1e3a8724acc1856d2248eb1eb9cd441d6114af8d22c0a7

Interestingly I've not experienced failure with these contracts on Rinkeby or Ropsten, only Mainnet.

No joy with implementing the work around from @CruzMolina with:

    websockets: true, // (default: false)
    confirmations: 2, // (default: 0)

Deployment is via Infura.

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

No branches or pull requests

9 participants