From c018a05549139ce09d10a5555b30260e510c43f1 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Wed, 8 Apr 2026 16:18:54 +0200 Subject: [PATCH] core/vm: fix gas usage --- core/vm/instructions.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 10ea09ed8b..b7446d3f0e 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -770,7 +770,7 @@ func opCall(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) { if !value.IsZero() { gas += params.CallStipend } - regularGasUsed := scope.Contract.GasUsed.RegularGas + regularGasUsed := scope.Contract.GasUsed.RegularGas - gas // exclude forwarded gas (incl. stipend) ret, returnGas, childGasUsed, err := evm.Call(scope.Contract.Address(), toAddr, args, GasCosts{RegularGas: gas, StateGas: scope.Contract.Gas.StateGas}, &value) if err != nil { @@ -805,7 +805,7 @@ func opCallCode(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) { gas += params.CallStipend } - regularGasUsed := scope.Contract.GasUsed.RegularGas + regularGasUsed := scope.Contract.GasUsed.RegularGas - gas // exclude forwarded gas (incl. stipend) ret, returnGas, childGasUsed, err := evm.CallCode(scope.Contract.Address(), toAddr, args, GasCosts{RegularGas: gas, StateGas: scope.Contract.Gas.StateGas}, &value) if err != nil { temp.Clear() @@ -835,7 +835,7 @@ func opDelegateCall(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) { // Get arguments from the memory. args := scope.Memory.GetPtr(inOffset.Uint64(), inSize.Uint64()) - regularGasUsed := scope.Contract.GasUsed.RegularGas + regularGasUsed := scope.Contract.GasUsed.RegularGas - gas // exclude forwarded gas ret, returnGas, childGasUsed, err := evm.DelegateCall(scope.Contract.Caller(), scope.Contract.Address(), toAddr, args, GasCosts{RegularGas: gas, StateGas: scope.Contract.Gas.StateGas}, scope.Contract.value) if err != nil { temp.Clear() @@ -865,7 +865,7 @@ func opStaticCall(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) { // Get arguments from the memory. args := scope.Memory.GetPtr(inOffset.Uint64(), inSize.Uint64()) - regularGasUsed := scope.Contract.GasUsed.RegularGas + regularGasUsed := scope.Contract.GasUsed.RegularGas - gas // exclude forwarded gas ret, returnGas, childGasUsed, err := evm.StaticCall(scope.Contract.Address(), toAddr, args, GasCosts{RegularGas: gas, StateGas: scope.Contract.Gas.StateGas}) if err != nil { temp.Clear()