Skip to content

feat: cap max invoices per business #1672

Open
AugistineCreates wants to merge 2 commits into
QuickLendX:mainfrom
AugistineCreates:feat-invoice-cap
Open

feat: cap max invoices per business #1672
AugistineCreates wants to merge 2 commits into
QuickLendX:mainfrom
AugistineCreates:feat-invoice-cap

Conversation

@AugistineCreates

Copy link
Copy Markdown

This pr closes #1503

Summary

Implemented a defense‑in‑depth limit on the number of active invoices a business can create. Added a documented constant, exposed a getter, and enforced the cap in store_invoice. Updated tests with a negative case verifying the limit enforcement.

Threat Mitigation

Auditors could flag the absence of a per‑business invoice cap as a potential vector for denial‑of‑service or state‑exhaustion attacks. This change closes that gap by ensuring no business can exceed the configurable maximum, preventing abuse and protecting protocol resources.

Changes

  • Added MAX_INVOICES_PER_BUSINESS constant and getter in protocol_limits.rs.
  • Integrated limit check in contract.rs during invoice storage.
  • Added comprehensive test test_store_invoice_respects_cap in test_max_invoices_per_business.rs.
  • Updated documentation comments.

Verification

  • All contract unit tests pass (cargo test -p quicklendx-contracts).
  • Linting (cargo clippy -- -D warnings) and formatting (cargo fmt) succeed.

@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@AugistineCreates 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

@AugistineCreates AugistineCreates changed the title feat: cap max invoices per business (Closes #1063) feat: cap max invoices per business Jun 26, 2026
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.

Cap maximum invoices per business at a documented constant

1 participant