Skip to content

Commit 3b67602

Browse files
authored
eth/gasestimator: fix potential overflow (ethereum#32255)
Improve binary search, preventing the potential overflow in certain L2 cases
1 parent a7efdcb commit 3b67602

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

eth/gasestimator/gasestimator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func Estimate(ctx context.Context, call *core.Message, opts *Options, gasCap uin
170170
break
171171
}
172172
}
173-
mid := (hi + lo) / 2
173+
mid := lo + (hi-lo)/2
174174
if mid > lo*2 {
175175
// Most txs don't need much higher gas limit than their gas used, and most txs don't
176176
// require near the full block limit of gas, so the selection of where to bisect the

0 commit comments

Comments
 (0)