Sponsored Content
Skip to content

refactor: Combine AMMHelpers and AMMUtils - #6733

Merged
bthomee merged 2 commits into
developfrom
mvadari/combine-amm-helpers
Apr 8, 2026
Merged

refactor: Combine AMMHelpers and AMMUtils#6733
bthomee merged 2 commits into
developfrom
mvadari/combine-amm-helpers

Conversation

@mvadari

@mvadari mvadari commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR combines the AMMHelpers.{h,cpp} and AMMUtils.{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 AMMHelpers and an AMMUtils file.

#6638

API Impact

N/A

@mvadari mvadari added the Trivial Simple change with minimal effect, or already tested. Only needs one approval. label Apr 7, 2026
@mvadari mvadari changed the title refactor: combine AMMHelpers and AMMUtils refactor: Combine AMMHelpers and AMMUtils Apr 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 into AMMHelpers.{h,cpp}.
  • Updated production code and tests to include AMMHelpers.h instead of AMMUtils.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.

Comment thread include/xrpl/ledger/helpers/AMMHelpers.h
Comment thread include/xrpl/ledger/helpers/AMMHelpers.h Outdated
@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.14634% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.6%. Comparing base (dfcad69) to head (fe0cea0).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/libxrpl/ledger/helpers/AMMHelpers.cpp 94.1% 12 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
include/xrpl/ledger/helpers/AMMHelpers.h 95.5% <ø> (ø)
include/xrpl/tx/paths/AMMLiquidity.h 100.0% <ø> (ø)
src/libxrpl/tx/invariants/AMMInvariant.cpp 95.1% <ø> (ø)
src/libxrpl/tx/paths/BookStep.cpp 95.9% <ø> (ø)
src/libxrpl/tx/transactors/dex/AMMBid.cpp 90.6% <ø> (ø)
src/libxrpl/tx/transactors/dex/AMMClawback.cpp 95.5% <ø> (ø)
src/libxrpl/tx/transactors/dex/AMMCreate.cpp 90.8% <ø> (ø)
src/libxrpl/tx/transactors/dex/AMMDelete.cpp 95.5% <ø> (ø)
src/libxrpl/tx/transactors/dex/AMMDeposit.cpp 96.1% <ø> (ø)
src/libxrpl/tx/transactors/dex/AMMVote.cpp 98.3% <ø> (ø)
... and 4 more

... and 6 files 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.

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

@mvadari
mvadari force-pushed the mvadari/combine-amm-helpers branch from 1902c7c to dfe52c3 Compare April 8, 2026 17:14
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

All conflicts have been resolved. Assigned reviewers can now start or resume their review.

@mvadari
mvadari requested a review from bthomee April 8, 2026 17:15

@gregtatcam gregtatcam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mvadari mvadari added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label Apr 8, 2026
@bthomee
bthomee added this pull request to the merge queue Apr 8, 2026
Merged via the queue into develop with commit 7793b5f Apr 8, 2026
3 checks passed
@bthomee
bthomee deleted the mvadari/combine-amm-helpers branch April 8, 2026 17:55
ximinez added a commit that referenced this pull request Apr 14, 2026
marek-foss-neti pushed a commit to marek-foss-neti/rippled that referenced this pull request May 5, 2026
@mvadari mvadari added this to the 3.2.0 milestone May 20, 2026
beartec-jpg pushed a commit to beartec-jpg/FalconLedger that referenced this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. Trivial Simple change with minimal effect, or already tested. Only needs one approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants