sbpf-analyze — Raydium AMM V4 (mainnet)
$ sbpf-analyze raydium_amm_v4.so ═══════════════════════════════════════════════════════════════════ SBPF STATIC ANALYSIS REPORT Program: entrypoint Total estimated CU: 259,782 (reachable: 751) ═══════════════════════════════════════════════════════════════════ FUNCTION: <0x9680> (worst-case: 16,693 CU, upper-bound: 28,563 CU) (0% static) Instructions: 3236 | Entry: 0x9680 Syscalls: abort (100 CU) Loop at 0x9708–0x9738: 47 insns × 47 CU/iter × ~10 iters (assumed) Loop at 0x9800–0x98c6: 188 insns × 188 CU/iter × ~10 iters (assumed) Loop at 0x9900–0xa29f: 2433 insns × 2,533 CU/iter × ~10 iters (assumed) Syscalls in loop: abort (100 CU) FUNCTION: <0x4d1e> (worst-case: 14,378 CU, upper-bound: 15,096 CU) (13% static) Instructions: 1648 | Entry: 0x4d1e Syscalls: sol_log_ (100 CU), sol_log_ (100 CU, ~356 CU with data) Loop at 0x5100–0x53d2: 572 insns × 1,392 CU/iter × ~10 iters (assumed) Syscalls in loop: sol_log_ (100 CU), sol_log_ (100 CU), sol_log_ (100 CU) ... 53 more functions ... ─────────────────────────────────────────────────────────────────── OPTIMIZATION OPPORTUNITIES ─────────────────────────────────────────────────────────────────── 🔴 [CRITICAL] at 0x2633: Loop (SCC 2018) has no CFG edge exiting the loop → Add a bounded loop counter or exit condition (est. impact: 200,000 CU) 🔴 [CRITICAL] at 0x1120e: Loop (SCC 11920) has no CFG edge exiting the loop → Add a bounded loop counter or exit condition (est. impact: 200,000 CU) 🟡 [WARNING] at 0x5136: Logging syscall `sol_log_` inside a loop (100 CU each) → Remove logging from hot loops or gate behind a debug flag (est. impact: 1,000 CU) 🟡 [WARNING] at 0x5178: Logging syscall `sol_log_` inside a loop (100 CU each) → Remove logging from hot loops or gate behind a debug flag (est. impact: 1,000 CU) 🟡 [WARNING] at 0x51ec: Logging syscall `sol_log_` inside a loop (100 CU each) → Remove logging from hot loops or gate behind a debug flag (est. impact: 1,000 CU)