From e5360e0f70460e5e2942eb3ccceb5a81dcc58cc2 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Thu, 2 Jul 2026 21:01:37 +0800 Subject: [PATCH] core/vm: map ErrMaxInitCodeSizeExceeded to VM error code ErrMaxInitCodeSizeExceeded was not mapped in vmErrorCodeFromErr, so VMErrorFromErr reported VMErrorCodeUnknown for initcode size violations. --- core/vm/errors.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/vm/errors.go b/core/vm/errors.go index b6235d44a6..8af5dfe1a4 100644 --- a/core/vm/errors.go +++ b/core/vm/errors.go @@ -153,6 +153,7 @@ const ( VMErrorCodeStackUnderflow VMErrorCodeStackOverflow VMErrorCodeInvalidOpCode + VMErrorCodeMaxInitCodeSizeExceeded // VMErrorCodeUnknown explicitly marks an error as unknown, this is useful when error is converted // from an actual `error` in which case if the mapping is not known, we can use this value to indicate that. @@ -175,6 +176,8 @@ func vmErrorCodeFromErr(err error) int { return VMErrorCodeExecutionReverted case errors.Is(err, ErrMaxCodeSizeExceeded): return VMErrorCodeMaxCodeSizeExceeded + case errors.Is(err, ErrMaxInitCodeSizeExceeded): + return VMErrorCodeMaxInitCodeSizeExceeded case errors.Is(err, ErrInvalidJump): return VMErrorCodeInvalidJump case errors.Is(err, ErrWriteProtection):