From 1fe112428224044b0cd0ca728af685613b97f153 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Thu, 10 Oct 2024 13:10:24 -0300 Subject: [PATCH] eip4762: move CALL BASIC_DATA charging before reservation Signed-off-by: Ignacio Hagopian --- 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 1155564ab5dc..77047ef319d6 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -792,6 +792,10 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt } } + if interpreter.evm.chainRules.IsEIP4762 && !chargeCallVariantEIP4762(interpreter.evm, scope) { + return nil, ErrOutOfGas + } + var err error interpreter.evm.callGasTemp, err = callGas(interpreter.evm.chainRules.IsEIP150, scope.Contract.Gas, 0, scope.Stack.Back(0)) if err != nil { @@ -801,10 +805,6 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt return nil, ErrOutOfGas } - if interpreter.evm.chainRules.IsEIP4762 && !chargeCallVariantEIP4762(interpreter.evm, scope) { - return nil, ErrOutOfGas - } - stack := scope.Stack // Pop gas. The actual gas in interpreter.evm.callGasTemp. // We can use this as a temporary value