Skip to content

refactor: Move increaseOwnerCount onto AccountRootEntry - #8423

Open
mvadari wants to merge 5 commits into
mvadari/rearch/accountroot-checkReservefrom
mvadari/rearch/accountroot-increaseOwnerCount
Open

mvadari wants to merge 5 commits into
mvadari/rearch/accountroot-checkReservefrom
mvadari/rearch/accountroot-increaseOwnerCount

Conversation

@mvadari

@mvadari mvadari commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

Replaces both entry-taking increaseOwnerCount free functions with writable members of AccountRootEntry: increaseOwnerCount(sponsorSle, count) and increaseOwnerCount(ctx, count). The members use the entry's view and journal, so call sites pass their journal to the entry constructor. The AccountID-based overload stays as a shim. adjustOwnerCountSigned becomes a private member; decreaseOwnerCount is a temporary friend so it can still call it (the next PR in the stack removes the friend). adjustOwnerCountImpl moves to namespace detail, because adjustLoanBrokerOwnerCount also uses it on a LoanBroker SLE.

Context of Change

Part of the Wrapped SLEs migration (design: step 2/3 of #7886). Owner-count updates now need a writable AccountRootEntryW, so the compiler rejects them on a read-only entry. Pure refactor: no amendment, no behavior change; any observable difference is a bug.

Stacked on #8406; review only the last commit.

This PR was fully written by AI (Claude Code) under human direction; the human author reviewed the diff.

API Impact

  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)

Test Plan

Syntax-checked (clang++ -fsyntax-only with project flags) every changed .cpp and every .cpp that includes AccountRootEntry.h or AccountRootHelpers.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

@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.90110% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/libxrpl/ledger/entries/AccountRootEntry.cpp 98.2% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

This is a clean, mechanical refactor moving increaseOwnerCount onto AccountRootEntry as described. Call sites are consistently updated to the new member-call style, journals are correctly threaded into entry constructors where the old free function needed them, and the temporary friend relationship for decreaseOwnerCount/adjustOwnerCountSigned is set up correctly. I did not find correctness, security, or resource-management bugs in the changed lines. The one thing worth a second look is that decreaseOwnerCount's j parameter is now effectively unused for the actual mutation since adjustOwnerCountSigned pulls the journal from accountSle itself instead.

@mvadari
mvadari force-pushed the mvadari/rearch/accountroot-increaseOwnerCount branch from deb6636 to c2bef79 Compare September 30, 2026 14:29

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

Clean, mechanical refactor that moves increaseOwnerCount onto AccountRootEntry and threads the entry's journal through call sites. Most constructor call sites were correctly updated to pass the same journal that was previously used explicitly (e.g. XChainBridge, OracleSet, MPTokenHelpers, RippleStateHelpers). However, in four transactors the refactor deleted a locally-created viewJ/"View" journal that was previously passed explicitly to increaseOwnerCount, and now the account entry's own (already-constructed, unmodified-in-this-diff) journal is used instead for owner-count logging inside adjustOwnerCountSigned. Since the PR explicitly states 'no behavior change; any observable difference is a bug,' it's worth confirming that entry's journal is actually the "View" partition in each case — otherwise owner-count/reserve log messages silently move to a different log category.

@mvadari
mvadari force-pushed the mvadari/rearch/accountroot-increaseOwnerCount branch from c2bef79 to efdc52c Compare September 30, 2026 17:58
@mvadari
mvadari added this pull request to stack #8448 September 30, 2026 17:59
@mvadari
mvadari force-pushed the mvadari/rearch/accountroot-increaseOwnerCount branch from efdc52c to 186dc74 Compare October 5, 2026 13:58
Replace both entry-taking increaseOwnerCount free functions with
writable members of AccountRootEntry. The members use the entry's view
and journal, so call sites pass their journal to the entry constructor.
The AccountID-based overload stays as a shim.

adjustOwnerCountSigned becomes a private member. decreaseOwnerCount is
a temporary friend so it can still call it until it moves too.
adjustOwnerCountImpl moves to namespace detail, because
adjustLoanBrokerOwnerCount also uses it.
@mvadari
mvadari force-pushed the mvadari/rearch/accountroot-increaseOwnerCount branch from 186dc74 to 97a780b Compare October 5, 2026 14:52

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

Mechanical, well-scoped refactor moving increaseOwnerCount/adjustOwnerCountSigned onto AccountRootEntry; call sites consistently updated to pass journal to constructors and call the new members. Didn't find behavior-changing bugs in the sampled logic (adjustOwnerCountSigned body is a verbatim move, sponsor/reserve handling preserved). One minor cleanup item: decreaseOwnerCount's view/j parameters become dead after the refactor.

…earch/accountroot-increaseOwnerCount

# Conflicts:
#	src/libxrpl/ledger/helpers/AccountRootHelpers.cpp
#	src/libxrpl/tx/transactors/account/SignerListSet.cpp
#	src/libxrpl/tx/transactors/bridge/XChainBridge.cpp
#	src/libxrpl/tx/transactors/check/CheckCreate.cpp
#	src/libxrpl/tx/transactors/did/DIDSet.cpp
#	src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp
#	src/libxrpl/tx/transactors/payment/DepositPreauth.cpp
#	src/libxrpl/tx/transactors/proposal/TransactionProposalCreate.cpp

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

No issues found.

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

No issues found.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant