telegram link : t.me/nullifiersystem
1. Summary & Core Promise
Soroban smart contracts in contracts/ (such as escrow, htlc-core, and zk-credential) must adhere to strict CPU instruction and memory footprint limits. Currently, developers must manually run gas benchmarks in contracts/atomic-swap/src/benchmarks.rs, and PRs can introduce unnoticed WASM size bloat.
This feature implements an Automated Smart Contract Gas Profiling & WASM Size Optimization CI Gateway. It adds an automated GitHub Actions step in .github/workflows/contracts-ci.yml, enforces automated WASM binary optimization (wasm-opt -O4), builds a gas footprint reporter in contracts/soroban-lint, and fails CI builds if contract WASM binaries exceed configured size thresholds.
2. Background & Architectural Risks
- WASM Size Bloat: Un-optimized Rust contract dependencies can cause WASM binaries to exceed Stellar testnet size limits (>50 KB), blocking deployment.
- Unnoticed Gas Regressions: Code changes introducing inefficient loops or storage key allocations increase transaction fees for users.
3. Database Layer Specifications
(Not Applicable - Tooling & CI Build System)
4. Backend Route & Service Layer Specifications
(CI Pipeline & CLI Benchmarking Tooling)
5. Background Processors / Workers
GitHub Actions CI Runner (.github/workflows/contracts-ci.yml)
- Runs
cargo build --target wasm32-unknown-unknown --release, executes wasm-opt -O4, measures WASM size, and posts benchmark summary comments to PRs.
6. Frontend / UI Component Specifications
(Not Applicable - CI / CLI Tooling)
7. Rigor & Test Plan
- CI Benchmark Test Script (
scripts/check-wasm-size.sh): Test size measurement and assertion failure triggers when WASM exceeds threshold.
- Soroban Lint Rule Test (
contracts/soroban-lint): Assert static analyzer flags un-optimized storage key calls.
8. Relevant Files Inventory
New Files to Create
scripts/check-wasm-size.sh
scripts/benchmark-contract-gas.sh
contracts/soroban-lint/src/rules/gas_optimization.rs
Existing Files to Modify
.github/workflows/contracts-ci.yml
contracts/atomic-swap/src/benchmarks.rs
contracts/Cargo.toml
turbo.json
9. Acceptance Criteria
10. Contributor Notes
- ⚠️ CI Rule: ALWAYS run
wasm-opt -O4 before measuring binary sizes for release deployments.
telegram link : t.me/nullifiersystem
1. Summary & Core Promise
Soroban smart contracts in
contracts/(such asescrow,htlc-core, andzk-credential) must adhere to strict CPU instruction and memory footprint limits. Currently, developers must manually run gas benchmarks incontracts/atomic-swap/src/benchmarks.rs, and PRs can introduce unnoticed WASM size bloat.This feature implements an Automated Smart Contract Gas Profiling & WASM Size Optimization CI Gateway. It adds an automated GitHub Actions step in
.github/workflows/contracts-ci.yml, enforces automated WASM binary optimization (wasm-opt -O4), builds a gas footprint reporter incontracts/soroban-lint, and fails CI builds if contract WASM binaries exceed configured size thresholds.2. Background & Architectural Risks
3. Database Layer Specifications
(Not Applicable - Tooling & CI Build System)
4. Backend Route & Service Layer Specifications
(CI Pipeline & CLI Benchmarking Tooling)
5. Background Processors / Workers
GitHub Actions CI Runner (
.github/workflows/contracts-ci.yml)cargo build --target wasm32-unknown-unknown --release, executeswasm-opt -O4, measures WASM size, and posts benchmark summary comments to PRs.6. Frontend / UI Component Specifications
(Not Applicable - CI / CLI Tooling)
7. Rigor & Test Plan
scripts/check-wasm-size.sh): Test size measurement and assertion failure triggers when WASM exceeds threshold.contracts/soroban-lint): Assert static analyzer flags un-optimized storage key calls.8. Relevant Files Inventory
New Files to Create
scripts/check-wasm-size.shscripts/benchmark-contract-gas.shcontracts/soroban-lint/src/rules/gas_optimization.rsExisting Files to Modify
.github/workflows/contracts-ci.ymlcontracts/atomic-swap/src/benchmarks.rscontracts/Cargo.tomlturbo.json9. Acceptance Criteria
wasm-opt -O4on all compiled Soroban WASM binaries.10. Contributor Notes
wasm-opt -O4before measuring binary sizes for release deployments.