conversation link: https://gitter.im/ConsenSys/truffle?at=5d94748c6d4b2512c1519b87
I'm trying to migrate a helloworld smart contract on my local ethereum dev/test net (geth + genesis with my keys) using truffle. The migration fails when the package @truffle/hdwallet-provider is used but works with the old package truffle-hdwallet-provider. Strangely it works fine for both packages when deployed on ganache, so it looks like it's a geth specific problem for @truffle/hdwallet-provider
Here is my truffle-config.js file:
const HDWalletProvider = require('@truffle/hdwallet-provider');
const privateKey = "e46cae82c1e350c7b00070a2b8414dead89b2d768f1c09410b668d21cd4b4eea"; // dummy testing key
module.exports = {
networks: {
gethtestnet: {
provider: () =>
new HDWalletProvider(privateKey, "http://geth-test-net.k8s.local/rpc"),
network_id: 3516,
}
},
compilers: {
solc: {
version: "0.5.10",
settings: {
evmVersion: "petersburg"
}
}
}
}
(if anyone wonders about my hostname, my node runs in docker-desktop kubernetes and an nginx ingress maps /rpc against :8545)
here is my genesis file (might this help)
{
"config": {
"chainId": 3516,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"clique": {
"period": 1,
"epoch": 30000
}
},
"nonce": "0x0",
"timestamp": "0x5cacf490",
"extraData": "0x000000000000000000000000000000000000000000000000000000000000000017f934cD8A8b086F772Bc11C42Bb7c2c0310320C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x989680",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"17f934cD8A8b086F772Bc11C42Bb7c2c0310320C": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
I should be able to deploy my contracts importing my privatekey and using the latest package @truffle/hdwallet-provider
running truffle migrate --network gethtestnet fails with
/Users/bob/dev/poc/helloworld-solidity/node_modules/async/internal/eachOfLimit.js:61
callback(null);
^
TypeError: finished is not a function
at /Users/bob/dev/poc/helloworld-solidity/node_modules/web3-provider-engine/index.js:159:9
at /Users/bob/dev/poc/helloworld-solidity/node_modules/async/internal/once.js:12:16
at replenish (/Users/bob/dev/poc/helloworld-solidity/node_modules/async/internal/eachOfLimit.js:61:25)
at /Users/bob/dev/poc/helloworld-solidity/node_modules/async/internal/eachOfLimit.js:71:9
at eachLimit (/Users/bob/dev/poc/helloworld-solidity/node_modules/async/eachLimit.js:43:36)
at /Users/bob/dev/poc/helloworld-solidity/node_modules/async/internal/doLimit.js:9:16
at end (/Users/bob/dev/poc/helloworld-solidity/node_modules/web3-provider-engine/index.js:134:5)
at /Users/bob/dev/poc/helloworld-solidity/node_modules/web3-provider-engine/subproviders/provider.js:19:5
at XMLHttpRequest.request.onreadystatechange (/Users/bob/dev/poc/helloworld-solidity/node_modules/web3-providers-http/src/index.js:96:13)
at XMLHttpRequestEventTarget.dispatchEvent (/Users/bob/dev/poc/helloworld-solidity/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
at XMLHttpRequest._setReadyState (/Users/bob/dev/poc/helloworld-solidity/node_modules/xhr2-cookies/xml-http-request.ts:219:8)
at XMLHttpRequest._onHttpResponseEnd (/Users/bob/dev/poc/helloworld-solidity/node_modules/xhr2-cookies/xml-http-request.ts:345:8)
at IncomingMessage.<anonymous> (/Users/bob/dev/poc/helloworld-solidity/node_modules/xhr2-cookies/xml-http-request.ts:311:39)
at IncomingMessage.emit (events.js:214:15)
at endReadableNT (_stream_readable.js:1178:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
on geth side, I'm getting
WARN [10-02|09:29:45.900] Served eth_sendRawTransaction conn=10.1.4.241:36264 reqid=1570008585867307 t=160.7碌s err="invalid sender"
whereas it works perfectly fine if const HDWalletProvider = require('truffle-hdwallet-provider'); is used in truffle-config.js. Again it works against ganache for both packages (which removes any uncertainty about installation, etc)
> geth version
Geth
Version: 1.9.5-stable
Architecture: amd64
Protocol Versions: [63]
Network Id: 1
Go Version: go1.13
Operating System: darwin
GOPATH=/Users/bob/go
GOROOT=/usr/local/Cellar/go/1.13/libexec
> truffle version
Truffle v5.0.38 (core: 5.0.38)
Solidity - 0.5.10 (solc-js)
Node v12.10.0
Web3.js v1.2.1
v12.10.0):6.11.3): Thanks for raising this! We'll look into this and let you know what we find.
Thank goodness, I'm going to be tortured to death.
I have the same issue with Infura
Same here, using @truffle/hdwallet-provider. Deploying to ropsten using Infura
So the last working version seems to be @truffle/[email protected]. I just confirmed that @truffle/[email protected] fails as described above.
Commenting to help anybody else: I was getting the following error:
Uncaught TypeError: finished is not a function
Downgrading to @truffle/[email protected] fixed it. Thanks @eggplantzzz
Would love to help fix this. How do I get started?
Sorry @johnletey, I found the library that caused the problem and downgraded it to fix this issue here :(
However! We will probably want to eventually upgrade this dependency for realz...so if you want to upgrade the dep and try to make it function properly then it would be super! But no pressure.
So the last working version seems to be
@truffle/[email protected]. I just confirmed that@truffle/[email protected]fails as described above.
Confirm that downgrade fixes this issue. just make sure to have an exact version specifier in your package.json file. I've got "@truffle/hdwallet-provider": "^1.0.18" and it actually installs the 1.0.20 version. The "@truffle/hdwallet-provider": "1.0.18" solved the problem.
Sorry @johnletey, I found the library that caused the problem and downgraded it to fix this issue here :(
No need to say sorry! Just wanted to start contributing to this amazing project!
However! We will probably want to eventually upgrade this dependency for realz...so if you want to upgrade the dep and try to make it function properly then it would be super! But no pressure.
I'll definitely look into it and see what I can do!
Sorry @johnletey, I found the library that caused the problem and downgraded it to fix this issue here :(
However! We will probably want to eventually upgrade this dependency for realz...so if you want to upgrade the dep and try to make it function properly then it would be super! But no pressure.
Thanks for the fix @eggplantzzz, do you know when this will be released?
@gjgd It should be released tomorrow. I think it will be version 5.0.40.
By the way @johnletey, check out the CONTRIBUTING.md for some general information about Truffle's flow. Truffle is kind of complex and a little hard to get involved with in the beginning. That doc might give you a leg-up in understanding the project if you are interested in getting involved.
By the way @johnletey, check out the CONTRIBUTING.md for some general information about Truffle's flow. Truffle is kind of complex and a little hard to get involved with in the beginning. That doc might give you a leg-up in understanding the project if you are interested in getting involved.
Thanks! Checking it out now!
So this issue should be fixed with the release of @truffle/hdwallet-provider version 1.0.21. Here is the relevant PR.
I'm still getting the same error with 1.0.21
TypeError: finished is not a function
at node_modules/web3-provider-engine/index.js:159:9
at node_modules/async/internal/once.js:12:16
at replenish (node_modules/async/internal/eachOfLimit.js:61:25)
at node_modules/async/internal/eachOfLimit.js:71:9
at eachLimit (node_modules/async/eachLimit.js:43:36)
at node_modules/async/internal/doLimit.js:9:16
at end (node_modules/web3-provider-engine/index.js:134:5)
at node_modules/web3-provider-engine/subproviders/provider.js:19:5
at XMLHttpRequest.request.onreadystatechange (node_modules/web3/node_modules/web3-providers-http/src/index.js:96:13)
at XMLHttpRequest.Object.<anonymous>.XMLHttpRequestEventTarget.dispatchEvent (node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
at XMLHttpRequest.Object.<anonymous>.XMLHttpRequest._setReadyState (node_modules/xhr2-cookies/xml-http-request.ts:219:8)
at XMLHttpRequest.Object.<anonymous>.XMLHttpRequest._onHttpResponseEnd (node_modules/xhr2-cookies/xml-http-request.ts:345:8)
at IncomingMessage.<anonymous> (node_modules/xhr2-cookies/xml-http-request.ts:311:39)
I'm working on a minimal example that reproduces that error
@gjgd Ok, let me know if you make one. I can't duplicate this error when deploying to Rinkeby any more.
working with ganache but not with kovan and a private POA running geth 1.9.6
also tried with websocket provider with no luck :(

I am able to migrate a simple project to Kovan, Rinkeby, and Ropsten. Do you have a project that I could try to deploy @zgorizzo69? Perhaps this problem is not related to the provider at all.
It is possible that this change to hdwallet-provider is causing it to error differently and it just seems like a different problem. If you can give me a project to try and migrate it might be helpful to have another data point.
@eggplantzzz Here is a minimal example of the bug: https://github.com/gjgd/truffle-hdwallet-provider-bug-example
Instructions to run are in the README.
The bug is reproduceable with version 1.0.21, 1.0.20 and 1.0.19 of @truffle/hdwallet-provider but not with versions below 1.0.18
Thanks for the example @gjgd! I will check it out today.
So when I follow your instructions, I get the error specified. However, when I change the mnemonic to be the one ganache is using to create unlocked accounts, I do not get it. Instead it endlessly polls for the block number. I'm still not sure what's going on here, I'll keep investigating.
On hdwallet-provider version 1.0.18 I get an unhandled rejection error. I'm starting to think a bunch of these errors might be different errors that are just erroring differently then they used to. This doesn't explain why some projects might get errors with 1.0.21 and NOT with 1.0.18.
@eggplantzzz Here is a minimal example of the bug: https://github.com/gjgd/truffle-hdwallet-provider-bug-example
Instructions to run are in the README.
The bug is reproduceable with version 1.0.21, 1.0.20 and 1.0.19 of @truffle/hdwallet-provider but not with versions below 1.0.18
@gjgd Thank you very much for the example provided! It looks like my bad.
I was guided by types for web3-provider-engine where it was specified that send method does not require callback.
I'll fix it now.
I apologize for the inconvenience
Can confirm that v1.0.22 solved the error, thanks @MrRefactoring @eggplantzzz
Most helpful comment
Can confirm that v1.0.22 solved the error, thanks @MrRefactoring @eggplantzzz