fix: Check credential for LoanBrokerCoverWithdraw and VaultWithdraw - #7107
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
There was a problem hiding this comment.
Pull request overview
This PR fixes credential-based deposit authorization for VaultWithdraw and LoanBrokerCoverWithdraw so that withdrawals to destinations with lsfDepositAuth can succeed when the sender presents valid sfCredentialIDs. It extends both transaction formats to accept sfCredentialIDs and wires credential validation into preflight/preclaim and the withdraw authorization path.
Changes:
- Add optional
sfCredentialIDstoVaultWithdrawandLoanBrokerCoverWithdrawtransaction templates and generated protocol_autogen wrappers/builders. - Validate
sfCredentialIDsin preflight (credentials::checkFields) and validate referenced credentials in preclaim (credentials::valid), gated byfeatureCredentials+fixCleanup3_4_0. - Extend
canWithdrawto support credential-based deposit preauth (and add app-level tests covering success/failure/expiration cases).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/libxrpl/protocol_autogen/transactions/VaultWithdrawTests.cpp | Adds round-trip and nullopt coverage for sfCredentialIDs in the generated wrapper/builder. |
| src/tests/libxrpl/protocol_autogen/transactions/LoanBrokerCoverWithdrawTests.cpp | Adds round-trip and nullopt coverage for sfCredentialIDs in the generated wrapper/builder. |
| src/test/app/Vault_test.cpp | Adds integration coverage for vault withdraw to lsfDepositAuth destination using credentials, including expiration behavior. |
| src/test/app/lending/LoanBroker_test.cpp | Adds integration coverage for broker cover withdraw to lsfDepositAuth destination using credentials, including expiration behavior. |
| src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp | Adds credential feature gating + preflight/preclaim validation; passes credential IDs into canWithdraw where needed. |
| src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp | Adds credential feature gating + preflight/preclaim validation for cover withdraw. |
| src/libxrpl/ledger/View.cpp | Extends canWithdraw to check credential-based deposit preauth when account-based preauth is absent. |
| include/xrpl/tx/transactors/vault/VaultWithdraw.h | Declares checkExtraFeatures for gating credential field usage. |
| include/xrpl/protocol/detail/transactions.macro | Adds sfCredentialIDs as an optional field for the two transaction types. |
| include/xrpl/protocol_autogen/transactions/VaultWithdraw.h | Adds generated get/has/setCredentialIDs to wrapper/builder. |
| include/xrpl/protocol_autogen/transactions/LoanBrokerCoverWithdraw.h | Adds generated get/has/setCredentialIDs to wrapper/builder. |
| include/xrpl/ledger/View.h | Updates canWithdraw API to accept optional credential IDs (with default), and updates related documentation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
a1q123456
left a comment
There was a problem hiding this comment.
comment is updated, reapproving
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
High Level Overview of Change
Context of Change
VaultWithdrawandLoanBrokerCoverWithdrawdid not acceptsfCredentialIDs, so withdrawals to a destination withlsfDepositAuthand credential-only preauth failed withtecNO_PERMISSIONeven when the sender held valid credentials.Fix
Add
sfCredentialIDsto both transaction formats and wire up credential validation, following the pattern used byPayment. Gated byfixCleanup3_4_0(withfeatureCredentialsfor the field).Spec update: XRPLF/XRPL-Standards#538
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)