eth/gasestimator: fix potential overflow (#32255)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

Improve binary search, preventing the potential overflow in certain L2 cases
This commit is contained in:
gzeon 2025-07-23 12:41:37 +09:00 committed by GitHub
parent a7efdcbf09
commit 3b67602c4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -170,7 +170,7 @@ func Estimate(ctx context.Context, call *core.Message, opts *Options, gasCap uin
break
}
}
mid := (hi + lo) / 2
mid := lo + (hi-lo)/2
if mid > lo*2 {
// Most txs don't need much higher gas limit than their gas used, and most txs don't
// require near the full block limit of gas, so the selection of where to bisect the