trufflesuite / truffle-hdwallet-provider

HD Wallet-enabled Web3 provider
MIT License
400 stars 167 forks source link

Error: Contract transaction couldn't be found after 50 blocks #92

Open kyriediculous opened 5 years ago

kyriediculous commented 5 years ago

Hi,

I am using hd-wallet-provider to sign deployments on a 0 gasPrice local network.

deployments always went fine, I even redeployed on my local network yesterday. But since this morning I'm getting an error on ANY migration file I try to run.

"Error; Contract transaction couldn't be found after 50 blocks"

I just pruned my entire docker state to deploy a new local network. Despite running with the--reset flag, truffle does not overwrite the existing contracts I see in truffle networks

CLIENT=dev truffle migrate --reset --network development --verbosity-prc

Truffle version 4.1.15 (Migrating to 5.0.0 is not possible/simple for me currently as I use some new reserved keywords so its a bit of extra work)

    development: {
      provider: _ => new HDWalletProvider('...', "http://localhost:8545"),
      gasPrice: '0',
      network_id: '6660001',
      gasLimit: 8000000
}

This is the last bit of output:

   > {
   >   "jsonrpc": "2.0",
   >   "id": 59,
   >   "method": "eth_uninstallFilter",
   >   "params": [
   >     "0x1"
   >   ]
   > }
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Contract transaction couldn't be found after 50 blocks
    at C:\Users\N.vergauwen\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\contract.js:112:1
    at C:\Users\N.vergauwen\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\filter.js:128:1
    at Array.forEach (<anonymous>)
    at C:\Users\N.vergauwen\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\filter.js:127:1
    at Array.forEach (<anonymous>)
    at Object.onMessage [as callback] (C:\Users\N.vergauwen\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\filter.js:125:1)
    at C:\Users\N.vergauwen\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:259:1
    at Array.forEach (<anonymous>)
    at C:\Users\N.vergauwen\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:258:10
    at C:\Users\N.vergauwen\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:225:1
    at C:\Users\N.vergauwen\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-provider\wrapper.js:134:1
    at C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\internal\map.js:32:1
    at C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\internal\once.js:12:1
    at l (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\eachOf.js:60:1)
    at C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\internal\onlyOnce.js:12:1
    at C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\internal\map.js:29:1
    at C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\web3-provider-engine\index.js:159:1
    at C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\internal\once.js:12:1
    at d (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\internal\eachOfLimit.js:61:1)
    at C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\internal\eachOfLimit.js:71:1
    at e.default (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\eachLimit.js:43:1)
    at C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\async\internal\doLimit.js:9:1
    at s (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\web3-provider-engine\index.js:134:1)
    at c.getFilterChanges (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\web3-provider-engine\subproviders\filters.js:174:1)
    at Timeout._onTimeout (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\web3-provider-engine\subproviders\filters.js:72:1)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)

Similar issues:

https://github.com/trufflesuite/truffle-migrate/issues/15 https://github.com/trufflesuite/truffle/issues/852

kyriediculous commented 5 years ago

Tried removing the build folder to overwrite existing addresses. Didn't work

Tried running truffle networks --clean and truffle networks --clean development but this only removes unnamed networks so my "development" network is still there. Didn't work.

Tried suggestion from https://github.com/trufflesuite/truffle/issues/852 to not wrap the hd-wallet-provider in a function. Didn't work.

Tried uninstalling an reinstalling truffle as a global npm dependency. DIdn't work

Tried rebooting (you never know, right? :) ) Didn't work.

Tried upgrading truffle-hdwallet-providerv1.0.2 to v1.0.3. Didn't work

Tried running provider.engine.stop() on hdwallet-provider through truffle exec, didn't work.

When running migrations on another network (eg testRPC or ganache) everything is fine.

I also have no idea how to reproduce the error, possibly I interrupted a migration in progress.

kyriediculous commented 5 years ago

I just cleaned my development network. Issue still persists, as you can see I just did a succesful deploy on ganache (5777)


$ truffle networks

The following networks are configured to match any network id ('*'):

    ganache
    knuckles

Closely inspect the deployed networks below, and use `truffle networks --clean` to remove any networks that don't match your configuration. You should not use the wildcard configuration ('*') for staging and production networks for which you intend to deploy your application.

Network: UNKNOWN (id: 5777)
  BountyContract: 0x5407b04d2cfa16fbd4b171705f73f309928f3454
  BountyFactory: 0x83d45129187e8e64529c806c82ca5d3146f77524
  Migrations: 0x3192474569cfa13354ad80406b73f416f1a9f0b4
  OrganisationContract: 0x0fe36e19cd1ad9d39774613dcad130e82bc4f870
  RecurringBountyContract: 0x41cab09e38d9259ffde08d61ae39b59ec32af6bb
  RecurringBountyFactory: 0xd87d969229641cf68f2ab1e44d0d895d808e0e6f
  RewardStore: 0x523a8952faaf44aea2654e7fde78d5d0c62365a1
  Timesheets: 0xe926936bab1b573fb16d7ce87adca87e272832bf
  Token: 0xef2b4d91bd804f77b20fad7360865fcfef11269d
  TokenFaucet: 0x01b73c45712658fc73b442170d5b52eda2481ac2
  UsersRegistry: 0x6dd9e99f2009ba831694a13408c2b7b319a84240

Network: development (id: 6660001)
  No contracts deployed.
kyriediculous commented 5 years ago

@cgewecke seeing as you have handled previous similar issues, do you have any suggestions? is your PR (https://github.com/trufflesuite/truffle-core/pull/135/files#diff-2cce40143051e25f811b56c79d619bf5R50) merged into 4.1.15? I can not find the changes in my build.

I will try truffle 5.0.0 on a new branch now.

Edit: On Truffle 5.0.3 with truffle-hdwallet-provider@web3-one my migration just hangs on the first one

Edit2: Same version (5.0.3 and web3-one for wallet) but wrapping provider in a function returns errors instead of hanging:


1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0xaf4896a0c4e3846f309d07dab78fa7ef090e971317782facffaace69134ccade
- Blocks: 0            Seconds: 0
Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\cruzmolina\Code\truffle-projects\truffle\node_modules\web3\node_modules\web3-core-helpers\src\errors.js:42:1)
    at e.InvalidResponse [as onreadystatechange] (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\cruzmolina\Code\truffle-projects\truffle\node_modules\web3\node_modules\web3-providers-http\src\index.js:92:1)
    at e.call [as dispatchEvent] (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\cruzmolina\Code\truffle-projects\truffle\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:1)
    at e.dispatchEvent [as _setReadyState] (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\cruzmolina\Code\truffle-projects\truffle\node_modules\xhr2-cookies\dist\xml-http-request.js:208:1)
    at e._setReadyState [as _onHttpRequestError] (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\cruzmolina\Code\truffle-projects\truffle\node_modules\xhr2-cookies\dist\xml-http-request.js:349:1)
    at ClientRequest._onHttpRequestError (C:\Users\N.vergauwen\desktop\knuckles.eth\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\cruzmolina\Code\truffle-projects\truffle\node_modules\xhr2-cookies\dist\xml-http-request.js:252:47)
    at ClientRequest.emit (events.js:182:13)
    at Socket.socketErrorListener (_http_client.js:391:9)
    at Socket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
kyriediculous commented 5 years ago

I just reset my miners and node (docker-compose up --build) , upped verbosity to three so I can see that miners are in sync (they are) and now it migrates...

Must have been a chain problem I suppose... Even though I had reset my chain before.

Probably another hint that this was a problem with my chain was that the "not found within 50 blocks" error almost came instantly , despite a 5 second blocktime.

The chain however was running, because I could succesfully query the chainID and geth version.

I'm a bit confused about this still, but at least I can continue development.