|
| 1 | +--- |
| 2 | +name: devnet-log-review |
| 3 | +description: Review and analyze devnet run results. Use when users want to (1) Analyze devnet logs for errors and warnings, (2) Generate a summary of a devnet run, (3) Identify interoperability issues between clients, (4) Understand consensus progress and block production, (5) Debug forks and finalization issues. |
| 4 | +--- |
| 5 | + |
| 6 | +# Devnet Log Review |
| 7 | + |
| 8 | +Analyze and summarize devnet run results from lean consensus testing. |
| 9 | + |
| 10 | +## Quick Start |
| 11 | + |
| 12 | +**Run the analysis script:** |
| 13 | +```bash |
| 14 | +# From project root (with logs in current directory) |
| 15 | +.claude/skills/devnet-log-review/scripts/analyze-logs.sh |
| 16 | + |
| 17 | +# Or specify logs directory |
| 18 | +.claude/skills/devnet-log-review/scripts/analyze-logs.sh /path/to/logs |
| 19 | +``` |
| 20 | + |
| 21 | +This produces a structured summary with: |
| 22 | +- Error/warning counts per node |
| 23 | +- Block production statistics |
| 24 | +- Consensus progress |
| 25 | +- Proposer assignments |
| 26 | + |
| 27 | +## Log File Locations |
| 28 | + |
| 29 | +| File | Content | |
| 30 | +|------|---------| |
| 31 | +| `devnet.log` | Combined output from `spin-node.sh` (genesis generation + all node output) | |
| 32 | +| `{client}_{n}.log` | Individual node logs (e.g., `zeam_0.log`, `ream_0.log`, `ethlambda_0.log`) | |
| 33 | + |
| 34 | +## Analysis Scripts |
| 35 | + |
| 36 | +| Script | Description | |
| 37 | +|--------|-------------| |
| 38 | +| `analyze-logs.sh [dir]` | Main entry point - runs all analyses, outputs markdown summary | |
| 39 | +| `count-errors-warnings.sh [dir]` | Count errors/warnings per node (excludes benign patterns) | |
| 40 | +| `count-blocks.sh [dir]` | Count blocks proposed/processed per node (client-aware) | |
| 41 | +| `check-consensus-progress.sh [dir]` | Show last slot reached and proposer assignments | |
| 42 | +| `show-errors.sh [-n node] [-l limit] [-w] [dir]` | Display error details for investigation | |
| 43 | + |
| 44 | +**Usage examples:** |
| 45 | +```bash |
| 46 | +# Just count errors/warnings |
| 47 | +.claude/skills/devnet-log-review/scripts/count-errors-warnings.sh |
| 48 | + |
| 49 | +# Show errors for specific node |
| 50 | +.claude/skills/devnet-log-review/scripts/show-errors.sh -n zeam_0 |
| 51 | + |
| 52 | +# Show errors and warnings with limit |
| 53 | +.claude/skills/devnet-log-review/scripts/show-errors.sh -w -l 50 |
| 54 | +``` |
| 55 | + |
| 56 | +## Common Investigation Patterns |
| 57 | + |
| 58 | +### Tracing Slot-by-Slot Flow |
| 59 | + |
| 60 | +When investigating issues, trace the complete flow for a specific slot using structured logging fields (`slot=X`). |
| 61 | + |
| 62 | +**Note:** Logs contain ANSI color codes. Strip them first: |
| 63 | + |
| 64 | +```bash |
| 65 | +# Strip ANSI codes and grep for a specific slot |
| 66 | +sed 's/\x1b\[[0-9;]*m//g' devnet.log | grep -E "slot=3[^0-9]|slot=3$" |
| 67 | + |
| 68 | +# For double-digit slots |
| 69 | +sed 's/\x1b\[[0-9;]*m//g' devnet.log | grep -E "slot=12[^0-9]|slot=12$" |
| 70 | +``` |
| 71 | + |
| 72 | +Structured logging fields follow `key=value` format: |
| 73 | +- `slot=N` - Slot number |
| 74 | +- `validator_id=N` - Validator index |
| 75 | +- `validator=N` - Validator index (in gossipsub messages) |
| 76 | +- `proposer=N` - Block proposer index |
| 77 | +- `err=...` - Error message |
| 78 | + |
| 79 | +### Comparing Clients at Specific Slots |
| 80 | + |
| 81 | +```bash |
| 82 | +# Extract block hashes for specific slots across all clients |
| 83 | +for slot in 1 2 3 4 5; do |
| 84 | + echo "=== Slot $slot ===" |
| 85 | + grep -h "slot=$slot[^0-9]\|@ $slot[^0-9]" *.log | grep -oE "0x[a-f0-9]{8}" | sort -u |
| 86 | +done |
| 87 | + |
| 88 | +# Check which client has which head at a specific slot |
| 89 | +grep -h "head_slot=18\|Head Slot: 18" *.log |
| 90 | + |
| 91 | +# Compare finalization across clients |
| 92 | +grep -h "finalized.*slot\|Finalized block.*@" *.log | tail -20 |
| 93 | +``` |
| 94 | + |
| 95 | +### Finding Validators |
| 96 | + |
| 97 | +Each validator proposes blocks when `slot % validator_count == validator_id`. |
| 98 | + |
| 99 | +```bash |
| 100 | +# ethlambda - explicit validator_id in logs |
| 101 | +grep "We are the proposer" ethlambda_0.log | head -3 |
| 102 | +# Output: We are the proposer for this slot slot=5 validator_id=5 |
| 103 | + |
| 104 | +# zeam - proposer field in attestation logs |
| 105 | +grep "packing proposer attestation" zeam_0.log | head -3 |
| 106 | +# Output: packing proposer attestation for slot=6 proposer=0 |
| 107 | + |
| 108 | +# Generic approach - validator_id = slot % validator_count |
| 109 | +``` |
| 110 | + |
| 111 | +## Analysis Areas |
| 112 | + |
| 113 | +### Fork Analysis |
| 114 | + |
| 115 | +When clients disagree on which blocks are valid, the network splits into forks. |
| 116 | + |
| 117 | +**Quick check for forks:** |
| 118 | +```bash |
| 119 | +# Compare block hashes at same slot across clients |
| 120 | +grep -h "slot=4[^0-9]" *.log | grep -oE "block_root=0x[a-f0-9]{16}" | sort -u |
| 121 | + |
| 122 | +# If you see different hashes → fork exists! |
| 123 | +``` |
| 124 | + |
| 125 | +**Identifying rejected blocks:** |
| 126 | +```bash |
| 127 | +# Check signature verification failures |
| 128 | +grep -i "signature.*failed\|invalid signature" *.log | head -20 |
| 129 | + |
| 130 | +# ethlambda |
| 131 | +grep "Failed to process block" ethlambda_0.log |
| 132 | + |
| 133 | +# qlean |
| 134 | +grep "Invalid signatures for block" qlean_0.log |
| 135 | + |
| 136 | +# lantern |
| 137 | +grep "signature verification failed" lantern_0.log |
| 138 | +``` |
| 139 | + |
| 140 | +**See [references/FORK_ANALYSIS.md](references/FORK_ANALYSIS.md) for:** |
| 141 | +- Understanding fork types (canonical, orphan, invalid) |
| 142 | +- Tracing parent-child relationships |
| 143 | +- Building fork structure diagrams |
| 144 | +- Determining which validators are on which fork |
| 145 | + |
| 146 | +### Finalization Debugging |
| 147 | + |
| 148 | +Finalization should advance every 6-12 slots. If it stalls, investigate: |
| 149 | + |
| 150 | +```bash |
| 151 | +# Check finalization progress |
| 152 | +grep "finalized_slot=" ethlambda_0.log | tail -20 |
| 153 | + |
| 154 | +# If finalized_slot stays same for 50+ slots → finalization stalled |
| 155 | +``` |
| 156 | + |
| 157 | +**Finalization requires >2/3 supermajority:** |
| 158 | +- 6 validators → need 5 votes minimum |
| 159 | +- 9 validators → need 7 votes minimum |
| 160 | + |
| 161 | +**See [references/FINALIZATION_DEBUG.md](references/FINALIZATION_DEBUG.md) for:** |
| 162 | +- Common causes of finalization stalls |
| 163 | +- Validator participation calculations |
| 164 | +- Justification chain analysis |
| 165 | +- Step-by-step debugging guide |
| 166 | + |
| 167 | +### Error Classification |
| 168 | + |
| 169 | +**See [references/ERROR_CLASSIFICATION.md](references/ERROR_CLASSIFICATION.md) for:** |
| 170 | +- Critical errors (genesis mismatch, panics, database corruption) |
| 171 | +- Expected/benign messages (TODOs, HandshakeTimedOut to unconfigured nodes) |
| 172 | +- Medium severity issues (encoding mismatches, missing blocks) |
| 173 | +- State transition errors |
| 174 | + |
| 175 | +### Client Log Patterns |
| 176 | + |
| 177 | +Different clients have different log formats and key patterns. |
| 178 | + |
| 179 | +**See [references/CLIENT_LOG_PATTERNS.md](references/CLIENT_LOG_PATTERNS.md) for:** |
| 180 | +- Log format for each client (zeam, ream, ethlambda, grandine, lantern, qlean) |
| 181 | +- Key log patterns per client |
| 182 | +- Block counting methods |
| 183 | +- ANSI color code handling |
| 184 | + |
| 185 | +## Block Proposal Flow (ethlambda) |
| 186 | + |
| 187 | +A healthy block proposal follows this sequence: |
| 188 | + |
| 189 | +1. `We are the proposer for this slot` - Node detects it's the proposer |
| 190 | +2. `TODO precompute poseidons in parallel + SIMD` - XMSS aggregate proof starts |
| 191 | +3. `packed_pcs_commit` - Proof commitment |
| 192 | +4. `Logup data` - Logup protocol data |
| 193 | +5. `AIR proof{table=poseidon16}` / `AIR proof{table=poseidon24}` - AIR proofs |
| 194 | +6. `Published block` - Block successfully built and published |
| 195 | +7. `Published block to gossipsub` - Block broadcast to network |
| 196 | + |
| 197 | +## Summary Report Format |
| 198 | + |
| 199 | +Generate concise summaries (20 lines or less) in this structure: |
| 200 | + |
| 201 | +```markdown |
| 202 | +## Devnet Log Summary |
| 203 | + |
| 204 | +**Run:** {N} {client} nodes (`{image}`) | {M} slots ({range}) |
| 205 | + |
| 206 | +| Node | Validator | Blocks Proposed | Errors | Warnings | Status | |
| 207 | +|------|-----------|-----------------|--------|----------|--------| |
| 208 | +| {node_name} | {id} | {count} (slots {list}) | {n} | {n} | {emoji} | |
| 209 | + |
| 210 | +**Issues:** |
| 211 | +- {issue 1} |
| 212 | +- {issue 2} |
| 213 | + |
| 214 | +**{emoji} {RESULT}** - {one-line explanation} |
| 215 | +``` |
| 216 | + |
| 217 | +### Status Emoji Guide |
| 218 | + |
| 219 | +| Emoji | Meaning | When to Use | |
| 220 | +|-------|---------|-------------| |
| 221 | +| 🟢 | Healthy | No errors, blocks processed successfully | |
| 222 | +| 🟡 | Warning | Minor issues but consensus working | |
| 223 | +| 🔴 | Failed | Critical errors, consensus broken, or blocks failing validation | |
| 224 | + |
| 225 | +### Result Line Examples |
| 226 | + |
| 227 | +- `🟢 PASSED` - All nodes healthy, consensus achieved |
| 228 | +- `🟡 PASSED WITH WARNINGS` - Consensus working but minor issues detected |
| 229 | +- `🔴 FAILED` - Consensus broken: {reason} |
| 230 | + |
| 231 | +### Key Rules |
| 232 | + |
| 233 | +1. Keep summary under 20 lines |
| 234 | +2. Use table for per-node status |
| 235 | +3. Status should reflect whether that node's blocks pass validation (🔴 if not) |
| 236 | +4. End with single-line result with emoji |
| 237 | +5. Don't list "what's working" - focus on issues |
| 238 | + |
| 239 | +## Manual Investigation Commands |
| 240 | + |
| 241 | +Use these when scripts don't provide enough detail: |
| 242 | + |
| 243 | +```bash |
| 244 | +# Find which validators proposed blocks |
| 245 | +grep -h "proposer\|We are the proposer" *.log | head -20 |
| 246 | + |
| 247 | +# Check peer connections |
| 248 | +grep -h "peer connected\|Connection established" *.log | head -20 |
| 249 | + |
| 250 | +# Check attestations |
| 251 | +grep -i "attestation" *.log | head -50 |
| 252 | + |
| 253 | +# Search for specific error patterns |
| 254 | +grep -i "genesis mismatch\|panic\|fatal" *.log |
| 255 | + |
| 256 | +# Track attestations to unknown blocks (indicates forks) |
| 257 | +grep "Unknown.*block:" ethlambda_0.log | grep -oE "0x[a-f0-9]{64}" | sort | uniq -c | sort -rn |
| 258 | + |
| 259 | +# Check which validators are on invalid fork |
| 260 | +grep "rejected vote" lantern_0.log | grep -oE "validator=[0-9]+" | sort | uniq -c |
| 261 | +``` |
| 262 | + |
| 263 | +## Detailed References |
| 264 | + |
| 265 | +For in-depth analysis, see these specialized guides: |
| 266 | + |
| 267 | +- **[FORK_ANALYSIS.md](references/FORK_ANALYSIS.md)** - Comprehensive guide to identifying and analyzing blockchain forks, tracing parent-child relationships, building fork structure diagrams, and determining consensus disagreements |
| 268 | +- **[FINALIZATION_DEBUG.md](references/FINALIZATION_DEBUG.md)** - Debugging finalization stalls, validator participation calculations, justification chain analysis, and threshold math |
| 269 | +- **[CLIENT_LOG_PATTERNS.md](references/CLIENT_LOG_PATTERNS.md)** - Log formats and key patterns for all clients (zeam, ream, ethlambda, grandine, lantern, qlean), including block counting methods |
| 270 | +- **[ERROR_CLASSIFICATION.md](references/ERROR_CLASSIFICATION.md)** - Error types, severity levels, expected vs. critical errors, and interoperability issues |
| 271 | + |
| 272 | +## Progressive Disclosure |
| 273 | + |
| 274 | +This skill uses progressive disclosure to keep context usage efficient: |
| 275 | + |
| 276 | +1. **Start here** (SKILL.md) - Quick start workflow and common patterns |
| 277 | +2. **Detailed references** (references/*.md) - Deep dives into specific analysis areas |
| 278 | +3. **Scripts** (scripts/) - Automated analysis tools |
| 279 | + |
| 280 | +Load detailed references only when needed for specific investigations. |
0 commit comments