fix: Clamp VaultClawback to assetsAvailable for zero-amount clawback#6646
Open
fix: Clamp VaultClawback to assetsAvailable for zero-amount clawback#6646
Conversation
Zero-amount clawback (meaning "clawback all") returned early without clamping to assetsAvailable, allowing more assets to be recovered than available when there was an outstanding loan. Move the zero-amount path inside the try block so it shares the same clamping logic as non-zero clawback. The old early-return behavior is retained behind a !fixAssortedFixes gate for ledger replay compatibility.
- Add test for the pre-fixAssortedFixes legacy code path where zero-amount clawback does not clamp to assetsAvailable, verifying the transaction fails with tefINTERNAL for ledger replay fidelity - Remove unused sharesBefore variable in zero-amount post-fix test - Normalize env.balance() calls to use PrettyAsset directly - Strengthen non-zero clawback share assertions from inequality checks to exact expected values matching the zero-amount test
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
…_1_3 Resolve amendment conflict: drop placeholder fixAssortedFixes, adopt fixSecurity3_1_3 (Supported::no) from develop. Update VaultClawback and tests to reference the new amendment name and explicitly enable it in the test Env since it is disabled by default.
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
Collaborator
Author
|
/ai-review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #6646 +/- ##
=======================================
Coverage 81.4% 81.5%
=======================================
Files 998 998
Lines 74443 74450 +7
Branches 7563 7558 -5
=======================================
+ Hits 60632 60640 +8
+ Misses 13811 13810 -1
🚀 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.
Zero-amount clawback (meaning "clawback all") returned early without clamping to assetsAvailable, allowing more assets to be recovered than available when there was an outstanding loan. Move the zero-amount path inside the try block so it shares the same clamping logic as non-zero clawback.
The old early-return behavior is retained behind a !fixAssortedFixes gate for ledger replay compatibility.
High Level Overview of Change
Context of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)