Skip to content

feat(bench): add Soroban instruction and memory budget regression benchmarks (#23) - #762

Open
huangji6693-max wants to merge 1 commit into
MergeFi:mainfrom
huangji6693-max:feat/soroban-resource-budget-benchmark-23
Open

huangji6693-max wants to merge 1 commit into
MergeFi:mainfrom
huangji6693-max:feat/soroban-resource-budget-benchmark-23

Conversation

@huangji6693-max

Copy link
Copy Markdown

Summary

  • Add Soroban CPU instruction (cpu_instruction_cost) and memory byte (memory_bytes_cost) benchmark modules in contracts/escrow/src/bench.rs, contracts/milestones/src/bench.rs, and contracts/maintenance-pool/src/bench.rs using env.cost_estimate().budget().
  • Measure every public entrypoint across mergefi-escrow, mergefi-milestones, and mergefi-maintenance-pool.
  • Add size-parameterized scaling curves in isolated environments per scaling point N:
    • release, release_issue, and withdraw by recipient count (1, 5, 10, 20).
    • refund and cancel_milestone by contributor count (1, 5, 10, 20).
    • allocate and release_issue by prior allocation count in Milestone.allocations (1, 10, 25, 50).
    • deposit, keep_alive, withdraw, and reclaim_deposit by deposit_count (1, 10, 25, 50).
  • Add regression assertions enforcing a 150% baseline tolerance band and Soroban mainnet per-invocation limits (100,000,000 CPU instructions, 41,943,040 memory bytes).
  • Add make bench target to Makefile and document baseline tables and scaling analysis in BENCHMARKS.md and README.md.

Verification

  • make bench (cargo test --workspace bench_ -- --nocapture --test-threads=1) — all 3 contract benchmark suites pass.
  • cargo clippy --workspace --lib --locked -- -D warnings — 0 warnings.
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items — 0 warnings.

Closes #23

…chmarks (MergeFi#23)

Add Soroban CPU instruction and memory byte resource-budget benchmarks across
mergefi-escrow, mergefi-milestones, and mergefi-maintenance-pool using
env.cost_estimate().budget().

- Cover all public entrypoints across all three contracts.
- Add size-parameterized scaling curves for release/release_issue/withdraw
  recipient counts (1, 5, 10, 20), refund/cancel_milestone contributor counts
  (1, 5, 10, 20), milestone allocations map growth (1, 10, 25, 50), and
  maintenance-pool deposit_count growth (1, 10, 25, 50).
- Enforce a 150% baseline regression tolerance ceiling and Soroban mainnet
  per-invocation limits (100M CPU instructions, 40 MiB memory).
- Add make bench target to Makefile and document baseline tables and scaling
  analysis in BENCHMARKS.md and README.md.

Closes MergeFi#23
@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown

@huangji6693-max is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build a Soroban instruction/resource-budget regression benchmark suite for all entrypoints

1 participant