Skip to content

Commit

Permalink
Remove bestguess
Browse files Browse the repository at this point in the history
  • Loading branch information
somnathb1 committed Feb 22, 2025
1 parent e6ad4a1 commit 46fcc9e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions hive-local-a9e7a206/hive
Submodule hive added at 4af482
1 change: 1 addition & 0 deletions hive-local-dd899b2f/hive
Submodule hive added at 4af482
9 changes: 1 addition & 8 deletions turbo/jsonrpc/eth_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs
// We want to ensure that the gas used doesn't fall below this
trueGas := result.EvmGasUsed // Must not fall below this
lo = trueGas + result.EvmRefund - 1
bestGuess := ((result.UsedGas + result.EvmRefund + params.CallStipend) * 64) / 63
i := 0

i := 0
// Execute the binary search and hone in on an executable gas limit
for lo+1 < hi {
mid := (hi + lo) / 2
Expand All @@ -293,14 +292,8 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs
lo = mid
} else {
hi = mid
if mid < bestGuess {
bestGuess = mid
}
}
i++
if i > 1000 {
return hexutil.Uint64(bestGuess), nil
}
}
return hexutil.Uint64(hi), nil
}
Expand Down

0 comments on commit 46fcc9e

Please sign in to comment.