Skip to content

Add compute budget estimation utility for all contract functions #316

Description

@Kingsman-99

Overview

Callers have no way to estimate the instruction count or memory usage of contract calls before submitting them. Add a simulation-based estimation utility and document budget limits for all public functions.

Acceptance Criteria

  • estimate_compute(function_name, args) off-chain utility function using soroban_simulation
  • Returns { instructions: u64, mem_bytes: u64, read_entries: u32, write_entries: u32 }
  • Estimation covers all public contract functions: create_invoice, pay_invoice, release_funds, get_invoice, get_leaderboard, get_stats
  • COMPUTE_BUDGETS.md documents measured instruction counts for typical inputs (1 recipient, 5 recipients, 20 recipients)
  • Warning emitted in tests if any function exceeds 80% of the Soroban instruction limit
  • CI benchmark job runs estimation on each PR and posts a budget table as a PR comment
  • Any function exceeding the instruction limit fails CI

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptsoptimizationGas and compute optimisation

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