From 3b67602c4c5e701028c7246977aabff02cce643c Mon Sep 17 00:00:00 2001 From: gzeon Date: Wed, 23 Jul 2025 12:41:37 +0900 Subject: [PATCH] eth/gasestimator: fix potential overflow (#32255) Improve binary search, preventing the potential overflow in certain L2 cases --- eth/gasestimator/gasestimator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/gasestimator/gasestimator.go b/eth/gasestimator/gasestimator.go index 98a4f74b3e..7e9d8125de 100644 --- a/eth/gasestimator/gasestimator.go +++ b/eth/gasestimator/gasestimator.go @@ -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