Contract transaction couldn't be found after 50 blocks
Raised by Dan Turner.
This bug appears with a single ethermint node deployment. There are two machines using node.js making requests to geth, one 'local' and one 'Travis' machine. They are both attempting to deploy a contract using the same account. The node.js app is using this library to submit the transaction: https://github.com/ConsenSys/hooked-web3-provider/blob/master/app/hooked-web3-provider.es6#L81
What we've seen is that the same tx will fail sometimes, but restarting ethermint will allow it to succeed.
[17:09:54] Starting 'concat'...
[17:09:54] Finished 'concat' after 47 ms
[17:09:54] Starting 'compile'...
Using Geth @ 'http://node-1.<snipped>:8545'
[17:10:01] Finished 'compile' after 7.11 s
[17:10:01] Starting 'deploy'...
Redeploy contracts: true
Deploy: DateTime
DateTime: doesn't exist
Nonce: 0x436
Contract "DateTime" transaction sent: TransactionHash: 0x118df26e014ff76da1db09967ac7082c392c48038e5b4f87fbc330aa83a13938 waiting to be mined...
Error: Contract transaction couldn't be found after 50 blocks
Then restart ethermint, and...
[17:12:38] Using gulpfile ~/code/canchain-api/gulpfile.js
[17:12:38] Starting 'concat'...
[17:12:38] Finished 'concat' after 41 ms
[17:12:38] Starting 'compile'...
Using Geth @ 'http://node-1.<snipped>:8545'
[17:12:45] Finished 'compile' after 7.08 s
[17:12:45] Starting 'deploy'...
Redeploy contracts: true
Deploy: DateTime
DateTime: doesn't exist
Nonce: 0x436
Contract "DateTime" transaction sent: TransactionHash: 0x118df26e014ff76da1db09967ac7082c392c48038e5b4f87fbc330aa83a13938 waiting to be mined...
DateTime mined! Address: 0x7507cd7f730da66a2d326ed41f838f26af41082f
Saved contract
Notice that the tx hash is identical.
Since there is only 1 node, and according to Dan only geth was used to submit transactions, it's probably unrelated to #10.
is that still valid ?
Still reproduced. Will add details later
The cause of this issue:
- go-ethereum has flag
homestead. It affect to gas price of operation in EVM. Whenhomesteadis true cost of EVM command is increased. - By default go-ethereum started with
homestead=false. - You want to deploy big smart contract you need to know gas for it. You use
web3.eth.estimateGasfunction to calc it. But when you call this function yourgo-ethereumworks withhomestead=falseand calc gas cheaper. web3.eth.estimateGasreturns your some value and you pass this value asgas limitfor smart contract deploy transaction.- but in
app.validateTxethermint calc gas ashomestead = true(https://github.com/tendermint/ethermint/blob/master/app/app.go#L223) and it require more gas for it transaction than you passed. app.validateTx->app.CheckTxreturns error and smart contract never deployed
Fixed :-)