0

Since a contract's receive() can only rely on 2300 gas being available, is there any way to use part of the msg.value to top up the gas?

1 Answer 1

0

It's a security feature that gas cannot be changed within a contract. At first I thought maybe the refund mechanisms of selfdestruct and SSTORE[x]=0 could have been used, but aside from them being under review for deletion (EIP-3298), the refund would only be applied after the transaction to the benefit of the caller, not the smart contract itself. And finally, since the 2300 gas stipend itself is on the wishlist for removal any way to circumvent this would be futile in the long run anyway...

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.