We have a bug with Web3 1.0.0-beta.55 (and earlier versions up to 1.0.0-beta.38) when calling https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods-mymethod-send - it takes a lot of time to wait despite the transaction is mined. Here are the lines of code where we observe that: https://github.com/poanetwork/posdao-test-setup/blob/2837456e1a4a8d93f632a8b8f49cc617d13b81b1/scripts/deploy-staking-token.js#L50-L59 (steps to reproduce are below).
The same is observed for web3.eth.sendSignedTransaction function.
However, if we change Web3 version to 1.0.0-beta.37, it works fine.
Calling https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods-mymethod-send should finish in a few seconds as soon as the transaction is mined.
Calling https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods-mymethod-send waits for a long time despite the transaction is successfully mined.
git clone -b web3-bug https://github.com/poanetwork/posdao-test-setupcd posdao-test-setupnpm run stop-test-setupnpm run allAfter these steps you will see **** Deploying StakingToken message. There should also be StakingToken deployed at: 0x6f7A73c96Bd56f8B0dEBC795511EDA135e105eA3 message in 5-10 seconds but it doesn't appear for a long time.
To stop test setup, perform npm run stop-test-setup command.
The issue is in these lines of code: https://github.com/poanetwork/posdao-test-setup/blob/2837456e1a4a8d93f632a8b8f49cc617d13b81b1/scripts/deploy-staking-token.js#L50-L59
If you change Web3 version to 1.0.0-beta.37 in the package.json and start again with npm run stop-test-setup && npm run all, you will see it works fine: the **** StakingToken deployed at: 0x6f7A73c96Bd56f8B0dEBC795511EDA135e105eA3 message appears after **** Deploying StakingToken in a few seconds.
Just follow the steps to reproduce and you will see that the transaction is mined but the result is not returned by https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods-mymethod-send in time.
To see node's logs, open parity-data/node1/log file.
Thanks, for opening this issue! Did you configure the transactionConfirmationBlocks as described in the documentation of Web3?
I think this is not the issue. I think the default value of transactionConfirmationBlocks is 24, as @nivida suggest if you want tx receipt immediately after the transaction is mined then set transactionConfirmationBlocks to 1.
Tested on Ropsten network with [email protected].
Thanks for the suggestion. I'll try to set transactionConfirmationBlocks explicitly.
Yes, that was the reason - I set web3.eth.transactionConfirmationBlocks = 1; and it worked like before. So, I'm closing it. Thanks!
Most helpful comment
Yes, that was the reason - I set
web3.eth.transactionConfirmationBlocks = 1;and it worked like before. So, I'm closing it. Thanks!