Skip to content

Add gradient-based gas optimization profiling to Soroban contract CI pipeline #667

Description

@Smartdevs17

Context


The SubTrackr Soroban smart contracts handle high-frequency subscription operations where gas costs directly impact user transaction fees and contract sustainability. Currently, there is no automated mechanism to detect gas regressions or visualize gas cost trends per contract function across commits.
\

\

Current Limitation

\

  • No CI gate for gas cost regressions in contract deploys
    \
  • Gas profiles are manually checked during audit only
    \
  • No per-function gas attribution or historical trending
    \
  • Gas-intensive operations (batch billing, proration) lack optimization benchmarks
    \

\

Expected Outcome


An automated gas profiling pipeline integrated into CI that benchmarks each contract function, tracks historical gas trends, flags regressions exceeding configurable thresholds, and generates stratified call trees identifying optimization opportunities.
\

\

Acceptance Criteria

\

  • CI job runs gas benchmarks for every Soroban contract function on PR
    \
  • Historical gas cost trending stored and visualized per commit
    \
  • Regression gate fails CI if gas exceeds baseline by configurable threshold (e.g., 10%)
    \
  • Stratified gas call tree identifies high-cost sub-operations per function
    \
  • Script to generate baseline gas snapshot on main branch updates
    \
  • Documentation for adding new gas benchmarks and interpreting results
    \
  • Integration with GitHub Actions summary annotations
    \

\

Technical Scope

\

  • Files: contracts/subscription/src/ (all contract modules), contracts/Cargo.toml, .github/workflows/ci.yml, scripts/gas-benchmark.sh
    \
  • APIs: Soroban SDK cost_utils, Stellar RPC simulateTransaction
    \
  • Edge cases: Gas cost variance across different Stellar network conditions, large batch operations vs single operations, storage access pattern optimization

Metadata

Metadata

Assignees

Labels

200-points200 point issueStellar WaveIssues in the Stellar wave programdrips-waveIssues in the Drips Wave programhighHigh complexity issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions