Commit e869c482 authored by pengjun's avatar pengjun Committed by vipwzw

1. 修复evm delegatecall操作outOfGas报错

2. 放开delegatecall只读调用的限制
parent ae43c3cf
......@@ -329,7 +329,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr.String()), evm.StateDB.GetCode(addr.String()))
// 其它逻辑同StaticCall
ret, err = run(evm, contract, input, true)
ret, err = run(evm, contract, input, false)
}
......
......@@ -277,6 +277,13 @@ func gasDelegateCall(evm *EVM, contract *Contract, stack *Stack, mem *Memory, me
if err != nil {
return 0, err
}
evm.callGasTemp, err = callGas(true, contract.Gas, gas, stack.Back(0))
if err != nil {
return 0, err
}
log15.Info("gasDelegateCall", "gas", gas, "evm.callGasTemp", evm.callGasTemp)
var overflow bool
if gas, overflow = math.SafeAdd(gas, evm.callGasTemp); overflow {
return 0, ErrGasUintOverflow
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment