Skip to content

feat: add invoice lock time limit guard - #2357

Open
boalambo wants to merge 4 commits into
QuickLendX:mainfrom
boalambo:issue-2103-lock-time-limit-guard
Open

feat: add invoice lock time limit guard#2357
boalambo wants to merge 4 commits into
QuickLendX:mainfrom
boalambo:issue-2103-lock-time-limit-guard

Conversation

@boalambo

Copy link
Copy Markdown
Contributor

Implement require_lock_within_time_limit(l) guard to reject actions on
expired locks (older than 30 days). This provides defense-in-depth
against indefinite invoice freezing by compromised admin credentials.

  • Add InvoiceLockExpired error variant (1009)
  • Add LOCK_TIME_LIMIT_SECONDS constant (30 days)
  • Implement require_lock_within_time_limit() in InvoiceStorage
  • Integrate guard at all freeze check locations (settlement, lib, contract)
  • Add negative tests for expired and fresh lock scenarios
  • Fix duplicate MIN_TRANSFER constant in payments.rs

Closes #2103

Implement require_lock_within_time_limit(l) guard to reject actions on
expired locks (older than 30 days). This provides defense-in-depth
against indefinite invoice freezing by compromised admin credentials.

- Add InvoiceLockExpired error variant (1009)
- Add LOCK_TIME_LIMIT_SECONDS constant (30 days)
- Implement require_lock_within_time_limit() in InvoiceStorage
- Integrate guard at all freeze check locations (settlement, lib, contract)
- Add negative tests for expired and fresh lock scenarios
- Fix duplicate MIN_TRANSFER constant in payments.rs

Closes QuickLendX#2103
@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

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

boalambo and others added 3 commits July 27, 2026 09:04
Soroban symbols have a max length of 9 characters. Changed INV_LK_EXP
to INV_LK_XPD to comply with this limit.
@boalambo

Copy link
Copy Markdown
Contributor Author

Hi! Just a quick note about the CI failures.

The failures aren't caused by the changes for this PR. They come from compilation errors that already exist after merging the latest main into this branch.

For this issue (#2103), I implemented the following:

  • Added the InvoiceLockExpired error (1009) with the symbol INV_LK_XPD.
  • Added a LOCK_TIME_LIMIT_SECONDS constant set to 30 days.
  • Added the require_lock_within_time_limit() guard to InvoiceStorage.
  • Applied the guard anywhere the invoice freeze check is performed.
  • Added negative tests covering the new behavior.

The current build failures are due to unrelated issues already present after the merge, including duplicate definitions, missing error variants, conflicting trait implementations, and missing imports across several modules.

I kept this PR focused on the requested feature instead of trying to fix those unrelated problems. Once the existing merge issues are resolved, this change should build and run as expected.

If there is anything else you want me to do, kindly let me know thank you @Baskarayelu

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.

Add a require_lock_within_time_limit(l) guard

1 participant