refactor: Combine AMMHelpers and AMMUtils - #6733
Conversation
AMMHelpers and AMMUtilsAMMHelpers and AMMUtils
There was a problem hiding this comment.
Pull request overview
This PR consolidates AMM-related helper logic by merging the former AMMUtils.{h,cpp} contents into AMMHelpers.{h,cpp}, and updates call sites to include the unified header.
Changes:
- Removed
AMMUtils.{h,cpp}and moved its implementations/declarations intoAMMHelpers.{h,cpp}. - Updated production code and tests to include
AMMHelpers.hinstead ofAMMUtils.h. - Kept behavior the same (refactor-only), adjusting only file organization and includes.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/xrpld/rpc/handlers/orderbook/AMMInfo.cpp | Switch include from AMMUtils.h to AMMHelpers.h. |
| src/xrpld/app/ledger/OrderBookDBImpl.cpp | Switch include from AMMUtils.h to AMMHelpers.h. |
| src/test/jtx/impl/AMM.cpp | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| src/test/app/AMMExtended_test.cpp | Switch include from AMMUtils.h to AMMHelpers.h. |
| src/test/app/AMMClawback_test.cpp | Switch include from AMMUtils.h to AMMHelpers.h. |
| src/test/app/AMM_test.cpp | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| src/libxrpl/tx/transactors/dex/AMMVote.cpp | Switch include from AMMUtils.h to AMMHelpers.h. |
| src/libxrpl/tx/transactors/dex/AMMDeposit.cpp | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| src/libxrpl/tx/transactors/dex/AMMDelete.cpp | Switch include from AMMUtils.h to AMMHelpers.h. |
| src/libxrpl/tx/transactors/dex/AMMCreate.cpp | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| src/libxrpl/tx/transactors/dex/AMMClawback.cpp | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| src/libxrpl/tx/transactors/dex/AMMBid.cpp | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| src/libxrpl/tx/paths/BookStep.cpp | Switch include from AMMUtils.h to AMMHelpers.h. |
| src/libxrpl/tx/invariants/AMMInvariant.cpp | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| src/libxrpl/ledger/helpers/AMMUtils.cpp | Deleted; implementations moved into AMMHelpers.cpp. |
| src/libxrpl/ledger/helpers/AMMHelpers.cpp | Receives the moved implementations previously in AMMUtils.cpp. |
| include/xrpl/tx/paths/AMMLiquidity.h | Remove AMMUtils.h include (now covered by AMMHelpers.h). |
| include/xrpl/ledger/helpers/AMMUtils.h | Deleted; declarations moved into AMMHelpers.h. |
| include/xrpl/ledger/helpers/AMMHelpers.h | Receives the moved declarations previously in AMMUtils.h. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6733 +/- ##
=========================================
- Coverage 81.6% 81.6% -0.0%
=========================================
Files 1011 1010 -1
Lines 75979 75979
Branches 7634 7635 +1
=========================================
- Hits 61985 61976 -9
- Misses 13994 14003 +9
🚀 New features to boost your workflow:
|
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
1902c7c to
dfe52c3
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
High Level Overview of Change
This PR combines the
AMMHelpers.{h,cpp}andAMMUtils.{h,cpp}into one set of files,AMMHelpers.{h,cpp}.This is a pure refactor. There are no functionality changes, only moving code around and updating headers.
Context of Change
There is no reason (in fact, it's rather confusing) to have an
AMMHelpersand anAMMUtilsfile.#6638
API Impact
N/A