mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
add static guards to call/callcode gas handler stateless components
This commit is contained in:
parent
714bff5172
commit
05933c04af
1 changed files with 15 additions and 6 deletions
|
|
@ -374,9 +374,13 @@ func gasCallStateless(evm *EVM, contract *Contract, stack *Stack, mem *Memory, m
|
|||
transfersValue = !stack.Back(2).IsZero()
|
||||
)
|
||||
|
||||
if transfersValue && !evm.chainRules.IsEIP4762 {
|
||||
if transfersValue {
|
||||
if evm.readOnly {
|
||||
return 0, ErrWriteProtection
|
||||
} else if !evm.chainRules.IsEIP4762 {
|
||||
gas += params.CallValueTransferGas
|
||||
}
|
||||
}
|
||||
|
||||
memoryGas, err := memoryGasCost(mem, memorySize)
|
||||
if err != nil {
|
||||
|
|
@ -445,10 +449,15 @@ func gasCallCodeStateless(evm *EVM, contract *Contract, stack *Stack, mem *Memor
|
|||
var (
|
||||
gas uint64
|
||||
overflow bool
|
||||
transfersValue = !stack.Back(2).IsZero()
|
||||
)
|
||||
if stack.Back(2).Sign() != 0 && !evm.chainRules.IsEIP4762 {
|
||||
if transfersValue {
|
||||
if evm.readOnly {
|
||||
return 0, ErrWriteProtection
|
||||
} else if !evm.chainRules.IsEIP4762 {
|
||||
gas += params.CallValueTransferGas
|
||||
}
|
||||
}
|
||||
if gas, overflow = math.SafeAdd(gas, memoryGas); overflow {
|
||||
return 0, ErrGasUintOverflow
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue