aragonOS icon indicating copy to clipboard operation
aragonOS copied to clipboard

Reduce 'FWD_GAS_LIMIT' to decrease the gas needed to interact with aragonOS' apps

Open izqui opened this issue 4 years ago • 0 comments

At the moment, every time that we forward a call using DelegateProxy, 10k gas are not forwarded. When multiple DelegateProxy.delegatedFwd are executed in one transaction (in an aragonOS call with an auth modifier there are at least 4 delegatedFwd), the amount of gas that the transaction needs can be up to ~10k gas * number of DelegateProxy.delegatedFwd gas that won't be used in the transaction, but that needs to be sent or the transaction will fail.

The reason for not sending all the gas when performing a delegatecall is to be able to gracefully error in case that the underlying call fails consuming all the gas (because of an invalid jump or an OOG). In our case, after the proxy's delegatecall returns we just forward the return data, which can be done with less than 10k gas in most cases.

Reducing the FWD_GAS_LIMIT to a lower number (maybe to 2,300 gas as that's the gas stipend amount that contract ETH transfers have) will reduce the amount of gas that needs to be sent to aragonOS contracts that won't be used

izqui avatar Sep 09 '19 14:09 izqui