I know that max call stack depth is 1024. I want to know that if calling private function can increase the depth.


As long as it's private/internal, no. It doesn't create a new message CALL between addresses, it just jumps around in the same context.

| improve this answer | |
  • What if that function takes input arguments? Wouldn't pushing those arguments into the stack increase the stack usage? – goodvibration May 7 '18 at 12:37
  • The call stack and the actual operational stack are two separate things. The call stack is a stack of just message calls. Function arguments also aren't implicitly pushed to the stack, that is only done in the code. – flygoing May 7 '18 at 12:56
  • 1
    I believe there are two separate limits: 1024 is the maximum call depth, which only applies to things like CALL and CREATE opcodes. But the stack depth is also limited to 1024, and certainly in normal situations the parameters to functions need to be pushed on to the stack. (Perhaps functions are inlined and parameters are already on the stack, but that is probably the exception, not the rule.) – user19510 May 7 '18 at 14:12
  • I should add that I'm agreeing with @flygoing, just trying to clarify. – user19510 May 7 '18 at 14:15
  • 1
    @smarx thanks! Just double checked the yellow paper and you're correct, limit for both is 1024. Though this is practically impossible to reach for the call stack depth after EIP 150 since it added the limitation that CALLs can only use 63/64th of their parents gas. The practical limit is around 340: ethereum.stackexchange.com/questions/9398/… – flygoing May 7 '18 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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