ethereum / ethereumj

DEPRECATED! Java implementation of the Ethereum yellowpaper. For JSON-RPC and other client features check Ethereum Harmony
GNU Lesser General Public License v3.0
2.18k stars 1.1k forks source link

Confusion about STIPEND_CALL #1151

Closed tjchern closed 6 years ago

tjchern commented 6 years ago

When contract A has an op CALL, if value is not zero, then the adjustedCallGas add STIPEND_CALL, and the adjustedCallGas will passed into the new contract B as gas limit. so, if the new contract B return immediately, it will refund the gas(equals to gas limit), at this time, the contract A will gain the gas limit. I have checked the issue https://github.com/ethereum/EIPs/issues/1285, and I know why need the STIPEND_CALL, but is the code OK? Thank you

mkalinin commented 6 years ago

Yes, it's OK. You may find the same behavior in go-ethereum code as well. Basically, value transfer call costs 9,000 gas in addition. So, even if whole STIPEND_CALL gets refunded, it'll cost 6,700 gas.

tjchern commented 6 years ago

OK, Thank you very much