Skip to content

Commit 51d55d8

Browse files
committed
feat: transform into Universal Multi-VM Execution Profiler with Solana, Starknet, and Stellar support
1 parent fca1c8d commit 51d55d8

31 files changed

Lines changed: 1561 additions & 328 deletions

File tree

ARCHITECTURE.md

Lines changed: 81 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,87 @@
1-
# Atupa Suit: System Architecture
1+
# 🏮 Atupa System Architecture
22

3-
The Atupa Suite is designed as a modular, high-performance infrastructure stack that provides transparency for the "Multi-VM" future of Ethereum. It separates the heavy lifting of raw trace parsing from the high-level business logic of protocol-specific auditing.
3+
Atupa is a high-performance, modular infrastructure stack designed as a **Universal Multi-VM Execution Profiler**. This document details the technical design, data normalization strategies, and crate-level relationships that power the suite across diverse execution environments.
4+
5+
---
6+
7+
## 🏛 Core Philosophy: The Unified Trace Model
8+
9+
The central challenge Atupa solves is the fragmentation of execution data across different Virtual Machines (EVM, WASM, Cairo, SVM, Soroban). Each VM has its own "gas" units, log formats, and call-stack representations.
10+
11+
Atupa addresses this by normalizing all execution data into a **Unified Trace Step** (`TraceStep`):
12+
13+
```rust
14+
pub struct TraceStep {
15+
pub pc: u64, // Program counter or instruction index
16+
pub op: String, // Opcode, HostFn name, or Program Label
17+
pub gas_cost: u64, // Normalized execution weight
18+
pub depth: u16, // Call-stack depth
19+
pub vm_kind: VmKind, // The source VM (Evm, Stylus, Solana, etc.)
20+
pub stack: Option<Vec<String>>,
21+
// ... metadata
22+
}
23+
```
24+
25+
By mapping heterogeneous units (Solana Compute Units, Soroban HostFn weights, Cairo steps) into this model, Atupa enables **cross-chain execution diffing** and **unified flamegraph visualization**.
26+
27+
---
428

529
## 🏗 System Components
630

7-
### 1. Network Layer (The Sources)
8-
Atupa connects to diverse execution environments:
9-
- **Ethereum (L1)**: Standard EVM via `structLogs`.
10-
- **Arbitrum (L2)**: Dual-VM (EVM + Stylus) via the Nitro `stylusTracer`.
11-
- **Unichain (L2)**: Real-time "Flashblocks" (200ms pending state).
12-
13-
### 2. Intelligence Layer (The Engine)
14-
This is where raw hex data becomes human insight:
15-
- **MixedTraceStitcher**: Correlates different trace formats (EVM, Stylus, Geth) into a unified timeline.
16-
- **Protocol Adapters**: Specialized crates (`atupa-aave`, `atupa-lido`) that implement the `ProtocolAdapter` trait to extract domain-specific insights.
17-
- **Symbol Resolver**: Uses DWARF symbols and Sourcify to map opcodes to source lines.
18-
19-
### 3. Interface Layer (The UX)
20-
How developers and auditors interact with the data:
21-
- **`atupa`**: The primary Rust binary that orchestrates parsing, auditing, and visualization.
22-
- **`atupa-sdk`**: A high-level library that bundles the core engine and all protocol adapters for third-party integrations.
23-
- **Atupa Report**: Automated, professional audit summaries generated directly from the terminal.
24-
25-
## 🏮 Data Formats
26-
We use a unified **Atupa Profile JSON** that includes:
27-
- `execution_steps`: Contiguous list of all VM instructions.
28-
- `memory_deltas`: Mapping of memory growth and spikes.
29-
- `protocol_context`: High-level labels and risk flags injected by Protocol Adapters (e.g., "Liquid Staking Share Rebase Detected").
31+
### 1. Network Adapters (The Sources)
32+
Atupa connects to diverse execution environments via specialized clients:
33+
- **`atupa-nitro`**: Handles Arbitrum's dual-VM state. It stitches standard Geth-style EVM traces with `stylusTracer` WASM logs.
34+
- **`atupa-starknet`**: Interacts with the Starknet gateway to fetch `traceTransaction` data and flattens recursive Cairo call frames.
35+
- **`atupa-solana`**: Implements a complex **Log Stitcher** state machine. Since Solana RPCs only provide sequential logs, Atupa reconstructs the nested call stack by tracking `Program...invoke` and `Program...success` markers.
36+
- **`atupa-stellar`**: Parses Soroban `diagnostic_events` to reconstruct Host Function call trees.
37+
38+
### 2. The Aggregation Engine (`atupa-parser`)
39+
Raw traces are often thousands of lines long. The parser performs:
40+
- **Depth-Aware Folding**: Groups sequential opcodes into logical blocks while preserving call-stack integrity.
41+
- **Instruction Normalization**: Maps VM-specific costs to a relative "unified cost" for cross-environment comparison.
42+
- **Category Tagging**: Tags steps as `StorageRead`, `Memory`, `Crypto`, etc., to power the Studio's metric cards.
43+
44+
### 3. Visualization Engine (`atupa-output`)
45+
Atupa generates high-fidelity visual artifacts without relying on external SaaS platforms:
46+
- **SVG Flamegraphs**: Hand-crafted SVG templates with dynamic gradients that visually differentiate between VMs (e.g., Green for Solana, Purple for Starknet).
47+
- **Interactive Diffing**: A specialized visual mode that overlays two traces, using color intensities to highlight gas regressions or optimizations.
48+
49+
### 4. Atupa Studio (`studio/`)
50+
A local-first, high-performance web dashboard built with Vite + React + TypeScript. It features:
51+
- **Zero-Dependency Flamegraphs**: Custom React components that render recursive trees directly into SVGs for maximum performance.
52+
- **Trace Inspector**: A paginated, filterable view of the normalized execution timeline.
53+
54+
---
55+
56+
## 📦 Crate Hierarchy
57+
58+
```mermaid
59+
graph TD
60+
CLI[bin/atupa] --> SDK[crates/atupa-sdk]
61+
SDK --> Core[crates/atupa-core]
62+
SDK --> Nitro[crates/atupa-nitro]
63+
SDK --> Solana[crates/atupa-solana]
64+
SDK --> Starknet[crates/atupa-starknet]
65+
SDK --> Stellar[crates/atupa-stellar]
66+
67+
Nitro --> Parser[crates/atupa-parser]
68+
Solana --> Parser
69+
Starknet --> Parser
70+
Stellar --> Parser
71+
72+
Parser --> Output[crates/atupa-output]
73+
Output --> Core
74+
```
75+
76+
---
77+
78+
## 🏮 Data Lifecycle
79+
80+
1. **Capture**: CLI fetches raw RPC data based on the transaction hash and endpoint signature.
81+
2. **Normalize**: The chain-specific adapter converts raw logs/traces into `Vec<TraceStep>`.
82+
3. **Stitch**: If the transaction crosses VM boundaries (e.g., Arbitrum), the Nitro adapter synchronizes the EVM and WASM clocks.
83+
4. **Aggregate**: The parser collapses steps into a searchable tree.
84+
5. **Render**: The Output engine generates either a terminal summary, a JSON report, or an interactive SVG.
3085

3186
---
32-
🏮 *One Block: The Transparency Layer for the Hybrid Future.*
87+
🏮 *Atupa: Illuminating the path toward multi-VM transparency.*

Cargo.lock

Lines changed: 62 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ members = [
1010
"crates/atupa-aave",
1111
"crates/atupa-nitro",
1212
"crates/atupa-lido",
13+
"crates/atupa-starknet",
14+
"crates/atupa-solana",
15+
"crates/atupa-stellar",
1316
"bin/atupa",
1417
]
1518

1619
[workspace.package]
1720
version = "0.1.1"
1821
edition = "2024"
19-
authors = ["Dean <ethos@eth-trace.io>"]
2022
description = "Atupa: High-Fidelity Ethereum Tracing & Visual Profiling Suite"
2123
readme = "README.md"
2224
license = "MIT OR Apache-2.0"
@@ -66,3 +68,6 @@ atupa-output = { path = "crates/atupa-output", version = "0.1.1" }
6668
atupa-aave = { path = "crates/atupa-aave", version = "0.1.1" }
6769
atupa-nitro = { path = "crates/atupa-nitro", version = "0.1.1" }
6870
atupa-lido = { path = "crates/atupa-lido", version = "0.1.1" }
71+
atupa-starknet = { path = "crates/atupa-starknet", version = "0.1.1" }
72+
atupa-solana = { path = "crates/atupa-solana", version = "0.1.1" }
73+
atupa-stellar = { path = "crates/atupa-stellar", version = "0.1.1" }

README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@
1717

1818
---
1919

20-
**Atupa** (meaning *Lantern/Lamp*) is a professional-grade EVM + Arbitrum Stylus execution profiler. It turns raw JSON-RPC `debug_traceTransaction` and `stylusTracer` logs into actionable visual insights — from gas flamegraphs to unified EVM/WASM execution dashboards.
20+
**Atupa** is a professional-grade **Universal Multi-VM Execution Profiler**. It provides a unified observability layer for the modular execution landscape, including EVM, Arbitrum Stylus (WASM), Starknet (Cairo), Solana (SVM), and Stellar (Soroban), turning raw execution logs into actionable visual insights.
2121

2222
## ✨ Key Features
2323

24-
- **🔥 Unified EVM + Stylus Tracing**: Stitches data from both the EVM and Stylus WASM runtime into a single coherent execution timeline.
25-
- **🏮 Atupa Studio**: A local-first web visualizer — drop a `report.json` to instantly render metric cards, HostIO hot paths, and a step-by-step trace inspector.
26-
- **📊 HostIO Flamegraph**: Surfaces the most expensive Stylus Host I/O calls (`storage_flush_cache`, `native_keccak256`, etc.) ranked by gas-equivalent cost.
27-
- **🚨 Crisp Revert Identification**: Instantly identifies failing sub-calls with high-contrast highlights.
28-
- **🔍 Smart Contract Resolution**: Automatically resolves hex addresses to verified contract names via Etherscan V2.
29-
- **🚀 Automated CI/CD Pipeline**: Built-in `atupa init` for zero-config gas regression gating in GitHub Actions.
30-
- **💉 Protocol-Specific Deep Auditing**: Built-in deep traces for **Lido stETH** and **Aave v3**.
31-
- **🛠 Modular Library Architecture**: Pure Rust workspace with specialized crates for adapters, RPC, parsing, and output.
24+
- **🌐 Universal Multi-VM Profiling**: Unified tracing for EVM, Arbitrum Stylus (WASM), Starknet (Cairo), Solana (SVM), and Stellar (Soroban).
25+
- **🔥 Dual-VM Stitching**: Seamlessly reconstructs execution timelines across VM boundaries (e.g., EVM calling Stylus WASM).
26+
- **📊 Protocol-Aware Gas Analysis**: Specialized cost mapping for non-EVM units, including Solana Compute Units (CU) and Soroban HostFn weights.
27+
- **🏮 Atupa Studio**: A local-first web visualizer — drop a `report.json` to instantly render cross-chain metric cards and interactive flamegraphs.
28+
- **🚨 Crisp Revert Identification**: Instantly identifies failing sub-calls or program errors with high-contrast highlights.
29+
- **🔍 Smart Contract Resolution**: Automatically resolves addresses to verified contract names via Etherscan, Starkscan, and Solana Explorers.
30+
- **🚀 Automated CI/CD Pipeline**: Built-in zero-config gas regression gating for GitHub Actions across all supported chains.
31+
- **💉 Protocol-Specific Deep Auditing**: Built-in deep traces for **Lido stETH**, **Aave v3**, and upcoming Solana DeFi primitives.
32+
- **🛠 Modular Library Architecture**: Pure Rust workspace with specialized crates for each VM adapter and execution environment.
3233

3334
## 🚀 Quick Start
3435

@@ -53,13 +54,19 @@ atupa init
5354
# Capture an Arbitrum Stylus transaction (summary to terminal)
5455
atupa capture --tx 0x... --rpc https://arb-mainnet.g.alchemy.com/v2/KEY
5556

57+
# Capture a Solana transaction (SVM Compute Unit breakdown)
58+
atupa capture --tx 5Z9... --rpc https://api.mainnet-beta.solana.com
59+
60+
# Capture a Starknet transaction (Cairo execution steps)
61+
atupa capture --tx 0x... --rpc https://starknet-mainnet.public.blastapi.io
62+
63+
# Capture a Stellar transaction (Soroban diagnostic events)
64+
atupa capture --tx 0x... --rpc https://soroban-testnet.stellar.org
65+
5666
# Export as JSON for Atupa Studio
5767
atupa capture --tx 0x... --rpc https://... --output json --file report.json
5868

59-
# Deep protocol audit (Lido or Aave)
60-
atupa audit --protocol lido --tx 0x...
61-
62-
# Compare execution cost of two transactions
69+
# Compare execution cost of two transactions (cross-chain diffing)
6370
atupa diff --base 0x... --target 0x...
6471
```
6572

@@ -106,14 +113,24 @@ Atupa is built as a highly modular monorepo:
106113
| [`crates/atupa-core`](crates/atupa-core) | Shared types and core configuration logic. |
107114
| [`crates/atupa-parser`](crates/atupa-parser) | Aggregation engine that collapses EVM traces. |
108115
| [`crates/atupa-nitro`](crates/atupa-nitro) | Arbitrum Nitro dual-VM stitcher (EVM + Stylus). |
109-
| [`crates/atupa-rpc`](crates/atupa-rpc) | Async Ethereum JSON-RPC client & Etherscan resolver. |
116+
| [`crates/atupa-starknet`](crates/atupa-starknet) | Starknet (Cairo) VM adapter. |
117+
| [`crates/atupa-solana`](crates/atupa-solana) | Solana (SVM) log-stitching profiler. |
118+
| [`crates/atupa-stellar`](crates/atupa-stellar) | Stellar (Soroban) diagnostic event parser. |
119+
| [`crates/atupa-rpc`](crates/atupa-rpc) | Async multi-chain RPC client & resolver. |
110120
| [`crates/atupa-lido`](crates/atupa-lido) | Specialized adapter for Lido stETH. |
111121
| [`crates/atupa-aave`](crates/atupa-aave) | Specialized adapter for Aave v3 & GHO. |
112122

113123
## 🤝 Contributing
114124

115125
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for more details.
116126

127+
## 📖 Documentation
128+
129+
For a deep dive into Atupa's internals and philosophy:
130+
- [**The Atupa Vision**](docs/VISION.md) — Why we are building a universal profiler.
131+
- [**System Architecture**](ARCHITECTURE.md) — How the engine, adapters, and Studio interact.
132+
- [**Adapter Guide**](docs/ADAPTER_GUIDE.md) — A step-by-step guide to adding support for new VMs.
133+
117134
## 📄 License
118135

119136
Atupa is dual-licensed under the [MIT License](LICENSE-MIT) and the [Apache License, Version 2.0](LICENSE-APACHE).

0 commit comments

Comments
 (0)