mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
core/vm: rm dynamic gas calculators for core reading ops
This commit is contained in:
parent
f3a427e19b
commit
e4e381d70a
2 changed files with 0 additions and 41 deletions
|
|
@ -764,15 +764,12 @@ func opExtCodeHashEIP7702(pc *uint64, interpreter *EVMInterpreter, scope *ScopeC
|
|||
func enable7702(jt *JumpTable) {
|
||||
jt[EXTCODECOPY].execute = opExtCodeCopyEIP7702
|
||||
jt[EXTCODECOPY].constantGas = params.WarmStorageReadCostEIP2929
|
||||
jt[EXTCODECOPY].dynamicGas = gasExtCodeCopyEIP7702
|
||||
|
||||
jt[EXTCODESIZE].execute = opExtCodeSizeEIP7702
|
||||
jt[EXTCODESIZE].constantGas = params.WarmStorageReadCostEIP2929
|
||||
jt[EXTCODESIZE].dynamicGas = gasEip7702CodeCheck
|
||||
|
||||
jt[EXTCODEHASH].execute = opExtCodeHashEIP7702
|
||||
jt[EXTCODEHASH].constantGas = params.WarmStorageReadCostEIP2929
|
||||
jt[EXTCODEHASH].dynamicGas = gasEip7702CodeCheck
|
||||
|
||||
jt[CALL].constantGas = params.WarmStorageReadCostEIP2929
|
||||
jt[CALL].dynamicGas = gasCallEIP7702
|
||||
|
|
|
|||
|
|
@ -310,41 +310,3 @@ func makeCallVariantGasCallEIP7702(oldCalculator gasFunc) gasFunc {
|
|||
return total, nil
|
||||
}
|
||||
}
|
||||
|
||||
func gasEip7702CodeCheck(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
|
||||
cost, _ := gasEip2929AccountCheck(evm, contract, stack, mem, memorySize)
|
||||
// Check if code is a delegation and if so, charge for resolution
|
||||
addr := common.Address(stack.peek().Bytes20())
|
||||
if addr, ok := types.ParseDelegation(evm.StateDB.GetCode(addr)); ok {
|
||||
if evm.StateDB.AddressInAccessList(addr) {
|
||||
cost += params.WarmStorageReadCostEIP2929
|
||||
} else {
|
||||
evm.StateDB.AddAddressToAccessList(addr)
|
||||
cost += params.ColdAccountAccessCostEIP2929
|
||||
}
|
||||
}
|
||||
return cost, nil
|
||||
}
|
||||
|
||||
func gasExtCodeCopyEIP7702(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
|
||||
gas, err := gasExtCodeCopyEIP2929(evm, contract, stack, mem, memorySize)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
// Check if code is a delegation and if so, charge for resolution
|
||||
addr := common.Address(stack.peek().Bytes20())
|
||||
if addr, ok := types.ParseDelegation(evm.StateDB.GetCode(addr)); ok {
|
||||
var overflow bool
|
||||
if evm.StateDB.AddressInAccessList(addr) {
|
||||
if gas, overflow = math.SafeAdd(gas, params.WarmStorageReadCostEIP2929); overflow {
|
||||
return 0, ErrGasUintOverflow
|
||||
}
|
||||
} else {
|
||||
evm.StateDB.AddAddressToAccessList(addr)
|
||||
if gas, overflow = math.SafeAdd(gas, params.ColdAccountAccessCostEIP2929); overflow {
|
||||
return 0, ErrGasUintOverflow
|
||||
}
|
||||
}
|
||||
}
|
||||
return gas, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue