fix rebase issues

pull/31014/head
Guillaume Ballet 18 hours ago
parent f54f34e1ef
commit e7dd2e9bca
  1. 9
      core/vm/eips.go
  2. 10
      core/vm/evm.go
  3. 15
      core/vm/operations_verkle.go

@ -345,11 +345,10 @@ func opExtCodeCopyEIP4762(pc *uint64, interpreter *EVMInterpreter, scope *ScopeC
self: AccountRef(addr), self: AccountRef(addr),
} }
paddedCodeCopy, copyOffset, nonPaddedCopyLength := getDataAndAdjustedBounds(code, uint64CodeOffset, length.Uint64()) paddedCodeCopy, copyOffset, nonPaddedCopyLength := getDataAndAdjustedBounds(code, uint64CodeOffset, length.Uint64())
if !contract.IsSystemCall { consumed, wanted := interpreter.evm.AccessEvents.CodeChunksRangeGas(addr, copyOffset, nonPaddedCopyLength, uint64(len(contract.Code)), false, scope.Contract.Gas)
scope.Contract.UseGas(consumed, interpreter.evm.Config.Tracer, tracing.GasChangeUnspecified) scope.Contract.UseGas(consumed, interpreter.evm.Config.Tracer, tracing.GasChangeUnspecified)
if consumed < wanted { if consumed < wanted {
return nil, ErrOutOfGas return nil, ErrOutOfGas
}
} }
scope.Memory.Set(memOffset.Uint64(), length.Uint64(), paddedCodeCopy) scope.Memory.Set(memOffset.Uint64(), length.Uint64(), paddedCodeCopy)

@ -45,6 +45,16 @@ func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) {
return p, ok return p, ok
} }
func (evm *EVM) isSystemContract(addr common.Address) bool {
switch addr {
case params.BeaconRootsAddress, params.HistoryStorageAddress, params.WithdrawalQueueAddress,
params.ConsolidationQueueAddress, params.SystemAddress:
return true
default:
return false
}
}
// BlockContext provides the EVM with auxiliary information. Once provided // BlockContext provides the EVM with auxiliary information. Once provided
// it shouldn't be modified. // it shouldn't be modified.
type BlockContext struct { type BlockContext struct {

@ -33,9 +33,6 @@ func gasSLoad4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memor
} }
func gasBalance4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) { func gasBalance4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
if contract.IsSystemCall {
return 0, nil
}
address := stack.peek().Bytes20() address := stack.peek().Bytes20()
return evm.AccessEvents.BasicDataGas(address, false, contract.Gas, true), nil return evm.AccessEvents.BasicDataGas(address, false, contract.Gas, true), nil
} }
@ -45,16 +42,10 @@ func gasExtCodeSize4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory,
if _, isPrecompile := evm.precompile(address); isPrecompile { if _, isPrecompile := evm.precompile(address); isPrecompile {
return 0, nil return 0, nil
} }
if contract.IsSystemCall {
return 0, nil
}
return evm.AccessEvents.BasicDataGas(address, false, contract.Gas, true), nil return evm.AccessEvents.BasicDataGas(address, false, contract.Gas, true), nil
} }
func gasExtCodeHash4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) { func gasExtCodeHash4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
if contract.IsSystemCall {
return 0, nil
}
address := stack.peek().Bytes20() address := stack.peek().Bytes20()
if _, isPrecompile := evm.precompile(address); isPrecompile { if _, isPrecompile := evm.precompile(address); isPrecompile {
return 0, nil return 0, nil
@ -124,7 +115,7 @@ func gasSelfdestructEIP4762(evm *EVM, contract *Contract, stack *Stack, mem *Mem
if contract.IsSystemCall { if contract.IsSystemCall {
return 0, nil return 0, nil
} }
ontractAddr := contract.Address() contractAddr := contract.Address()
wanted := evm.AccessEvents.BasicDataGas(contractAddr, false, contract.Gas, false) wanted := evm.AccessEvents.BasicDataGas(contractAddr, false, contract.Gas, false)
if wanted > contract.Gas { if wanted > contract.Gas {
return wanted, nil return wanted, nil
@ -173,7 +164,6 @@ func gasCodeCopyEip4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory,
if err != nil { if err != nil {
return 0, err return 0, err
} }
_, copyOffset, nonPaddedCopyLength := getDataAndAdjustedBounds(contract.Code, uint64CodeOffset, length.Uint64())
if !contract.IsDeployment && !contract.IsSystemCall { if !contract.IsDeployment && !contract.IsSystemCall {
var ( var (
codeOffset = stack.Back(1) codeOffset = stack.Back(1)
@ -198,9 +188,8 @@ func gasExtCodeCopyEIP4762(evm *EVM, contract *Contract, stack *Stack, mem *Memo
return 0, err return 0, err
} }
addr := common.Address(stack.peek().Bytes20()) addr := common.Address(stack.peek().Bytes20())
isSystemContract := evm.isSystemContract(addr)
_, isPrecompile := evm.precompile(addr) _, isPrecompile := evm.precompile(addr)
if isPrecompile || contract.isSystemCall { if isPrecompile || evm.isSystemContract(addr) {
var overflow bool var overflow bool
if gas, overflow = math.SafeAdd(gas, params.WarmStorageReadCostEIP2929); overflow { if gas, overflow = math.SafeAdd(gas, params.WarmStorageReadCostEIP2929); overflow {
return 0, ErrGasUintOverflow return 0, ErrGasUintOverflow

Loading…
Cancel
Save