From b6fb79cdf977e0652c531c0019b0dac1ae01a375 Mon Sep 17 00:00:00 2001 From: jwasinger Date: Fri, 16 Jan 2026 23:37:12 +0900 Subject: [PATCH] core/vm: in selfdestruct gas calculation, return early if there isn't enough gas to cover cold account access costs (#33450) There's no need to perform the subsequent state access on the target if we already know that we are out of gas. This aligns the state access behavior of selfdestruct with EIP-7928 --- core/vm/operations_acl.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/vm/operations_acl.go b/core/vm/operations_acl.go index 26ff411bd2..4b7b87503d 100644 --- a/core/vm/operations_acl.go +++ b/core/vm/operations_acl.go @@ -236,6 +236,10 @@ func makeSelfdestructGasFn(refundsEnabled bool) gasFunc { // If the caller cannot afford the cost, this change will be rolled back evm.StateDB.AddAddressToAccessList(address) gas = params.ColdAccountAccessCostEIP2929 + + if contract.Gas < gas { + return gas, nil + } } // if empty and transfers value if evm.StateDB.Empty(address) && evm.StateDB.GetBalance(contract.Address()).Sign() != 0 {