soroban cost awareness
Stop guessing your gas bill.
A three-tier cost pipeline for Stellar smart contracts. Lint at compile time, assert at test time, profile when the budget fails, so every CPU instruction and storage byte is accounted for before mainnet.
[!] WARNING: Unbounded loop detected Function: `process_all_users` Location: src/lib.rs:42 Details: loop lacks budget constraint or max iterations
[!] WARNING: High instantiation cost Function: `init_heavy_struct` Location: src/lib.rs:105 Details: struct size exceeds 4KB, will cause high gas on heap alloc
failures:
---- test_swap_budget ---- BudgetAssertionError: Expected max CPU instructions: 10,000,000 Actual CPU instructions: 12,450,192 Overage: +24.5%
Failed at src/test.rs:88
hover a frame for details / click to zoom
the pipeline
Three tools, one cost pipeline.
Each tier catches a different failure mode. Used together they close the loop: prevent at compile time, detect at test time, diagnose when a budget breaks.
the workflow
How to profile a contract.
Profiling your cost doesn't require modifying your contract code. Simply build with debug symbols and trace the local WASM execution.
catch the pattern
The linter reads your code the way the compiler does, and stops expensive structures at the door.
measure the bill
Budget assert executes real invocations on a simulated network and reports the exact cpu and io cost.
trace the culprit
When a budget fails, the profiler walks every instruction and tells you precisely where it went.
Frequently Asked Questions.
No. The profiler hooks directly into the local WASM execution engine. You only need to compile your binary with DWARF debug info.
You shouldn't. The required debug tables will heavily bloat your binary size, resulting in significantly higher on-chain deployment fees.
No. The profiler traces execution locally in a simulated test environment. It does not query mainnet or testnet transactions.
The profiler will still generate a valid trace. For panics, you'll see the cost leading up to the failure. For infinite loops, it gracefully halts and outputs a partial trace.
Aggressive compiler optimizations like LTO (Link-Time Optimization) and inlining can merge functions. Downstream tools may also strip debug sections, causing coarse line mappings.