Repository navigation
Conversation
There was a problem hiding this comment.
Pure refactor moving verifyAndAdjustLPTokenBalance from a free function taking (Sandbox&, ..., AMMEntryW&, ...) to a writable member AMMEntry::verifyAndAdjustLPTokenBalance(lpTokens, account). The body logic is copied verbatim (isOnlyLiquidityProvider check, relative-distance tolerance check, setFieldAmount + update()), just swapping the passed-in Sandbox/ammSle for this->applyView()/this. Both call sites (AMMWithdraw, AMMClawback) are updated consistently and still check the [[nodiscard]] std::expected result the same way as before. No changed-code correctness, security, or style issues stood out; the one behavioral assumption (that this->applyView() is equivalent to the Sandbox previously passed in) is asserted by the PR author and can't be verified from this diff alone, but I have no concrete evidence it's wrong.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
9e5a3d0 to
bb9a65d
Compare
There was a problem hiding this comment.
This is a clean, mechanical refactor that moves verifyAndAdjustLPTokenBalance from a free function in AMMHelpers onto AMMEntry as a writable-only member. The new member method preserves the original logic exactly (same tolerance check, same LPTokenBalance update, same error path), just substituting this->applyView()/this->update()/Base::operator->() for the old sb/ammSle.update()/ammSle-> parameters. Call sites in AMMWithdraw.cpp and AMMClawback.cpp are updated consistently, and the now-unused AMMEntry.h include was correctly dropped from AMMHelpers.h. No behavioral change is evident in the diff, and the header declaration correctly gates the member with requires Base::kIsWritable, matching the existing pattern used by initializeFeeAuctionVote in the same class.
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
bb9a65d to
0696761
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
0696761 to
115c4ae
Compare
There was a problem hiding this comment.
Clean, mechanical refactor that moves the free function verifyAndAdjustLPTokenBalance into a writable-only member of AMMEntry, replacing the Sandbox&/AMMEntryW& parameters with this->applyView()/this. The function body logic (isOnlyLiquidityProvider check, tolerance check, setFieldAmount, update) is preserved verbatim, both call sites (AMMWithdraw, AMMClawback) are updated consistently, and the now-unused AMMEntry.h include is correctly dropped from AMMHelpers.h. New includes added to AMMEntry.cpp (Number.h, Issue.h) match the newly-needed symbols. No behavioral change is evident in the diff.
115c4ae to
e0b5eab
Compare
Replace the free verifyAndAdjustLPTokenBalance(sb, lpTokens, ammSle, account) with the writable member AMMEntry::verifyAndAdjustLPTokenBalance(lpTokens, account). The member checks the LP through the entry's own view, which both callers already built over the same Sandbox. AMMHelpers.h no longer uses AMMEntry.h, so drop that include.
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
e0b5eab to
97db006
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
…ri/rearch/amm-verifyAndAdjustLPTokenBalance # Conflicts: # src/libxrpl/ledger/helpers/AMMHelpers.cpp
High Level Overview of Change
Moves
verifyAndAdjustLPTokenBalance(sb, lpTokens, ammSle, account)onto the wrapper as the writable memberAMMEntry::verifyAndAdjustLPTokenBalance(lpTokens, account)(gated byrequires Base::kIsWritable). The member callsisOnlyLiquidityProviderwith the entry's own view and callsupdate()on itself, as before. The body is inAMMEntry.cpp.AMMHelpers.hno longer usesAMMEntry.h, so that include is gone.Context of Change
Part of the Wrapped SLEs migration (design: step 2/3 of #7886). The compiler now rejects a call on a read-only entry, and a caller cannot pass a view that does not match the entry. Pure refactor: no amendment, no behavior change; any observable difference is a bug.
Stacked on #8434; review only the last commit.
Both callers (
AMMWithdraw,AMMClawback) already built the entry over the sameSandboxthat they passed assb.This PR was fully written by AI (Claude Code) under human direction; the human author reviewed the diff.
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)Test Plan
Compile-checked (
clang++ -fsyntax-onlywith the project flags) every changed .cpp and every .cpp that includesAMMEntry.horAMMHelpers.h, directly or through another header (31/31 pass). clang-tidy is clean on all changed .cpp and .h files. No new tests in this PR. CI runs the full unit test suite.🤖 Generated with Claude Code