Stylus Trace
Performance profiling and flamegraph generation for Arbitrum Stylus transactions.
Stylus Trace turns opaque Stylus transaction traces into interactive flamegraphs and actionable performance reports.
Profile gas usage, identify bottlenecks, and catch regressions — all locally using the Arbitrum Nitro dev node.
Built for the Arbitrum Stylus ecosystem.
Quick Start
Prerequisites
- Docker (for Nitro dev node)
- Rust (1.72+)
- Foundry (
cast) - Cargo Stylus
Installation
Verify:
Complete Testing Guide
Step 1: Start Nitro Dev Node
This starts a local Arbitrum node at:
http://localhost:8547
Verify:
Step 2: Deploy a Stylus Contract
Example contract (src/lib.rs):
extern crate alloc;
use U256;
use *;
sol_storage!
Deploy:
Step 3: Execute a Transaction
CONTRACT_ADDRESS="0x..."
TX_HASH=
Step 4: Generate Profile & Flamegraph
Step 5: View the Flamegraph
Source-to-Line Mapping
To enable line-level resolution in your reports and flamegraphs, you must compile your Stylus contract with DWARF debug symbols.
1. Enable Debug Info
Update your contract's Cargo.toml:
[]
= true
2. Build Contract
3. Capture with WASM
Provide the path to the compiled .wasm file using the --wasm flag:
CLI Command Reference
Commands:
capture: Profile a transaction and generate reports.--rpc: RPC endpoint URL.--tx: Transaction hash to profile.--wasm: Path to WASM binary (for source mapping).--tracer: Optional tracer name (e.g.,stylusTracer).--output: Path to save JSON profile.--flamegraph: Path to save SVG flamegraph.--ink: Display costs in Stylus Ink (scaled by 10,000).
validate: Validate a profile JSON file against the schema.schema: Display the JSON schema for profiles.version: Display version information.
License
MIT
Built with ❤️ for the Arbitrum Stylus ecosystem