Skip to content

Wasm binary size budget + link-time optimization audit #18

@truthixify

Description

@truthixify

Labels: Stellar Wave, stellar, perf, audit, drips, help-wanted
Tier: M (2–4 days)
Type: perf / audit

Context

Soroban enforces hard upload size limits on contract Wasm. As Wraith's Stellar contracts grow (especially wraith-names at ~363 LOC and growing), we're approaching the limits without knowing it. There's also a real fee implication: smaller Wasm is cheaper to deploy and re-deploy.

Today nobody is watching binary size. We need a budget + monitoring + an initial optimization pass.

Scope

  1. Measure current Wasm size for each Stellar contract (debug, release, release+optimized via stellar contract optimize). Capture numbers in contracts/stellar/SIZE.md.
  2. Set a budget per contract — propose 20% headroom under Soroban's current upload limit at the time of writing.
  3. Optimization audit — identify what's contributing to size:
    • Are we shipping panic messages? Replace with panic_with_error! + minimal error codes.
    • Are we using String::from where &str would do? (Stack vs. heap matters for Wasm size.)
    • Are dependencies pulling in extra features? Audit [features] in each Cargo.toml.
    • LTO config — verify lto = "fat" and codegen-units = 1 in release profile.
    • Strip symbols (strip = "symbols").
  4. Apply the safe optimizations. Measure the win.
  5. CI gate — add a job that fails if any contract's optimized Wasm exceeds its budget.

Acceptance criteria

  • SIZE.md with current + budget numbers.
  • Optimizations applied; size reductions measured.
  • CI size-budget job in place.
  • Documented "what to do if you exceed budget" recipe.

Why this matters

Hitting the Wasm upload limit mid-feature-development means an emergency refactor or a hard postponement. Catching this trend now is much cheaper than catching it later.

Resources

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programauditProduces a written report as primary deliverabledripsFunded via Drips Networkhelp wantedExtra attention is neededperfPerformance / optimizationstellarTouches Stellar / Soroban code

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions