|
| 1 | +--- |
| 2 | +title: Architecture |
| 3 | +--- |
| 4 | + |
| 5 | +<!-- Page Header Component --> |
| 6 | +<h1 style="text-align: left; font-size: 38px; font-weight: 700; font-family: 'Inter Tight', sans-serif;"> |
| 7 | + Architecture |
| 8 | +</h1> |
| 9 | + |
| 10 | +<div style="text-align: left; margin: 0.5rem 0;"> |
| 11 | + <p style="font-size: 18px; color: #666; max-width: 600px; margin: 0;"> |
| 12 | + Discover how AggKit's ingenious architecture makes complex cross-chain synchronization feel effortless |
| 13 | + </p> |
| 14 | +</div> |
| 15 | + |
| 16 | +## The Architecture Story: Building a Synchronization Symphony |
| 17 | + |
| 18 | +Imagine conducting an orchestra where the musicians are scattered across different buildings, in different time zones, playing different instruments, but they all need to stay perfectly synchronized to create beautiful music together. That's essentially the challenge AggKit solves for blockchain networks. |
| 19 | + |
| 20 | +Traditional blockchain architecture assumes you're dealing with a single network. But in the Agglayer ecosystem, you're dealing with **multiple sovereign chains** that each have their own rhythm, their own pace, their own way of doing things – yet they all need to work together seamlessly. |
| 21 | + |
| 22 | +AggKit's architecture is the **conductor's baton** that keeps everyone in perfect harmony. |
| 23 | + |
| 24 | +## The Three-Tier Architecture: How the Magic Happens |
| 25 | + |
| 26 | +Let's break down AggKit's architecture into three distinct tiers, each with its own purpose and personality: |
| 27 | + |
| 28 | +### Tier 1: Your Chain's Domain |
| 29 | + |
| 30 | +At the foundation, you have **your L2 chain** doing what it does best – processing transactions, executing smart contracts, maintaining state. This is your domain, where you have full sovereignty and control. |
| 31 | + |
| 32 | +When users perform bridge operations on your chain, several things happen simultaneously: bridge contracts emit events, state gets updated, and your chain needs to communicate these changes to the broader ecosystem. This is where AggKit steps in. |
| 33 | + |
| 34 | +### Tier 2: The AggKit Synchronization Orchestra |
| 35 | + |
| 36 | +In the middle tier, you have **AggKit components** working together like a well-orchestrated symphony. Each component has its specialized role, but they all coordinate to ensure seamless synchronization: |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +*Figure 1: The three-tier architecture – your chain, AggKit synchronization, and the broader ecosystem* |
| 41 | + |
| 42 | +### Tier 3: The Unified Ecosystem |
| 43 | + |
| 44 | +At the top tier, you have **the broader Agglayer ecosystem** – Agglayer itself, Ethereum L1, and all the other chains connected to the network. This is where the global state lives, where final settlement happens, and where the unified liquidity that makes everything possible is maintained. |
| 45 | + |
| 46 | +## Data Flow Architecture |
| 47 | + |
| 48 | +### The Two Essential Conversations |
| 49 | + |
| 50 | +Understanding AggKit's architecture means understanding the **two critical conversations** that keep everything synchronized: |
| 51 | + |
| 52 | +#### **Upward Flow: L2 → Agglayer** |
| 53 | +```mermaid |
| 54 | +sequenceDiagram |
| 55 | + participant L2 as L2 Chain |
| 56 | + participant BS as BridgeSync |
| 57 | + participant L1S as L1InfoTreeSync |
| 58 | + participant AS as AggSender |
| 59 | + participant AL as Agglayer |
| 60 | + |
| 61 | + Note over L2,AL: Certificate Submission Flow |
| 62 | + L2->>BS: Bridge Events |
| 63 | + BS->>AS: Bridge Data |
| 64 | + L1S->>AS: L1 Verification Data |
| 65 | + AS->>AS: Build Certificate |
| 66 | + AS->>AL: Submit Certificate |
| 67 | + AL->>AL: Generate Pessimistic Proof |
| 68 | + AL-->>AS: Certificate Status |
| 69 | +``` |
| 70 | + |
| 71 | +**Purpose**: Submits L2 state transitions to Agglayer for validation and proof generation. |
| 72 | + |
| 73 | +**Components Involved**: |
| 74 | + |
| 75 | +- **BridgeSync**: Captures bridge events from L2 contracts |
| 76 | +- **L1InfoTreeSync**: Provides L1 verification data and Merkle proofs |
| 77 | +- **AggSender**: Packages data into signed certificates and submits to Agglayer |
| 78 | + |
| 79 | +#### **Downward Flow: Agglayer → L2** |
| 80 | +```mermaid |
| 81 | +sequenceDiagram |
| 82 | + participant L1 as Ethereum L1 |
| 83 | + participant L1S as L1InfoTreeSync |
| 84 | + participant AO as AggOracle |
| 85 | + participant L2S as L2GERSync |
| 86 | + participant L2 as L2 Chain |
| 87 | + |
| 88 | + Note over L1,L2: GER Propagation Flow |
| 89 | + L1->>L1S: GER Update Event |
| 90 | + L1S->>AO: New GER Available |
| 91 | + AO->>L2: Inject GER |
| 92 | + L2->>L2S: GER Injected Event |
| 93 | + L2S->>L2S: Index GER Locally |
| 94 | +``` |
| 95 | + |
| 96 | +**Purpose**: Propagates global state updates from Agglayer/L1 to L2 chains for claim verification. |
| 97 | + |
| 98 | +**Components Involved**: |
| 99 | + |
| 100 | +- **L1InfoTreeSync**: Monitors L1 for Global Exit Root updates |
| 101 | +- **AggOracle**: Propagates GER updates to L2 contracts (with v0.3.5 committee security) |
| 102 | +- **L2GERSync**: Indexes and manages GER state locally on L2 |
| 103 | + |
| 104 | +## Component Interaction Patterns |
| 105 | + |
| 106 | +### **Certificate Generation Pattern** |
| 107 | + |
| 108 | +```mermaid |
| 109 | +graph LR |
| 110 | + subgraph "Data Collection" |
| 111 | + A[Bridge Events] --> D[Certificate Builder] |
| 112 | + B[L1 Verification Data] --> D |
| 113 | + C[Chain State] --> D |
| 114 | + end |
| 115 | + |
| 116 | + subgraph "Certificate Processing" |
| 117 | + D --> E[Sign Certificate] |
| 118 | + E --> F[Submit to Agglayer] |
| 119 | + F --> G[Monitor Status] |
| 120 | + end |
| 121 | + |
| 122 | + subgraph "Error Handling" |
| 123 | + G --> H{Certificate Status} |
| 124 | + H -->|Success| I[Complete] |
| 125 | + H -->|Error| J[Retry Logic] |
| 126 | + J --> D |
| 127 | + end |
| 128 | + |
| 129 | + style D fill:#e8f5e8 |
| 130 | + style F fill:#e3f2fd |
| 131 | + style I fill:#f3e5f5 |
| 132 | +``` |
| 133 | + |
| 134 | +*Figure 2: Certificate generation and submission pattern* |
| 135 | + |
| 136 | +### **Oracle Propagation Pattern** |
| 137 | + |
| 138 | +```mermaid |
| 139 | +graph LR |
| 140 | + subgraph "GER Detection" |
| 141 | + A[Monitor L1] --> B[Detect New GER] |
| 142 | + B --> C[Validate GER] |
| 143 | + end |
| 144 | + |
| 145 | + subgraph "Committee Consensus (v0.3.5)" |
| 146 | + C --> D{Committee Mode?} |
| 147 | + D -->|Yes| E[Propose GER] |
| 148 | + E --> F[Collect Votes] |
| 149 | + F --> G{Quorum Met?} |
| 150 | + G -->|Yes| H[Inject GER] |
| 151 | + G -->|No| I[Wait for Votes] |
| 152 | + I --> F |
| 153 | + D -->|No| H |
| 154 | + end |
| 155 | + |
| 156 | + subgraph "L2 Update" |
| 157 | + H --> J[Update L2 Contract] |
| 158 | + J --> K[Index Locally] |
| 159 | + end |
| 160 | + |
| 161 | + style E fill:#fff3e0 |
| 162 | + style F fill:#fff3e0 |
| 163 | + style G fill:#fff3e0 |
| 164 | + style H fill:#e8f5e8 |
| 165 | +``` |
| 166 | + |
| 167 | +*Figure 3: GER propagation with v0.3.5 committee security* |
| 168 | + |
| 169 | +### **v0.3.5 Security Enhancements** |
| 170 | + |
| 171 | +The major architectural improvement in v0.3.5 is the **elimination of single-address vulnerabilities**: |
| 172 | + |
| 173 | +#### **Before v0.3.5: Single Point of Failure** |
| 174 | +```mermaid |
| 175 | +graph LR |
| 176 | + L1[L1 GER Updates] --> Single[Single AggOracle] |
| 177 | + Single --> L2[L2 GER Contract] |
| 178 | + |
| 179 | + style Single fill:#ffebee |
| 180 | +``` |
| 181 | + |
| 182 | +**Risk**: Single compromised address could steal funds or mint unauthorized assets. |
| 183 | + |
| 184 | +#### **After v0.3.5: Distributed Security** |
| 185 | +```mermaid |
| 186 | +graph LR |
| 187 | + L1[L1 GER Updates] --> Committee[AggOracle Committee] |
| 188 | + |
| 189 | + subgraph Committee |
| 190 | + M1[Member 1] |
| 191 | + M2[Member 2] |
| 192 | + M3[Member 3] |
| 193 | + Quorum[Threshold Quorum] |
| 194 | + end |
| 195 | + |
| 196 | + M1 --> Quorum |
| 197 | + M2 --> Quorum |
| 198 | + M3 --> Quorum |
| 199 | + Quorum --> L2[L2 GER Contract] |
| 200 | + |
| 201 | + style Committee fill:#e8f5e8 |
| 202 | + style Quorum fill:#e3f2fd |
| 203 | +``` |
| 204 | + |
| 205 | +**Security**: Multiple parties must agree before any GER injection, eliminating single points of failure. |
| 206 | + |
0 commit comments