From cae375f1419b5b2cebec5b449a7aa073dbb537ff Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Tue, 4 Nov 2025 23:17:42 +0800 Subject: [PATCH] core/vm: optimize osakaMultComplexity --- core/vm/contracts.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/vm/contracts.go b/core/vm/contracts.go index cae0be9f2d..99c954e3de 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -456,11 +456,10 @@ func osakaMultComplexity(x uint64) uint64 { } // For x > 32, return 2 * berlinMultComplexity(x) result := berlinMultComplexity(x) - carry, result := bits.Mul64(result, 2) - if carry != 0 { + if result >= (1 << 63) { // overflow check return math.MaxUint64 } - return result + return result << 1 } // modexpIterationCount calculates the number of iterations for the modexp precompile.