Skip to content

Feature/manual default authz gates#757

Closed
DevAyomi wants to merge 2 commits intoQuickLendX:mainfrom
DevAyomi:feature/manual-default-authz-gates
Closed

Feature/manual default authz gates#757
DevAyomi wants to merge 2 commits intoQuickLendX:mainfrom
DevAyomi:feature/manual-default-authz-gates

Conversation

@DevAyomi
Copy link
Copy Markdown
Contributor

@DevAyomi DevAyomi commented Mar 28, 2026

Develop strict access and status validation for manual default marking to avoid premature defaults. Closes. #546

- Add strict access control for manual default marking (admin-only)
- Enforce funded-state prerequisite before allowing defaults
- Add validate_invoice_for_default() for eligibility checks
- Add validate_grace_period_expired() for time-based validation
- Add can_mark_as_defaulted() helper for UI pre-validation
- Add comprehensive tests: 21 default tests + 27 error tests
- Update docs/contracts/defaults.md with security model

Security features:
- Admin-only access via require_auth
- Only Funded invoices can be defaulted
- Grace period must expire before defaulting
- Idempotent: double-default returns specific error
- Overflow-protected timestamp calculations

Test coverage: 95%+ for defaults.rs module
- Fixed Cargo.toml duplicate crate-type keys
- Added OverdueScanResult struct and enhanced grace period validation to defaults.rs
- Fixed lib.rs orphaned code and duplicate function definitions
- Fixed invoice.rs missing functions and borrow checker issues
- Fixed dispute.rs missing imports and DisputeStatus variants
- Fixed analytics.rs missing helper functions
- Fixed pause.rs require_not_paused return type
- Fixed currency.rs and emergency.rs require_admin references
- Library compiles successfully (160 warnings only)

Note: Some test files from feature branch may reference missing methods
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

Hey @DevAyomi! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#546 Validate mark-invoice-defaulted authorization and invoice status gates Link to this issue

ℹ️ Learn more about linking PRs to issues

@DevAyomi DevAyomi closed this Mar 28, 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.

1 participant