From f8551dbbeda64a88565855310f7207b5dec4eae1 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Sun, 17 Mar 2024 20:28:20 +0100 Subject: [PATCH] more suggestions from code review --- core/vm/instructions.go | 2 ++ core/vm/operations_verkle.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 1ecde85a1ff3..bf12978a6836 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -402,6 +402,8 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) } paddedCodeCopy, copyOffset, nonPaddedCopyLength := getDataAndAdjustedBounds(code, uint64CodeOffset, length.Uint64()) statelessGas := interpreter.evm.Accesses.TouchCodeChunksRangeOnReadAndChargeGas(addr[:], copyOffset, nonPaddedCopyLength, uint64(len(contract.Code))) + statelessGas += interpreter.evm.Accesses.TouchVersion(addr[:], false) + statelessGas += interpreter.evm.Accesses.TouchCodeSize(addr[:], false) if !scope.Contract.UseGas(statelessGas) { scope.Contract.Gas = 0 return nil, ErrOutOfGas diff --git a/core/vm/operations_verkle.go b/core/vm/operations_verkle.go index 8045c9eb1245..e57175612e18 100644 --- a/core/vm/operations_verkle.go +++ b/core/vm/operations_verkle.go @@ -44,7 +44,8 @@ func gasBalance4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, mem func gasExtCodeSize4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) { address := stack.peek().Bytes20() - return evm.StateDB.Witness().TouchCodeSize(address[:], false), nil + versiongas := evm.StateDB.Witness().TouchVersion(address[:], false) + return versiongas + evm.StateDB.Witness().TouchCodeSize(address[:], false), nil } func gasExtCodeHash4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {