Skip to content

Vault: add deduct event payload BENCHMARKS entry and measure gas of batch vs single deduct #358

@greatest0fallt1me

Description

@greatest0fallt1me

Description

BENCHMARKS.md lacks concrete cost comparisons between single deduct and batch_deduct for the vault, which integrators need to size their settlement windows. Capture real Soroban budget metrics (CPU instructions, memory, read/write entries) for representative batch sizes and document the break-even point.

Requirements and Context

  • Use env.budget() (or cost_estimate in tests) to measure single deduct vs batch_deduct at sizes 1, 10, 25, and 50.
  • Record CPU/mem and storage entry counts in BENCHMARKS.md.
  • Note the per-item marginal cost and recommended batch size.
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b task/vault-deduct-benchmarks
  2. Implement changes
    • contracts/vault/src/test.rs — budget-measuring tests
    • BENCHMARKS.md — record results and recommendation
  3. Test and commit
    • cargo test -p callora-vault
    • Capture budget output for each batch size
    • Include test output and notes in the PR

Example commit message

task: benchmark vault single vs batch deduct costs

Acceptance Criteria

  • Budget metrics captured for sizes 1/10/25/50
  • BENCHMARKS.md updated with results
  • Recommended batch size documented
  • Tests reproducible

Guidelines

  • .rs under contracts/vault/src/, cargo test, /// docs, minimum 95% line coverage, no unwrap() in prod paths
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programdocumentationDocumentationenhancementNew feature or improvementsmart-contractSoroban smart-contract work

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions