core/vm: don't wrap ErrOutOfGas errors returned from the dynamic gas check in ErrOutOfGas

This commit is contained in:
Jared Wasinger 2026-04-30 15:46:58 +02:00
parent 01036bed83
commit e28a4730a2

View file

@ -17,6 +17,7 @@
package vm package vm
import ( import (
"errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -222,8 +223,12 @@ func (evm *EVM) Run(contract *Contract, input []byte, readOnly bool) (ret []byte
dynamicCost, err = operation.dynamicGas(evm, contract, stack, mem, memorySize) dynamicCost, err = operation.dynamicGas(evm, contract, stack, mem, memorySize)
cost += dynamicCost.RegularGas // for tracing cost += dynamicCost.RegularGas // for tracing
if err != nil { if err != nil {
if errors.Is(err, ErrOutOfGas) {
return nil, err
} else {
return nil, fmt.Errorf("%w: %v", ErrOutOfGas, err) return nil, fmt.Errorf("%w: %v", ErrOutOfGas, err)
} }
}
// for tracing: this gas consumption event is emitted below in the debug section. // for tracing: this gas consumption event is emitted below in the debug section.
if contract.Gas.RegularGas < dynamicCost.RegularGas { if contract.Gas.RegularGas < dynamicCost.RegularGas {
return nil, ErrOutOfGas return nil, ErrOutOfGas