Repository navigation
Conversation
There was a problem hiding this comment.
This is a clean, mechanical refactor that moves accountReserve() onto AccountRootEntry as a const member, threading the entry's own view/journal through instead of passing them separately. I traced every call-site conversion (accountReserve(view, sle, j, adj) → sle.reserve(adj), and the added journal args to AccountRootEntryR/W constructors) across all ~20 changed transactor files and the helper/header moves (Adjustment struct, accountCountImpl → detail namespace), and the logic is preserved in each case — no dropped adjustments, no mismatched journals, no null-deref risk introduced (existing null checks on the entry are kept before .reserve() is called). The new AccountRootEntry.cpp body and the SLEBase.cpp instantiation-declaration change (for the MSVC C4661 fix) are consistent with the stated design and don't alter behavior. I did not find any correctness, security, or resource-management issues in the added (+) lines that I'm confident about.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
This is a clean, mechanical refactor consistent with its stated goal: the free function accountReserve(view, sle, j, adj) becomes the const member AccountRootEntry::reserve(adj), with Adjustment relocated to AccountRootEntry.h and accountCountImpl moved into namespace detail. I checked every call site that now uses .reserve(...) and confirmed the entry is always constructed with the same journal (and same view) that the old call passed explicitly, so there's no behavior change from a mismatched view/journal. The extern template class change in SLEBase.cpp and the new AccountRootEntry.cpp explicit-instantiation-definition pattern are internally consistent (explicit instantiation declarations still force instantiation of the class body/static members, which is all the exhaustiveness static_assert needs, while avoiding MSVC C4661 from a second definition). The new detail::escrowDestNotAccountResult guard in EscrowHelpers.h is a legitimate defensive addition for the pre-fixCleanup3_2_0 legacy path and matches its documented intent. I did not find any correctness, security, or resource issues in the changed lines.
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
90bb393 to
c72bfa7
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
c72bfa7 to
15280de
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
The exhaustive per-entry-type check in the SLEBase gtest used explicit instantiation definitions. Once an entry class gets out-of-line member bodies in its own .cpp (with the explicit instantiation definition there), the test would instantiate the class a second time, and MSVC rejects it with C4661 because those member bodies are not visible in the test translation unit. Explicit instantiation declarations still instantiate the class definition, which is all the check needs. (cherry picked from commit 8b07abc)
Replace the entry-taking accountReserve(view, sle, j, adj) free function with the const member AccountRootEntry::reserve(adj). The member uses the entry's own view and journal, so call sites now pass their journal to the entry constructor. The AccountID-based accountReserve overload stays as a one-line shim. Adjustment moves to AccountRootEntry.h, since the member takes it. accountCountImpl moves from the anonymous namespace to namespace detail, because both reserve() and xrpLiquid() use it.
An explicit instantiation declaration stops clang from emitting the inline constructors of the header-only entries at -O0, so the debug builds fail to link xrpl_tests (undefined AccountRootEntry constructors). Naming each class in a static_assert already instantiates its definition, which is all the exhaustiveness check needs. (cherry picked from commit 611415e)
(cherry picked from commit 3cca9d3)
15280de to
269f79e
Compare
There was a problem hiding this comment.
This is a clean, mechanical refactor moving accountReserve into AccountRootEntry::reserve(). I traced every call site to verify the beast::Journal threaded into the new entry constructors matches the journal previously passed directly to accountReserve(), and all ~20 sites are consistent. The core reserve() logic in the new AccountRootEntry.cpp preserves the original branching (featureSponsor check, ownerCount/accountCountImpl paths) exactly. The only thing worth flagging is a stale debug-assert message left over from the free-function days.
…ot-accountReserve # Conflicts: # src/libxrpl/tx/transactors/bridge/XChainBridge.cpp # src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp # src/tests/libxrpl/ledger/SLEBase.cpp
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
2 similar comments
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
|
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. |
…ot-accountReserve
High Level Overview of Change
Replaces the entry-taking
accountReserve(view, sle, j, adj)free function with the const memberAccountRootEntry::reserve(Adjustment adj = {}). The member uses the entry's own view and journal, so call sites now pass their journal to the entry constructor. TheaccountReserve(view, AccountID, j, adj)overload stays as a one-line shim.Adjustmentmoves toAccountRootEntry.h, andaccountCountImplmoves tonamespace detailbecause bothreserve()andxrpLiquid()use it. The member body is in the newsrc/libxrpl/ledger/entries/AccountRootEntry.cpp.Context of Change
Part of the Wrapped SLEs migration (design: step 2/3 of #7886). The reserve calculation now lives on the typed entry, so it cannot be called with an SLE of the wrong type or with a view that does not match the entry. Pure refactor: no amendment, no behavior change; any observable difference is a bug.
Stacked on #7916; review only the last commit. The branch also cherry-picks the MSVC C4661 test fix from #8357 (
test: Declare, not define, entry instantiations in SLEBase test), because this PR adds out-of-line members with explicit instantiation.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
Syntax-checked (
clang++ -fsyntax-onlywith project flags) every changed.cppand every.cppthat includesAccountRootEntry.horAccountRootHelpers.h(98/98 passed). clang-tidy clean on all changed files and headers; pre-commit clean. No new tests. CI runs the full unit test suite.🤖 Generated with Claude Code