It seems that EIP 150 ( introduced a more expensive gas based restriction on the call stack and completely removed the previous 1024 hard stack limit. Is this true? It seems it took cues from EIP 90 & EIP 114, but not entirely sure what was implemented.

How does the new gas based limit work?

up vote 13 down vote accepted

The previous limit has not been removed, it's just become practically unreachable.

With the new rules, the call cannot consume more than 63/64 of the gas of the parent. So if your gas is X, then N CALLs in, it will be max X * (63/64)^n.

And to be correct, the gas is even less than that, since 63/64 is defined as "all but one 64th" of N as N - floor(N / 64), so there's also a factor of flooring to integers which has an effect. Also, the actual CALL cost and PUSH operations required will also reduce the practical limit.

From the EIP:

Note that with the given parameters, the de-facto maximum call stack depth is limited to ~340 (down from ~1024), mitigating the harm caused by any further potential quadratic-complexity DoS attacks that rely on calls.

  • Thanks @mhswende! So the hard limit is still in there. It looks it will take a substantially high gas limit to even come close to 1024 right? – Simon de la Rouviere Oct 19 '16 at 9:20
  • 2
    Yes. I've seen a number that Vitalik calculated, but I'm not sure where to find it now. It's orders of magnitude above the limits used so far. – mhswende Oct 19 '16 at 9:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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