fix: Use trustline balance direction to validate IOU PaymentMint/PaymentBurn - #7584
Conversation
4afe188 to
ecc4b22
Compare
c8ee8d9 to
c0aebbd
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7584 +/- ##
=========================================
- Coverage 82.0% 82.0% -0.0%
=========================================
Files 1007 1007
Lines 76888 76914 +26
Branches 8971 8971
=========================================
+ Hits 63042 63061 +19
- Misses 13837 13844 +7
Partials 9 9
🚀 New features to boost your workflow:
|
9664d02 to
852abb7
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes delegate granular permission validation for direct IOU payments so PaymentMint/PaymentBurn are determined by the trustline balance direction (execution direction) rather than trusting sfAmount.issuer, which can be encoded as either endpoint. It also hardens Permission::permissionToTxType against out-of-range values that previously could truncate into a different tx type.
Changes:
- Update
Payment::checkGranularSemanticsto validate IOUPaymentMint/PaymentBurnusing trustline limit + balance direction, while keeping MPT behavior based on the unambiguous MPToken issuer. - Change
Permission::permissionToTxTypeto returnstd::optional<TxType>and reject values outside[1, 65536]to prevent truncation/mis-mapping. - Extend
Delegate_testcoverage for issuer-alias scenarios, trust-limit-vs-balance-direction cases, andpermissionToTxTyperange handling.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/test/app/Delegate_test.cpp | Adds targeted tests for IOU issuer aliasing and permission range behavior; adjusts MPT test naming/usage. |
| src/libxrpl/tx/transactors/payment/Payment.cpp | Implements trustline-balance-direction based authorization for IOU PaymentMint/PaymentBurn. |
| src/libxrpl/protocol/Permissions.cpp | Makes permissionToTxType range-safe and updates callers to handle std::optional. |
| include/xrpl/protocol/Permissions.h | Updates the public signature of permissionToTxType to return std::optional<TxType>. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@yinyiqian1 it seems one of the tests fails to build when I tried to merge the PR - can you please take a look? |
I just rebased and it is currently re-running the CI |
ef8785a to
a999fd7
Compare
High Level Overview of Change
Change 1:
PaymentMint/PaymentBurn granular permission check for IOU relies on:
MPT does not have this issue because MPTokenIssuanceID encodes the issuer unambiguously, there is no endpoint aliasing where either side of the trustline can appear as the issuer.
Change 2:
in Permission::permissionToTxType, force the permission value within range [1, 65536]
Context of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)