From ad46a8f802419984c00dea564723d3ef0e3fc10a Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Mon, 19 Jan 2026 11:01:55 +0800 Subject: [PATCH] core/vm: abort the selfdestruct gas measurement if gas is not enough --- core/vm/operations_acl.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/vm/operations_acl.go b/core/vm/operations_acl.go index 4b7b87503d..ce394d9384 100644 --- a/core/vm/operations_acl.go +++ b/core/vm/operations_acl.go @@ -237,8 +237,10 @@ func makeSelfdestructGasFn(refundsEnabled bool) gasFunc { evm.StateDB.AddAddressToAccessList(address) gas = params.ColdAccountAccessCostEIP2929 + // Terminate the gas measurement if the leftover gas is not sufficient, + // it can effectively prevent accessing the states in the following steps if contract.Gas < gas { - return gas, nil + return 0, ErrOutOfGas } } // if empty and transfers value