fix: Prevent stale AuthAccounts from persisting after tfTwoAssetIfEmpty re-initialization - #6996
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #6996 +/- ##
=========================================
- Coverage 82.1% 82.1% -0.0%
=========================================
Files 1010 1010
Lines 76040 76070 +30
Branches 7371 7375 +4
=========================================
+ Hits 62423 62437 +14
- Misses 13617 13633 +16
🚀 New features to boost your workflow:
|
|
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. |
|
/ai-review |
There was a problem hiding this comment.
Pull request overview
Fixes an AMM fee-auction state bug where sfAuthAccounts could persist across an empty-pool reinitialization (via tfTwoAssetIfEmpty deposit), unintentionally granting discounted fees to previously authorized accounts after the auction slot is reset.
Changes:
- Clear
sfAuthAccountsduringinitializeFeeAuctionVote()whenfixCleanup3_2_0is enabled, preventing stale authorized accounts from persisting across re-initialization. - Add a regression test that reproduces the empty-pool reinit scenario and asserts the corrected
sfAuctionSlot/sfVoteSlotsstate (with and without the fix enabled).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libxrpl/ledger/helpers/AMMHelpers.cpp | Clears sfAuthAccounts on AMM empty-state reinitialization when the relevant fix is enabled. |
| src/test/app/AMM_test.cpp | Adds a regression test covering stale sfAuthAccounts persistence across tfTwoAssetIfEmpty reinitialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tfTwoAssetIfEmpty re-initialization
…pty` re-initialization (XRPLF#6996) Co-authored-by: Bart <bthomee@users.noreply.github.com>
High Level Overview of Change
When an AMM pool is emptied and re-initialized via a
tfTwoAssetIfEmptydeposit,initializeFeeAuctionVote()resets the auction slot fields (sfAccount,sfExpiration,sfPrice,sfDiscountedFee) but does not clearsfAuthAccounts. Stale authorized accounts from the previous auction slot holder persist and get discounted trading fees (TradingFee/10) without the new depositor's knowledge or consent.Context of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)