Sponsored Content
Skip to content

chore: Add comment explaining why ammLPHolds is called twice - #6546

Merged
bthomee merged 2 commits into
developfrom
mvadari/ammwithdraw-redundance
Mar 17, 2026
Merged

chore: Add comment explaining why ammLPHolds is called twice#6546
bthomee merged 2 commits into
developfrom
mvadari/ammwithdraw-redundance

Conversation

@mvadari

@mvadari mvadari commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR notes that in AMMClawback, ammLPHolds was called twice on purpose

Context of Change

AI review triage

@mvadari
mvadari requested a review from yinyiqian1 March 12, 2026 20:28
@codecov

codecov Bot commented Mar 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.8%. Comparing base (0a9513e) to head (7684514).
⚠️ Report is 7 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6546     +/-   ##
=========================================
- Coverage     79.8%   79.8%   -0.0%     
=========================================
  Files          878     878             
  Lines        67893   67892      -1     
  Branches      7551    7551             
=========================================
- Hits         54209   54208      -1     
  Misses       13684   13684             
Files with missing lines Coverage Δ
src/libxrpl/tx/transactors/dex/AMMClawback.cpp 100.0% <ø> (ø)

... 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.

@yinyiqian1 yinyiqian1 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.

Left a comment.

@mvadari mvadari added 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. labels Mar 17, 2026

@yinyiqian1 yinyiqian1 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.

verifyAndAdjustLPTokenBalance modifies the ledger state. It rounds the LPToken balance.
When fixAMMClawbackRounding is enabled, lpTokenBalance was retrieved twice on purpose before the refactor:

The rounding function verifyAndAdjustLPTokenBalance  happens bewteen the two ammLPHolds  functions.
So if there's rounding happening, the second ammLPHolds  will return a different number from the first ammLPHolds

@yinyiqian1 yinyiqian1 removed the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label Mar 17, 2026
@mvadari mvadari removed the Trivial Simple change with minimal effect, or already tested. Only needs one approval. label Mar 17, 2026
@mvadari
mvadari force-pushed the mvadari/ammwithdraw-redundance branch from a55afcb to b48fb7c Compare March 17, 2026 18:20
@mvadari
mvadari requested a review from yinyiqian1 March 17, 2026 18:20
@mvadari mvadari changed the title refactor: LP token balance retrieval duplicate code in AMMClawback chore: Add comment explaining why ammLPHolds is called twice Mar 17, 2026
@mvadari mvadari added the Trivial Simple change with minimal effect, or already tested. Only needs one approval. label Mar 17, 2026
@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 Mar 17, 2026
@bthomee
bthomee added this pull request to the merge queue Mar 17, 2026
Merged via the queue into develop with commit 95a45d7 Mar 17, 2026
3 checks passed
@bthomee
bthomee deleted the mvadari/ammwithdraw-redundance branch March 17, 2026 20:29
@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.

3 participants