fix: PermissionedDEX (CreateOffer/Payment) never deletes expired credentials#6827
Open
Kassaking7 wants to merge 2 commits intoXRPLF:developfrom
Open
fix: PermissionedDEX (CreateOffer/Payment) never deletes expired credentials#6827Kassaking7 wants to merge 2 commits intoXRPLF:developfrom
Kassaking7 wants to merge 2 commits intoXRPLF:developfrom
Conversation
mvadari
reviewed
Apr 9, 2026
Collaborator
mvadari
left a comment
There was a problem hiding this comment.
This needs to be amendment gated
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6827 +/- ##
=========================================
+ Coverage 81.4% 81.6% +0.1%
=========================================
Files 1006 1010 +4
Lines 74463 76032 +1569
Branches 7578 7634 +56
=========================================
+ Hits 60644 62025 +1381
- Misses 13819 14007 +188
🚀 New features to boost your workflow:
|
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.
High Level Overview of Change
The PermissionedDEX code paths (CreateOffer and Payment) check credential validity via
accountInDomain()in PermissionedDEXHelpers.cpp, but this function uses a ReadView — making it architecturally impossible to delete expired credential SLEs from the ledger. Expired credentials persist indefinitely, locking owner reserves and causing permanent ledger bloat.Root Cause
The XRPL uses a two-phase cleanup pattern for expired credentials:
preclaim()(ReadView): identifies expired credentials, suppresses tecEXPIRED to allow doApply() to rundoApply()(ApplyView): calls verifyValidDomain() → removeExpired() → deleteSLE() to actually delete the expired credential from the ledgerThis pattern is correctly implemented in VaultDeposit (via enforceMPTokenAuthorization → verifyValidDomain → removeExpired). However, the PermissionedDEX paths skip this entirely:
accountInDomain()(PermissionedDEXHelpers.cpp:28-55) takes a ReadView const& parameter. It callscredentials::checkExpired()to skip expired credentials, but cannot call deleteSLE() because ReadView is immutable.Neither
CreateOffer::doApply()norPayment::doApply()have any call toverifyValidDomain()orremoveExpired()for the PermissionedDEX credential check path.Context of Change
Add a
verifyValidDomain()call in thedoApply()of both CreateOffer and Payment when a DomainID is present. This mirrors how VaultDeposit handles it. The pattern is:preclaim:accountInDomain(ReadView) checks validity, suppressestecEXPIREDdoApply: callverifyValidDomain(ApplyView) which triggers removeExpired → deleteSLE for any expired credentials encounteredAPI Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)