Try it Live
Run Bytecode examples in the interactive playground
StackAnalysis Type
StackIssue
BlockStackInfo
Options
Usage Patterns
Basic Validation
Detect Underflows
Detect Overflows
Block-Level Requirements
Path Analysis
Custom Initial Depth
Useful for analyzing contract fragments:Stack Effects
Each opcode has a defined stack effect:Stack Input/Output
- ADD: 2 inputs, 1 output (effect: -1)
- PUSH1: 0 inputs, 1 output (effect: +1)
- DUP1: 1 input, 2 outputs (effect: +1)
- SWAP1: 2 inputs, 2 outputs (effect: 0)
- POP: 1 input, 0 outputs (effect: -1)
Cumulative Tracking
EVM Stack Limits
Depth Limit (1024)
EVM enforces a maximum stack depth of 1024 items:DUP/SWAP Limits
- DUP1-DUP16: Requires 1-16 items on stack
- SWAP1-SWAP16: Requires 2-17 items on stack
Integration with Opcode Module
Stack effects from Opcode module:Common Issues
Underflow Patterns
Inconsistent Paths
Limitations
What’s Validated
✅ Stack underflows (popping from empty stack) ✅ Stack overflows (exceeding 1024 limit) ✅ Block entry requirements ✅ DUP/SWAP validity ✅ Path consistency (where determinable)What’s Not Validated
❌ Dynamic jump target validity ❌ External call effects ❌ Loop iteration counts ❌ Recursion depthError Handling
Optimization Hints
Identify inefficient stack patterns:See Also
- analyzeGas - Gas cost estimation
- analyzeBlocks - Basic block analysis
- Opcode.getStackEffect - Individual stack effects
- prettyPrint - Disassembly with stack annotations

