Skip to content

fix: OverrideFreeze invariant gap blocks clawback on individually frozen AMM trust lines#6959

Open
Kassaking7 wants to merge 1 commit intoXRPLF:developfrom
Kassaking7:DEFI-643
Open

fix: OverrideFreeze invariant gap blocks clawback on individually frozen AMM trust lines#6959
Kassaking7 wants to merge 1 commit intoXRPLF:developfrom
Kassaking7:DEFI-643

Conversation

@Kassaking7
Copy link
Copy Markdown
Collaborator

High Level Overview of Change

The invariant check condition:
(!isAMMLine || globalFreeze) && hasPrivilege(tx, overrideFreeze)
evaluates to false when isAMMLine=true and globalFreeze=false. This means AMMClawback cannot override individual or deep freeze on AMM trust lines (between the AMM pseudo-account and the issuer). The withdraw() call succeeds because it uses FreezeHandling::fhIGNORE_FREEZE, but the invariant checker then rejects the transaction because it detects a balance change on a frozen AMM line without the override condition being met. This creates a contradiction where the issuer's freeze action prevents their own clawback from the AMM pool.

When the issuer individually freezes their AMM trust line (via TrustSet targeting the AMM pseudo-account with tfSetFreeze), all subsequent AMMClawback transactions against any holder in that pool will fail at the invariant check. Combined with the fact that a frozen holder cannot withdraw via regular AMMWithdraw, this creates a freeze/clawback deadlock where LP tokens are effectively locked until the issuer unfreezes the AMM line.

Context of Change

Change from:
if ((!isAMMLine || globalFreeze) && hasPrivilege(tx, overrideFreeze))
to:
if (hasPrivilege(tx, overrideFreeze))
The overrideFreeze privilege is already restricted to AMMClawback transactions only (via transactions.macro), so removing the AMM line check is safe.

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.6%. Comparing base (4a73be4) to head (4d827c2).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6959     +/-   ##
=========================================
- Coverage     81.6%   81.6%   -0.0%     
=========================================
  Files         1010    1010             
  Lines        75972   75971      -1     
  Branches      7609    7606      -3     
=========================================
- Hits         61984   61982      -2     
- Misses       13988   13989      +1     
Files with missing lines Coverage Δ
src/libxrpl/tx/invariants/FreezeInvariant.cpp 92.2% <100.0%> (-0.1%) ⬇️

... and 1 file with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mvadari
Copy link
Copy Markdown
Collaborator

mvadari commented Apr 16, 2026

This needs an amendment

@Kassaking7
Copy link
Copy Markdown
Collaborator Author

This needs an amendment

Got it. Shall I go with fixSecurity3_1_3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants