Audits Hackathons Blockgeeks About

How much Gas Limit shuld be set for external function call in ethereum


#1

Hi
In ethereum smart contract it’s possible to call functions of other contracts. This can be done using such line of code:
address.call().val(_val).gas(_gasLimit)(“somefunction”, params)

However there exists 2 risks. Reentrancy Attack and Gas depletion.
Abount Gas deppletion it’s possible that that malicious contract consumes a huge amount of gas and finally revert.
My question is that how much gas should be set for such external function call in order to avoid gas depletion and on the other hand run the honest functions?


#2

@hossein_namazian egarding the malicious gas depletion concept, wouldn’t this just be hurting the address that called it? Or would it be setup so that the contract itself would be paying for the gas?

As for you second question I researched this for a while and am actually very curious myself now. The closest I could find to an answer was: Link