From cc420bd36cba832864b08be83ff738ee7a2655e2 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Thu, 17 Oct 2024 07:21:34 -0300 Subject: [PATCH] extra fix Signed-off-by: Ignacio Hagopian --- core/state/access_witness.go | 4 ++-- core/vm/evm.go | 4 ++-- core/vm/instructions.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/state/access_witness.go b/core/state/access_witness.go index 24a1344e8e2b..276485e2dd25 100644 --- a/core/state/access_witness.go +++ b/core/state/access_witness.go @@ -284,7 +284,7 @@ func (aw *AccessWitness) TouchBasicData(addr []byte, isWrite bool, useGasFn UseG return ok && (!warmCostCharging || chargedGas > 0 || useGasFn(params.WarmStorageReadCostEIP2929)) } -func (aw *AccessWitness) TouchCodeHash(addr []byte, isWrite bool, useGasFn UseGasFn) bool { +func (aw *AccessWitness) TouchCodeHash(addr []byte, isWrite bool, useGasFn UseGasFn, warmCostCharging bool) bool { chargedGas, ok := aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.CodeHashLeafKey, isWrite, useGasFn) - return ok && (chargedGas > 0 || useGasFn(params.WarmStorageReadCostEIP2929)) + return ok && (!warmCostCharging || chargedGas > 0 || useGasFn(params.WarmStorageReadCostEIP2929)) } diff --git a/core/vm/evm.go b/core/vm/evm.go index 2ab9479e66d1..f70f3552024a 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -206,9 +206,9 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas // is a direct tx call, in which case it's covered by the intrinsic gas, or because // of a CALL instruction, in which case BASIC_DATA has been added to the access // list in write mode. If there is enough gas paying for the addition of the code - // hash leaf to the access list, then account creation will proceed unimpaired. + // hash leaf to the access list, then account creation will proceed unimpaired. // Thus, only pay for the creation of the code hash leaf here. - ok := evm.Accesses.TouchCodeHash(addr.Bytes(), true, gc.consumeGas) + ok := evm.Accesses.TouchCodeHash(addr.Bytes(), true, gc.consumeGas, false) if !ok { evm.StateDB.RevertToSnapshot(snapshot) return nil, 0, ErrOutOfGas diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 912b9c583eeb..412093b1bb04 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -480,7 +480,7 @@ func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) return nil, ErrOutOfGas } } else { - if !interpreter.evm.Accesses.TouchCodeHash(address[:], false, scope.Contract.UseGas) { + if !interpreter.evm.Accesses.TouchCodeHash(address[:], false, scope.Contract.UseGas, true) { return nil, ErrOutOfGas } }