Skip to content

perf(invoice): optimize index updates in create#155

Open
Olasunkanmi975 wants to merge 4 commits into
TrusTrove:mainfrom
Olasunkanmi975:perf/invoice-index-storage-writes
Open

perf(invoice): optimize index updates in create#155
Olasunkanmi975 wants to merge 4 commits into
TrusTrove:mainfrom
Olasunkanmi975:perf/invoice-index-storage-writes

Conversation

@Olasunkanmi975

Copy link
Copy Markdown

##closed #141

Summary

Optimizes the InvoiceContract::create flow by reducing redundant persistent storage writes during index maintenance while preserving existing contract behavior and index correctness.

Changes

  • Refactored index update logic to minimize storage set operations.
  • Consolidated redundant index maintenance where possible.
  • Preserved issuer, buyer, and status index semantics.
  • Added tests verifying index correctness after invoice creation.
  • Added documentation describing the optimization and its safety.

Testing

Covered:

  • Invoice creation.
  • Issuer index integrity.
  • Buyer index integrity.
  • Status index integrity.
  • Regression checks for unchanged observable behavior.

Validation

cargo fmt
cargo check --workspace
cargo test

Performance Notes

  • Reduced the number of persistent storage writes performed during create.
  • Preserved storage layout and external contract behavior.
  • No changes to authorization, overflow handling, or public APIs.

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Olasunkanmi975 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Olasunkanmi975

Copy link
Copy Markdown
Author

@K1NGD4VID please review and merge

@K1NGD4VID

Copy link
Copy Markdown
Contributor

Fix Ci Error @Olasunkanmi975

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.

perf(invoice): optimize storage writes in create function

2 participants