From 81940b9fc693df03f92a78bee62a2786cac00444 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Thu, 19 Sep 2024 15:11:38 -0300 Subject: [PATCH] fix Signed-off-by: Ignacio Hagopian --- core/vm/instructions.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 481102147a71..d67231a27746 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -467,7 +467,11 @@ func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) slot := scope.Stack.peek() address := common.Address(slot.Bytes20()) if interpreter.evm.chainRules.IsVerkle { - if _, isPrecompile := interpreter.evm.precompile(address); !isPrecompile && !interpreter.evm.isSystemContract(address) { + if _, isPrecompile := interpreter.evm.precompile(address); isPrecompile || interpreter.evm.isSystemContract(address) { + if !scope.Contract.UseGas(params.WarmStorageReadCostEIP2929) { + return nil, ErrExecutionReverted + } + } else { chargedGas, ok := interpreter.evm.Accesses.TouchBasicData(address[:], false, scope.Contract.UseGas) if !ok || (chargedGas == 0 && !scope.Contract.UseGas(params.WarmStorageReadCostEIP2929)) { return nil, ErrExecutionReverted @@ -774,7 +778,7 @@ func chargeCallVariantEIP4762(evm *EVM, scope *ScopeContext) bool { if err != nil { return false } - if scope.Contract.UseGas(evm.callGasTemp) { + if !scope.Contract.UseGas(evm.callGasTemp) { return false }