• Roberto Bayardo's avatar
    internal/ethapi: optimize & clean up EstimateGas (#27710) · 950ccddf
    Roberto Bayardo authored
    Optimizations:
    
    - Previously, if a transaction was reverting, EstimateGas would exhibit worst-case behavior and binary search up to the max gas limit (~40 state-clone + tx executions). This change allows EstimateGas to return after only a single unconstrained execution in this scenario.
    - Uses the gas used from the unconstrained execution to bias the remaining binary search towards the likely solution in a simple way that doesn't impact the worst case. For a typical contract-invoking transaction, this reduces the median number of state-clone+executions from 25 to 18 (28% reduction).
    
    Cleanup:
    
    - added & improved function + code comments
    - correct the EstimateGas documentation to clarify the gas limit determination is at latest block, not pending, if the blockNr is unspecified.
    950ccddf
Name
Last commit
Last update
..
blocktest Loading commit data...
build Loading commit data...
cmdtest Loading commit data...
debug Loading commit data...
ethapi Loading commit data...
flags Loading commit data...
guide Loading commit data...
jsre Loading commit data...
shutdowncheck Loading commit data...
syncx Loading commit data...
testlog Loading commit data...
utesting Loading commit data...
version Loading commit data...
web3ext Loading commit data...