Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Send all gas in call #90
Function calls usually provide all available gas to the callee because it is extremely hard if not impossible to come up with a good estimate of how much gas the callee will need.
At he same time, this mechanism relies on actual gas costs inside the EVM and is very fragile:
The amount of gas left can be retrieved via the
The usual way to cope with this is to subtract a certain constant from the value of the
This is of course all very fragile and means that if we ever increase the gas costs of the instructions
Furthermore, sometimes some gas has to be retained by the caller because it cannot efficiently estimate how costly the
This is less an actual EIP but more a request for ideas about how to handle that situation.
Possibility 1: Use the special case of 2**256-1 gas to mean "all available gas". This would at least make future contracts more flexible.
Possibility 2: Change the semantics of
dislike possibility 2; it would introduce an extremely opaque meaning to a particular opcode string.
there's also possibility 3: the gas limit given is capped at the amount of gas remaining. this is a similar to possibility 1, but simpler as it doesn't introduce a constant (2^256-1) or a conditional, but merely a trivial "limit" operation.
referenced this issue
Jun 19, 2016
Another bit more flexible alternative (if we're going with the constant approach) is to interpret 2-s complement as the amount of gas to retain. So