-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Description
System information
Geth version: 1.8.0-unstable-56152b31 (also 1.7.3-stable-4bb3c89d)
OS & Version: Windows/Linux/OSX
Commit hash : 56152b31ac251d1cc68fcddbdad159ba5234c415
Expected behaviour
eth_estimateGas is more or less as performant as eth_call.
Actual behaviour
eth_estimateGas takes seconds or minutes to run.
Steps to reproduce the behaviour
I don't have a sure fire repro but have seen it happen if you make the call just a couple seconds after starting geth, or sometimes it takes hours before it gets into this state.
However, during testing I noticed two things:
- EstimateGas does a binary search instead of using the
gasUsedreturned fromdoCall. Why? - It also uses
rpc.PendingBlockNumber, with no option for a block param (see internal/ethapi: eth_estimateGas should take block number #2586)
So, as a test I switched to rpc.LatestBlockNumber in ryanschneider@7df8498, and was unable to reproduce the issue after throwing a lot of test traffic at it.
I'd love to help track down the issue, but don't have clarity into why the binary search is used. Also my current theory is that there is contention on the pending block, does that sounds like a reasonable place to look?
Backtrace
I'll get a debug.stacks output from either 1.7.3 or master here the next time I see the issue.