Added verification guards for finance actions#755
Merged
Baskarayelu merged 6 commits intoQuickLendX:mainfrom Apr 1, 2026
Merged
Added verification guards for finance actions#755Baskarayelu merged 6 commits intoQuickLendX:mainfrom
Baskarayelu merged 6 commits intoQuickLendX:mainfrom
Conversation
|
@Cofez 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: prevent verification bypass on restricted actions
Base branch:
main| Head branch:bypass📝 Description
Implements a centralized verification guard system that enforces deny-by-default access control on all restricted finance actions. Unverified, pending, and rejected actors are blocked from invoice uploads, bid placements, settlement initiations, and escrow releases through typed guard functions with exhaustive error variants.
Closes #540
🎯 Type of Change
🔧 Changes Made
New Files Added
src/verification.rs— Centralized guard module (~400 lines, 47 inline unit tests)src/test_business_kyc.rs— Business KYC guard tests (37 tests)src/test_investor_kyc.rs— Investor KYC guard tests (38 tests)Files Modified
src/lib.rs— Addedpub mod verificationand test module declarationsdocs/contracts/verification.md— Comprehensive guard system documentationKey Changes
guard_invoice_upload,guard_settlement_initiation,guard_escrow_release(business);guard_bid_placement,guard_investment_action(investor)Verifiedis terminaleffective_limit = base_limit × tier_multiplier × risk_bps / 10_000with checked arithmeticGuardErrorandTransitionErrorenums for precise audit trails🧪 Testing
Test Coverage
📋 Contract-Specific Checks
Contract Testing Details
Verifiedstatus passeschecked_mul/checked_divto prevent overflowVerifiedstate prevents social-engineering status downgrades📋 Review Checklist
fees.rs,settlement.rs,profits.rspatterns)🔍 Code Quality
cargo check --testspasses with 0 errors, 0 warnings🚀 Performance & Security
📚 Documentation
docs/contracts/verification.mdfully rewritten with guard taxonomy, transition matrix, tier/risk tables, effective limit formula, security assumptions, and test coverage mapping🔗 Related Issues
Closes #540
🧪 How to Test
cargo check --tests— verify all code compiles with zero warningssrc/verification.rsfor guard logic, limit computation, and state transitionssrc/test_business_kyc.rsfor negative tests on all business guard pathssrc/test_investor_kyc.rsfor investment limit and risk cap enforcementNone — this is a new module addition with no modifications to existing modules.