Skip to content

Commit

Permalink
more suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Mar 17, 2024
1 parent 2e01b63 commit f8551db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion core/vm/operations_verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f8551db

Please sign in to comment.