In this track: Execution traces and low-level calls
advanced · 4 MIN READ
Call depth and stack limits
Frame nesting and stack item depth are separate constraints.
LET’S PICTURE IT
A building’s floor count differs from the number of cards stacked on one desk.
SEE IT FOR YOURSELF
A valid counter call, step by stepStep 1 / 4
This example begins with count zero and a request to call increment(). No real contract is deployed.
This example begins with count zero and a request to call increment(). No real contract is deployed.Execution follows the code’s input and permission rules. A website button is not the access-control mechanism.The function reads zero, calculates zero plus one, and writes one to persistent storage.The accepted state contains count one. Later reads can inspect it. Events are emitted only if the code implements them.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Separate the two structures
Message-call depth counts nested call frames. The operand stack counts word items within a frame; these are not two names for the same structure.
Recognize fixed bounds
The EVM has specified depth limits, including the 1024-item operand stack bound and call-depth restrictions. A program must also satisfy each instruction’s operand requirements.
Include available gas
Gas forwarding limits can make extremely deep recursion impractical before an idealized depth limit is reached. A depth number alone does not predict a runnable recursion length.
Avoid unbounded recursion
Design finite progress and explicit bounds where possible. Test the relevant call structure rather than relying on a theoretical maximum as an application capacity guarantee.
Follow the execution
Frame A: operand stack [2,3]
calls Frame B: its own operand stack
Nesting depth and per-frame stack depth must be tracked separately.
A local conceptual trace with explicit assumptions; this is not a trace of a live transaction.
QUICK CHECK · NO PRESSURE
Are call-frame depth and operand-stack depth the same measurement?
One counts frames; the other counts words inside a frame.