17

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?

1 Answer 1

18

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.

2
  • 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? Commented Oct 19, 2016 at 9:20
  • 3
    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
    Commented Oct 19, 2016 at 9:34

Your Answer

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

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